Tomcat项目部署

今天遇到一个问题,在项目部署的时候,本地测试都没有任何问题,部署到服务器上面便出错。查看Tomcat 的日志输出,也只能看到这些内容。

看到里面没有ERROR错误就大意了,来来回回试了好多次,比如更改项目的权限,重启服务器等等都没有起到作用。

其实里面有一句话是比较重要的:

04-May-2018 20:38:14.955 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file
04-May-2018 20:38:14.959 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal Context [/JGGFrame] startup failed due to previous errors

这告诉你详细的信息在另外的日志文件中,所以去log目录下,打开以localhost开头的日志文件仔细查看,就可以看到如下的详细错误输出。

04-May-2018 20:19:36.803 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.listenerStart Error configuring application listener of class com.thinkgem.jeesite.modules.sys.listener.WebContextListener
 java.lang.UnsupportedClassVersionError: com/thinkgem/jeesite/modules/sys/listener/WebContextListener : Unsupported major.minor version 52.0 (unable to load class com.thinkgem.jeesite.modules.sys.listener.WebContextListener)
    at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2532)
    at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:872)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1321)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1180)
    at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:542)
    at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:523)
    at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:150)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4806)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5347)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:755)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:731)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:973)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1849)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

04-May-2018 20:19:36.805 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.listenerStart Skipped installing application listeners due to previous error(s)


其实和上面的内容是一样的,不过这个更加详细。一眼可以看到版本不对的问题。所以将本地项目的编译和build path中的版本都改为和服务器对应,再次重新部署,问题解决。