简体   繁体   English

Tomcat7 / Jackson / WebApp部署崩溃/

[英]Tomcat7/Jackson/WebApp deployment crash/

I'm trying to deploy a new version of my web app on a Ubuntu server (12.04) running Tomcat 7.0.26. 我正在尝试在运行Tomcat 7.0.26的Ubuntu服务器(12.04)上部署Web应用程序的新版本。 Rather than include the jackson- libraries that I use ( -core , -annotations , and -databind ), I'm trying to place them in the /usr/share/tomcat7/lib area for use by other applications that I plan to deploy. 我没有包含我使用的jackson-库( -core-annotations-databind ),而是尝试将它们放在/usr/share/tomcat7/lib区域中,以供计划部署的其他应用程序使用。

I can start the server, and deploy my app. 我可以启动服务器,然后部署我的应用程序。 However, once I do, the app crashes and takes down Tomcat. 但是,一旦我这样做,该应用程序就会崩溃并关闭Tomcat。 Clearly the ObjectMapper is not being properly loaded, but it exists in the databind jar file (I've jar tvf'd it to check)... 显然,ObjectMapper没有正确加载,但是它存在于databind jar文件中(我已经通过tvf jar检查过)...

The response to the client is: 对客户端的响应是:

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.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
    org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
    org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    java.lang.Thread.run(Thread.java:679)

And, the catalina.out log file shows the following after the app is executed: 并且,执行应用程序后,catalina.out日志文件显示以下内容:

Mar 11, 2013 1:42:55 AM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-bio-8080"]
Mar 11, 2013 1:42:55 AM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
Mar 11, 2013 1:42:57 AM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["http-bio-8080"]
Mar 11, 2013 1:42:57 AM org.apache.catalina.loader.WebappClassLoader loadClass
INFO: Illegal access: this web application instance has been stopped already.  Could not load com.fasterxml.jackson.databind.ObjectMapper.  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1587)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1546)
    at org.comtor.authserv.APIServer.doPost(APIServer.java:150)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:679)
Mar 11, 2013 1:42:57 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-bio-8080"]

Any help here is appreciated. 感谢您的帮助。 I'm attempting to learn what is going wrong, how I can prevent it, and also prevent the server from going down (crashing) when the web application is executed and this happens. 我试图了解发生了什么问题,如何防止出现问题以及在执行Web应用程序并发生这种情况时也防止服务器宕机(崩溃)。

Thanks. 谢谢。

I had a similar issue with the Jersey REST libraries. 我对Jersey REST库有类似的问题。 It turned out that Tomcat was crashing my app because there was a version conflict between some jars I included in my WAR file and jars I had moved to Tomcat's lib folder. 事实证明,Tomcat崩溃了我的应用程序,因为在我的WAR文件中包含的某些jar和我移至Tomcat的lib文件夹的jar之间存在版本冲突。

I recommend that you troubleshoot this on a local development machine first because it is quicker and easier to move jar files around. 我建议您首先在本地开发计算机上进行故障排除,因为这样可以更轻松快捷地移动jar文件。 Start with just the libraries Tomcat comes with and all of your required libraries packed into your war file. 从Tomcat随附的库开始,并将所有必需的库打包到war文件中。 Your app should run fine. 您的应用程序应该运行良好。 Then move jar files from your app to Tomcat lib. 然后将jar文件从您的应用程序移至Tomcat库。 You can do this without re-building your app. 您可以执行此操作而无需重新构建您的应用程序。 Just open your war file with an unzip utility like 7-zip and delete the files from your war file as you move them to Tomcat/lib. 只需使用7-zip之类的解压缩实用程序打开war文件,然后在将它们移至Tomcat / lib时从war文件中删除文件即可。 You probably need to restart Tomcat every time but I found it didn't take me long to get a working configuration this way. 您可能每次都需要重新启动Tomcat,但是我发现用这种方法很快就可以花时间来获得有效的配置。 Now my war file is only 735KB instead of 8MB, which matters to me because I'm working with a slow upload speed. 现在我的war文件只有735KB而不是8MB,这对我来说很重要,因为我的上传速度很慢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM