java.lang.UnsupportedClassVersionError: org/glassfish/jersey/servlet/ServletContainer : Unsupported major.minor version 51.0 (unable to load class org.glassfish.jersey.servlet.ServletContainer)
1.异常出现的原因
(0)在jersey开发的时候,因为用了最新的jersey版本由JDK1.7编译。
参考:https://jersey.java.net/documentation/latest/modules-and-dependencies.html
2.1. Java SE Compatibility
Until version 2.6, Jersey was compiled with Java SE 6. This has changes in Jersey 2.7. Now almost all Jersey components are compiled with Java SE 7 target. It means, that you will need at least Java SE 7 to be able to compile and run your application that is using latest Jersey. Only core-common
and core-client
modules are still compiled with Java class version runnable with Java SE 6.
(1)所以要求在开发的时候编译环境的JDK要>=1.7,否则会出现版本低无法编译的问题。
(2)在部署到tomcat时,tomcat的JDK设置也要>=1.7否则会出现版本低无法部署的问题。
2.参考资料
(1)http://stackoverflow.com/questions/33010871/issue-java-lang-unsupportedclassversionerror-org-glassfish-jersey-servlet-serv
(2)jdk版本 tomcat版本切换导致的异常解决办法:http://blog.csdn.net/lzlchangqi/article/details/18318707
(3)