在 wildfly 19 中,为什么我得到 javax.faces.FacesException: javax.servlet.jsp.JspException: 必须指定最小值和/或最大值?

In wildfly 19, Why am I getting javax.faces.FacesException: javax.servlet.jsp.JspException: a minimum and / or a maximum have to be specified?

我正在将一个非常旧的应用程序从 jboss 6 迁移到 wildfly 19。它基于 EJB2 和 JSF1.2 - MyFaces。应用程序已部署,但当我尝试访问 JSP 页面之一(用 JSF 包装)时,我收到一个错误,它什么也没告诉我。有没有人知道这是什么意思?在此先感谢您的帮助。

[javax.faces.webapp._ErrorPageWriter] (default task-1) An exception occurred: javax.faces.FacesException: javax.servlet.jsp.JspException: a minimum and / or a maximum have to be specified
    at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:347)
    at org.apache.myfaces.application.jsp.JspViewHandlerImpl.buildView(JspViewHandlerImpl.java:486)
    at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:337)
    at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
    at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:187)
    at org.apache.myfaces.webapp.MyFacesServlet.service(MyFacesServlet.java:122)
    at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
    at io.opentracing.contrib.jaxrs2.server.SpanFinishingFilter.doFilter(SpanFinishingFilter.java:52)
    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
    at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:374)
    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
    at myoldapplication.package.web.filter.ExtranetFilter.doFilter(ExtranetFilter.java:76)
    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
    at myoldapplication.package.web.filter.PerformanceFilter.doFilter(PerformanceFilter.java:33)
    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
    at myoldapplication.package.web.filter.ForceCharacterEncodingAndContentTypeFilter.doFilter(ForceCharacterEncodingAndContentTypeFilter.java:69)
    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
    at myoldapplication.package.web.filter.ChineseWallsFilter.doFilter(ChineseWallsFilter.java:33)
    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
    at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
    at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
    at io.undertow.servlet.handlers.ServletChain.handleRequest(ServletChain.java:68)
    at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
    at org.wildfly.elytron.web.undertow.server.ElytronRunAsHandler.lambda$handleRequest(ElytronRunAsHandler.java:68)
    at org.wildfly.security.auth.server.FlexibleIdentityAssociation.runAsFunctionEx(FlexibleIdentityAssociation.java:103)
    at org.wildfly.security.auth.server.Scoped.runAsFunctionEx(Scoped.java:161)
    at org.wildfly.security.auth.server.Scoped.runAs(Scoped.java:73)
    at org.wildfly.elytron.web.undertow.server.ElytronRunAsHandler.handleRequest(ElytronRunAsHandler.java:67)
    at io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:68)
    at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:132)
    at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
    at io.undertow.server.handlers.DisableCacheHandler.handleRequest(DisableCacheHandler.java:33)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.security.handlers.AuthenticationConstraintHandler.handleRequest(AuthenticationConstraintHandler.java:53)
    at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
    at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
    at io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handleRequest(ServletSecurityConstraintHandler.java:59)
    at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
    at org.wildfly.elytron.web.undertow.server.servlet.CleanUpHandler.handleRequest(CleanUpHandler.java:38)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at org.wildfly.extension.undertow.deployment.GlobalRequestControllerHandler.handleRequest(GlobalRequestControllerHandler.java:68)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:269)
    at io.undertow.servlet.handlers.ServletInitialHandler.access0(ServletInitialHandler.java:78)
    at io.undertow.servlet.handlers.ServletInitialHandler.call(ServletInitialHandler.java:133)
    at io.undertow.servlet.handlers.ServletInitialHandler.call(ServletInitialHandler.java:130)
    at io.undertow.servlet.core.ServletRequestContextThreadSetupAction.call(ServletRequestContextThreadSetupAction.java:48)
    at io.undertow.servlet.core.ContextClassLoaderSetupAction.call(ContextClassLoaderSetupAction.java:43)
    at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create[=12=](UndertowDeploymentInfoService.java:1541)
    at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create[=12=](UndertowDeploymentInfoService.java:1541)
    at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create[=12=](UndertowDeploymentInfoService.java:1541)
    at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create[=12=](UndertowDeploymentInfoService.java:1541)
    at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:249)
    at io.undertow.servlet.handlers.ServletInitialHandler.access[=12=]0(ServletInitialHandler.java:78)
    at io.undertow.servlet.handlers.ServletInitialHandler.handleRequest(ServletInitialHandler.java:99)
    at io.undertow.server.Connectors.executeRootHandler(Connectors.java:376)
    at io.undertow.server.HttpServerExchange.run(HttpServerExchange.java:830)
    at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
    at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
    at java.lang.Thread.run(Thread.java:748)
Caused by: javax.servlet.ServletException: javax.servlet.jsp.JspException: a minimum and / or a maximum have to be specified
    at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:889)
    at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:818)
    at org.apache.jsp.pages.order.BiorderFilter_jsp._jspService(BiorderFilter_jsp.java:316)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:590)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:433)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:403)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:347)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:590)
    at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
    at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:81)
    at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
    at io.undertow.jsp.JspFileHandler.handleRequest(JspFileHandler.java:32)
    at io.undertow.servlet.handlers.ServletChain.handleRequest(ServletChain.java:68)
    at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
    at org.wildfly.elytron.web.undertow.server.ElytronRunAsHandler.lambda$handleRequest(ElytronRunAsHandler.java:68)
    at org.wildfly.security.auth.server.FlexibleIdentityAssociation.runAsFunctionEx(FlexibleIdentityAssociation.java:103)
    at org.wildfly.security.auth.server.Scoped.runAsFunctionEx(Scoped.java:161)
    at org.wildfly.security.auth.server.Scoped.runAs(Scoped.java:73)
    at org.wildfly.elytron.web.undertow.server.ElytronRunAsHandler.handleRequest(ElytronRunAsHandler.java:67)
    at io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:68)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:251)
    at io.undertow.servlet.handlers.ServletInitialHandler.dispatchToPath(ServletInitialHandler.java:186)
    at io.undertow.servlet.spec.RequestDispatcherImpl.forwardImpl(RequestDispatcherImpl.java:227)
    at io.undertow.servlet.spec.RequestDispatcherImpl.forwardImplSetup(RequestDispatcherImpl.java:149)
    at io.undertow.servlet.spec.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:111)
    at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:341)
    ... 71 more
