当我点击“查看”按钮查看用户详细信息时,我们面临以下异常:
2017-06-30 19:23:52,831 ERROR [com.myapp.jsp] - <Unable to compile class for JSP:
An error occurred at line: 53 in the jsp file: /WEB-INF/jsps/ViewUserDetails.jsp
apache cannot be resolved or is not a field
50: </myapphtml:myappRow>
51:
52: <myapphtml:myappRow align="left" label="userdetails.field.label.orgs">
53: <logic:iterate name="userDetails" property="Orgs" id="org">
54: <bean:write name="org" property="name" /><br>
55: </logic:iterate>
56: </myapphtml:myappRow>
Stacktrace:>
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 53 in the jsp file: /WEB-INF/jsps/ViewUserDetails.jsp
apache cannot be resolved or is not a field
50: </myapphtml:myappRow>
51:
52: <myapphtml:myappRow align="left" label="userdetails.field.label.orgs">
53: <logic:iterate name="userDetails" property="mappedOrgs" id="org">
54: <bean:write name="org" property="name" /><br>
55: </logic:iterate>
56: </myapphtml:myappRow>
Stacktrace:
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:366)
at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:490)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:379)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:354)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:341)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:662)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:364)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:743)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:485)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:410)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:337)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1063)
at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263)
at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:386)
at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:318)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at at com.myapp.tools.auth.client.AuthFilter.doFilter(AuthFilter.java:512)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.myapp.tools.auth.client.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:90)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
仅在RHEL 7.x和Tomcat组合的组合中发生这种情况。 除此之外,我无法再组合重现此问题。
附加 ViewUserDetails.jsp
<%@ page import="org.apache.struts.Globals" %>
<%@ page import="com.myapp.tools.api.impl.User" %>
<%@ include file="include/commonDef.jspf" %>
<tiles:insert definition="myapp.csd.office.layout.default">
<tiles:put name="header" type="String">
<myapphtml:myappPageHeaderTab headerImage="images/default/icn_user.gif" headerText="form.page.title.user_details"/>
</tiles:put>
<tiles:put name="content" type="String">
<myapphtml:myappBlock>
<myapphtml:myappMessage
genErrorKey="<%= myappGlobals.GENERAL_ERROR %>"
valErrorKey="<%= Globals.ERROR_KEY %>"
genErrorHeading="MC.General.genError"
valErrorHeading="MC.General.genError"
headingBundle="myappBASETAG"/>
</myapphtml:myappBlock>
<strutshtml:form action="/processUserList.do" method="POST">
<input type="hidden" name="action" value="" />
<myapphtml:myappRow align="left" label="userdetails.field.label.orgs">
<logic:iterate name="userDetails" property="Orgs" id="org">
<bean:write name="org" property="name" /><br>
</logic:iterate>
</myapphtml:myappRow>
<myapphtml:myappButtonRow formname="UserDetailsForm">
<myapphtml:myappButton action="cancel" name="form.button.label.cancel" buttonStyle="button_gt" />
</myapphtml:myappButtonRow>
</strutshtml:form>
</tiles:put>
</tiles:insert>
答案 0 :(得分:3)
尝试查看您是否有名为org
的字符串,将其更改为org1
的其他名称。
请参阅answer。
String org =&#34;&#34 ;;在jsp上面的某个地方有类似的东西 那个包装声明。将该变量名称更改为org1或某些 其他有意义的问题将会解决。
Tomcat中有一个known issue,其编译器将其解释为对象org的字段apache的引用
代码在TC4中有效,因为生成的代码更简单 - 它 忽略了许多可能的错误条件。解决这些问题 TC5和TC6中的问题包括完全限定的参考 org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode()
编译器将此解释为对字段apache的引用 对象组织。
当你生成代码时,总会有 命名冲突的可能性。我无法轻易解决这个问题。
我打算将此标记为WONTFIX。更一般地说,避免使用 广泛使用的包前缀(org,com等)作为变量名称 降低您遇到此问题的风险。
顺便说一下,谷歌快速建议你也可以避免2 字母变量名称与顶级域名冲突。
请注意RHEL使用的特定tomcat版本不是社区版本。
不支持任何社区版本的Tomcat
Tomcat支持的版本包含在我们的产品中:
RHEL 7.1中包含的Tomcat rpm软件包,它基于Tomcat 7.0.54。
请注意,我们将关键错误和安全修复程序移植到 当提出问题或报告CVE时,上述版本。因此, 我们提供的版本与社区版本不完全相同 汤姆猫。