使用struts2获得异常?

时间:2012-10-08 09:18:17

标签: struts2 log4j tomcat7

我尝试使用tomcat server 7.0在struts-2.3.4.1中运行简单的示例(Hello wold)。 但是当我运行这个示例应用程序时,我遇到了以下异常:

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:501)
    org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:432)

使用Log4j.xml配置文件:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">

<appender class="org.apache.log4j.rolling.RollingFileAppender" name="FixedWindowRollingFile">
   <param name="Append" value="true"/>
   <param name="ImmediateFlush" value="true"/>

   <rollingPolicy class="org.apache.log4j.rolling.FixedWindowRollingPolicy">
      <param name="fileNamePattern" value="c:/logs/HelloExample/HelloExample.%i.log"/>
       <param name="minIndex" value="1"/>
      <param name="maxIndex" value="10"/>
       </rollingPolicy>
   <triggeringPolicy class="org.apache.log4j.rolling.SizeBasedTriggeringPolicy">
     <param name="MaxFileSize" value="1002400"/>
       </triggeringPolicy>
   <layout class="org.apache.log4j.PatternLayout">
     <param name="ConversionPattern"  value="%d{yyyy-MM-dd HH:mm:ss} %p %c{1}:%L - %m%n"/>
     </layout>
</appender>

 <appender name="ConsoleAppender" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.SimpleLayout"/>
</appender>


   <root>
   <priority value="DEBUG"/>
   <appender-ref ref="ConsoleAppender"/>
    <appender-ref ref="FixedWindowRollingFile"/>

   </root>
</log4j:configuration>

此外,我使用自己的log4j.xml配置文件来配置Web应用程序,但我定期收到此异常(生成日志文件https://gist.github.com/3851738)。

0 个答案:

没有答案