我按照快速步骤在我的 Web 应用程序 ( http://directwebremoting.org/dwr/introduction/getting-started.html ) 中配置 DWR。
当设置阶段结束并且我尝试访问我的“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 教程所说的那样,我已经尝试过 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) 相同的文件夹中