我按照快速步骤在我的网络应用程序中配置DWR(http://directwebremoting.org/dwr/introduction/getting-started.html)。
当设置阶段结束并且我尝试访问我的“localhost:8080 / [myAppPath] / dwr /”时,抛出NumberFormatException:
javax.servlet.ServletException: java.lang.NumberFormatException: null
org.directwebremoting.servlet.DwrServlet.init(DwrServlet.java:77)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)
root cause
java.lang.NumberFormatException: null
java.lang.Integer.parseInt(Unknown Source)
java.lang.Integer.parseInt(Unknown Source)
org.directwebremoting.util.VersionUtil.loadProperties(VersionUtil.java:119)
org.directwebremoting.util.VersionUtil.getLabel(VersionUtil.java:99)
org.directwebremoting.impl.StartupUtil.logStartup(StartupUtil.java:157)
org.directwebremoting.servlet.DwrServlet.init(DwrServlet.java:62)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)
我就像DWR Tutorials所说的那样,我已经尝试了youtube教程,谷歌搜索,甚至在stackoverflow上,并且遇到相同问题的人没有得到答案。
这是我在web.xml上的servlet声明:
<servlet>
<servlet-name>dwr-invoker</servlet-name>
<servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/dwr.xml</param-value>
</init-param>
</servlet>
这是我的dwr.xml:
<dwr>
<allow>
<create creator="static" javascript="DWRManager">
<param name="class" value="negocio.DWRManager"/>
</create>
</allow>
</dwr>
可能导致此异常的原因是什么?
我已经下载了DWR 3.0并将dwr.xml放在与web.xml相同的文件夹中(WEB-INF)
答案 0 :(得分:1)
org.directwebremoting.util.VersionUtil.loadProperties(VersionUtil.java:119)
它似乎是org.directwebremoting.util.VersionUtil类中的内部DWR错误:
major = Integer.parseInt(props.getProperty(KEY_MAJOR));
由于某种原因,无法解析“dwr-version.properties”文件中的值。
尝试使用在其网站2.0.10上公布的最新稳定版本。似乎DWR 3尚未准备好广泛使用。