java – 无法为JSP编译类

前端之家收集整理的这篇文章主要介绍了java – 无法为JSP编译类前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

当我点击“查看”按钮查看用户详细信息时,我们面临以下异常:

2017-06-30 19:23:52,831 ERROR [com.myapp.jsp] - 

这仅在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" %>

最佳答案
尝试查看是否有一个名为org的String将其更改为org1的其他名称.

answer.

String org = “”; something like this in jsp somewhere on the top of
that package statement. Change that variable name to org1 or some
other meaningful one and your problem will be solved.

在Tomcat中有一个known issue,其编译器将其解释为对象组织的字段apache的引用

The code works in TC4 because the generated code is much simpler – it
ignores a number of possible error conditions. The fix for these
issues in TC5 and TC6 includes a fully qualified reference to
org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode()

The complier is interpreting this as a reference to the field apache
of object org.

When you have generated code,there is always going to be the
possibility of a naming clash. I can’t see an easy way around this.

I am going to mark this as WONTFIX. More generally,avoiding the use
of widely used package prefixes (org,com,etc) as variable names will
reduce your risk of hitting this issue.

As an aside,a quick Google suggests you might also want to avoid 2
letter variable names that clash with top level domains.

请注意,RHEL使用的特定tomcat版本不是社区版本.

Any community releases of Tomcat are not supported

The supported releases of Tomcat are included in our products:

Tomcat rpm package included in RHEL 7.1,which is based on Tomcat
7.0.54.

Please note that we backport critical bug and security fixes on the
above versions when issues are raised or CVEs are reported. Therefore,
the versions we provide are not exactly the same as community versions
of Tomcat.

猜你在找的Java相关文章