Caused by: javax.servlet.jsp.JspException: a minimum and / or a maximum have to be specified
    at org.apache.myfaces.taglib.core.GenericMinMaxValidatorTag.createValidator(GenericMinMaxValidatorTag.java:70)
    at org.apache.myfaces.taglib.core.ValidateLongRangeTag.createValidator(ValidateLongRangeTag.java:43)
    at javax.faces.webapp.ValidatorELTag.doStartTag(ValidatorELTag.java:50)
    at org.apache.jsp.pages.order.BiorderFilter_jsp._jspx_meth_f_005fvalidateLongRange_005f0(BiorderFilter_jsp.java:3794)
    at org.apache.jsp.pages.order.BiorderFilter_jsp._jspx_meth_h_005finputText_005f0(BiorderFilter_jsp.java:3760)
    at org.apache.jsp.pages.order.BiorderFilter_jsp._jspx_meth_h_005fpanelGrid_005f0(BiorderFilter_jsp.java:3610)
    at org.apache.jsp.pages.order.BiorderFilter_jsp._jspx_meth_h_005fform_005f2(BiorderFilter_jsp.java:3545)
    at org.apache.jsp.pages.order.BiorderFilter_jsp._jspx_meth_t_005fdocumentBody_005f1(BiorderFilter_jsp.java:777)
    at org.apache.jsp.pages.order.BiorderFilter_jsp._jspx_meth_t_005fhtmlTag_005f1(BiorderFilter_jsp.java:693)
    at org.apache.jsp.pages.order.BiorderFilter_jsp._jspx_meth_f_005fview_005f0(BiorderFilter_jsp.java:359)
    at org.apache.jsp.pages.order.BiorderFilter_jsp._jspService(BiorderFilter_jsp.java:301)
    ... 97 more

获取堆栈跟踪时,始终查看最根本的根本原因。答案通常就在那里。

Caused by: javax.servlet.jsp.JspException: a minimum and / or a maximum have to be specified
    at org.apache.myfaces.taglib.core.GenericMinMaxValidatorTag.createValidator(GenericMinMaxValidatorTag.java:70)
    at org.apache.myfaces.taglib.core.ValidateLongRangeTag.createValidator(ValidateLongRangeTag.java:43)
    at javax.faces.webapp.ValidatorELTag.doStartTag(ValidatorELTag.java:50)
    at org.apache.jsp.pages.order.BiorderFilter_jsp._jspx_meth_f_005fvalidateLongRange_005f0(BiorderFilter_jsp.java:3794)
    at org.apache.jsp.pages.order.BiorderFilter_jsp._jspx_meth_h_005finputText_005f0(BiorderFilter_jsp.java:3760)
    at org.apache.jsp.pages.order.BiorderFilter_jsp._jspx_meth_h_005fpanelGrid_005f0(BiorderFilter_jsp.java:3610)
    at org.apache.jsp.pages.order.BiorderFilter_jsp._jspx_meth_h_005fform_005f2(BiorderFilter_jsp.java:3545)
    at org.apache.jsp.pages.order.BiorderFilter_jsp._jspx_meth_t_005fdocumentBody_005f1(BiorderFilter_jsp.java:777)
    at org.apache.jsp.pages.order.BiorderFilter_jsp._jspx_meth_t_005fhtmlTag_005f1(BiorderFilter_jsp.java:693)
    at org.apache.jsp.pages.order.BiorderFilter_jsp._jspx_meth_f_005fview_005f0(BiorderFilter_jsp.java:359)
    at org.apache.jsp.pages.order.BiorderFilter_jsp._jspService(BiorderFilter_jsp.java:301)
    ... 97 more

从下到上仔细大声读出class/method个名字,直到读懂部分内容:

  • BiorderFilter.jsp 正在处理文件
  • <f:view> 标签
  • <t:html> 标签
  • <t:documentBody> 标签
  • <h:form> 标签
  • <h:panelGrid> 标签
  • <h:inputText> 标签
  • <f:validateLongRange> 标签
  • 标签开始
  • 创建 ValidateLongRangeTag
  • 类型的验证器
  • 创建 GenericMinMaxValidatorTag
  • 类型的验证器
  • 问题:“必须指定最小值和/或最大值”

所以很可能您有一个带有 <f:validateLongRange> 标签的 BiorderFilter.jsp 文件,但没有指定 minimum 和/或 maximum 属性。

<h:inputText ...>
   <f:validateLongRange />
</h:inputText>

只需指定至少一个具有非 null 值的属性,此问题就会消失。例如:

<h:inputText ...>
   <f:validateLongRange minimum="0" />
</h:inputText>

或者整个验证器对于特定输入来说可能是不必要的,您最好将其删除。众所周知,一些开发人员使用这种方式来确保输入的值是 Long 而不是例如Double。但是为此,应该使用 Converter 而不是 Validator,或者简单地使用严格类型的 <h:inputText value="#{bean.value}">,其中 valueLong 类型,以便 JSF 执行自己自动转换。