Accessing Detailed logs in Tomcat

2019-04-30 01:53发布

while executing a small application in Eclipse, I get an Http Status 500 error from the Tomcat server that I am running through Eclipse itself...

HTTP Status 500 -   

--------------------------------------------------------------------------------  

type Exception report  

message   

description The server encountered an internal error () that prevented it from fulfilling this request.  

exception   

java.lang.NullPointerException  
    org.apache.struts2.impl.StrutsActionProxy.getErrorMessage   (StrutsActionProxy.java:69)  
    com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185)  
    org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)  
    org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)  
    com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)  
    org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:500)  
    org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:434)  


 note The full stack trace of the root cause is available in the Apache Tomcat/7.0.8 logs. 

This message from the server says that error was caused by a "NullPointerException". The last line says that "full stack trace is available in Apache Tomcat/7.0.8 logs. I have checked the logs created in my workspace ( ${catalina.base} is set to a folder in my workspace) but the logs don't provide any details about the "NullPointerException". The only thing present in the logs is...

0:0:0:0:0:0:0:1 - - [03/May/2012:15:19:16 +0530] "GET /KurniawanChap02Struts/ HTTP/1.1" 500 1789

I have also tried increasing the "logging levels" but even that doesn't help. What should I do to access the detailed logs of the server ?

2条回答
聊天终结者
2楼-- · 2019-04-30 02:11

I had the same problem. I removed the unused project that was referenced in properties->Java Build Path->Projects. It was showing that xyz(project Name) is missing. I removed xyz.

Sometimes you can check in properties->Java Build Path->libraries whether any jar is missing. If so, you can add that jar from the classpath.

查看更多
Emotional °昔
3楼-- · 2019-04-30 02:25

I had some similar errors when I was using different versions of Apache Commons. For getting more details about these errors I changed the default loggind of Tomcat to log4j. You can see the detailed instructions in Apache Tomcat 7 (7.0.27) - Logging in Tomcat

This is xml example for log4j that I was using:

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
  <appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d %-5p (%c.java:%L).%M - %m%n" />
    </layout>
  </appender>
  <!-- CATALINA -->
  <logger name="org.apache.catalina.session">
    <level value="INFO" />
  </logger>
  <!-- TOMCAT -->
  </logger>
  <logger name="org.apache.jasper.compiler">
     <level value="INFO" />
  </logger>
  <!-- COMMONS -->
  <logger name="org.apache.commons.digester">
     <level value="INFO" />
  </logger>
  <root>
    <priority value="TRACE" />
    <appender-ref ref="STDOUT" />
  </root>
</log4j:configuration>

I hope that this can hep you.

查看更多
登录 后发表回答