由Nexus引出的JDK版本问题

claytang 2014-04-04

要在公司内部的一台虚拟机上部署一套Nexus仓库,虚拟机的JDK6版本,Tomcat是6.0的最新稳定版本。从Sonatype.org下载了Nexus的最新稳定版的war包,然后扔到Tomcat下启动竟然部署失败,异常信息如下:

严重: Null component Catalina:type=JspMonitor,name=jsp,WebModule=//localhost/nexus,J2EEApplication=none,J2EEServer=none
2014-4-4 11:28:04 org.apache.catalina.startup.HostConfig deployWAR
严重: Error deploying web application archive nexus.war
java.lang.UnsupportedClassVersionError: org/sonatype/nexus/web/PlexusContainerContextListener : Unsupported major.minor version 5
1.0 (unable to load class org.sonatype.nexus.web.PlexusContainerContextListener)
        at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2858)
        at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1159)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1647)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
        at org.apache.catalina.startup.WebAnnotationSet.loadClassAnnotation(WebAnnotationSet.java:145)
        at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:73)
        at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:56)
        at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:297)
        at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1078)
        at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:261)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4612)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:943)
        at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:778)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:504)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
        at org.apache.catalina.core.StandardService.start(StandardService.java:525)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

从关键异常信息“Unsupportedmajor.minorversion51.0”可得知,是包里编译的class的要求最低版本与系统JDK版本不一致导致的。继续查资料,得到版本号的对应关系如下:

J2SE 8 = 52,
J2SE 7 = 51,
J2SE 6.0 = 50,
J2SE 5.0 = 49,
JDK 1.4 = 48,
JDK 1.3 = 47,
JDK 1.2 = 46,
JDK 1.1 = 45

51.0应该就是JDK7了吧,也就是说要想部署成功,系统JDK版本最低应该是7.

直接去官网down了JDK8,修改catalina变量,启动成功。

大家有多少服务器环境的JDK版本升级到7了?

相关推荐

haloha / 0评论 2010-08-06