log4j jsp 导入
我得到以下信息,但 log4j 在 Java EE 项目的 java 文件中工作正常
09:09:56,785 ERROR [0]] Exception Processing ErrorPage[errorCode=404, location=/pages/sorry3.jsp]
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 1 in the generated java file
The type org.apache.log4j.Logger cannot be resolved. It is indirectly referenced from required .class files
An error occurred at line: 10 in the generated java file
The import org.apache.log4j.Logger cannot be resolved
An error occurred at line: 54 in the jsp file: /pages/sorry3.jsp
Logger cannot be resolved
53:
54: Logger.getLogger("com.mysite.myapp.jsps.sorry3").error(
55: "Page Not Found: " + pageContext.getErrorData().getRequestURI());
56: %>
57:
如果有人能指出我正确的方向,那就太好了。
I'm getting the following, yet log4j works fine in the java files of a Java EE project
09:09:56,785 ERROR [0]] Exception Processing ErrorPage[errorCode=404, location=/pages/sorry3.jsp]
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 1 in the generated java file
The type org.apache.log4j.Logger cannot be resolved. It is indirectly referenced from required .class files
An error occurred at line: 10 in the generated java file
The import org.apache.log4j.Logger cannot be resolved
An error occurred at line: 54 in the jsp file: /pages/sorry3.jsp
Logger cannot be resolved
53:
54: Logger.getLogger("com.mysite.myapp.jsps.sorry3").error(
55: "Page Not Found: " + pageContext.getErrorData().getRequestURI());
56: %>
57:
If anyone could point me in the right direction, that would be great.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来您的类路径中根本没有 log4.jar / log4j.properties 。
将其添加到您的 CLASSPATH 中。
一般来说,log4j.properties应该位于
WEB-INF/classes
。应该有效
It sounds like you don’t have the log4.jar / log4j.properties in your classpath at all.
Add it in your CLASSPATH.
Generally, log4j.properties should be at
WEB-INF/classes
.It should work