上传App时,Apache Tomcat会抛出错误

时间:2014-03-31 17:37:49

标签: java apache maven tomcat

我目前正在尝试在本地Apache Tomcat7上运行我的REST服务。当我访问localhost:8080时,一切正常。如果我使用maven clean install编译我的应用,请将生成的* .war文件复制到cp target/myapp.war /var/lib/tomcat7/webapp并使用systemctl restart tomcat7重新启动Tomcat,我可以通过访问localhost:8080/myapp/rest/myservice按预期使用我的应用。但是,如果现在尝试访问localhost:8080,则会收到HTTP 500错误。查看服务器日志会给我下面的堆栈跟踪。这个错误的原因是什么,我该如何修复它。正如我所说,该应用程序工作正常。

Mar 31 19:17:01 azlan jsvc.exec[7451]: Mar 31, 2014 7:17:01 PM org.apache.jasper.runtime.JspFactoryImpl internalGetPageContext
                                       SEVERE: Exception initializing page context
                                       java.lang.NoClassDefFoundError: javax/el/StaticFieldELResolver
                                               at org.apache.jasper.runtime.JspFactoryImpl.internalGetPageContext(JspFactoryImpl.java:172)
                                               at org.apache.jasper.runtime.JspFactoryImpl.getPageContext(JspFactoryImpl.java:123)
                                               at org.apache.jsp.index_jsp._jspService(index_jsp.java:52)
                                               at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
                                               at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
                                               at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
                                               at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
                                               at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
                                               at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
                                               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
                                               at org.apache.catalina.core.ApplicationFilterChain.doFi
Mar 31 19:17:01 azlan jsvc.exec[7451]: lter(ApplicationFilterChain.java:208)
                                               at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
                                               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
                                               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
                                               at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
                                               at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
                                               at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
                                               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
                                               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
                                               at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
                                               at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
                                               at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
                                       INFO: Starting ProtocolHandler ["ajp-apr-8009"]
Mar 31 19:16:57 azlan jsvc.exec[7451]: Mar 31, 2014 7:16:57 PM org.apache.catalina.startup.Catalina start
                                       INFO: Server startup in 4257 ms
Mar 31 19:17:01 azlan jsvc.exec[7451]: Mar 31, 2014 7:17:01 PM org.apache.jasper.runtime.JspFactoryImpl internalGetPageContext
                                       SEVERE: Exception initializing page context
                                       java.lang.NoClassDefFoundError: javax/el/StaticFieldELResolver
                                               at org.apache.jasper.runtime.JspFactoryImpl.internalGetPageContext(JspFactoryImpl.java:172)
                                               at org.apache.jasper.runtime.JspFactoryImpl.getPageContext(JspFactoryImpl.java:123)
                                               at org.apache.jsp.index_jsp._jspService(index_jsp.java:52)
                                               at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
                                               at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
                                               at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
                                               at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
                                               at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
                                               at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
                                               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
                                               at org.apache.catalina.core.ApplicationFilterChain.doFi
Mar 31 19:17:01 azlan jsvc.exec[7451]: lter(ApplicationFilterChain.java:208)
                                               at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
                                               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
                                               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
                                               at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
                                               at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
                                               at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
                                               at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
                                               at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
                                               at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
                                               at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
                                               at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
                                               at org.apache.coyote.AbstractProto
Mar 31 19:17:01 azlan jsvc.exec[7451]: col$AbstractConnectionHandler.process(AbstractProtocol.java:607)
                                               at org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:2378)
                                               at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
                                               at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
                                               at java.lang.Thread.run(Thread.java:744)
                                       Caused by: java.lang.ClassNotFoundException: javax.el.StaticFieldELResolver
                                               at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1718)
                                               at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569)
                                               ... 27 more
Mar 31 19:17:01 azlan jsvc.exec[7451]: Mar 31, 2014 7:17:01 PM org.apache.catalina.core.StandardWrapperValve invoke
                                       SEVERE: Servlet.service() for servlet [jsp] in context with path [] threw exception [javax.servlet.ServletException: java.lang.NullPointerE
                                       java.lang.NullPointerException
                                               at org.apache.jsp.index_jsp._jspService(index_jsp.java:55)
                                               at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
                                               at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
                                               at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
                                               at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
                                               at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
                                               at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
                                               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
                                               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
                                               at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFil
Mar 31 19:17:01 azlan jsvc.exec[7451]: ter.java:52)
                                               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
                                               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
                                               at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
                                               at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
                                               at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
                                               at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
                                               at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
                                               at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
                                               at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
                                               at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
                                               at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
                                               at org.apache.tomcat.util.net.AprE
Mar 31 19:17:01 azlan jsvc.exec[7451]: ndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:2378)
                                               at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
                                               at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
                                               at java.lang.Thread.run(Thread.java:744)

//更新//

我按照建议查看了Resteasy手册并更新了我的web.xml。但是,如果我现在在localhost:8080/spozz/users访问我的服务,我会得到预期的结果。但如果我访问localhost:8080/spozz/,我就再也看不到index.html了。

的web.xml

<web-app>
    <display-name>The SpoZZ Webservice</display-name>

    <servlet>
        <servlet-name>Resteasy</servlet-name>
        <servlet-class>
            org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
        </servlet-class>
        <init-param>
            <param-name>javax.ws.rs.Application</param-name>
            <param-value>net.avedo.spozz.Spozz</param-value>
        </init-param>
    </servlet>

    <servlet-mapping>
        <servlet-name>Resteasy</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>

</web-app>

0 个答案:

没有答案