首页 > 编程语言 > 详细

CXF错误:Unsupported major.minor version 51.0,java.lang.UnsupportedClassVersionErro

时间:2015-09-28 02:04:19      阅读:1649      评论:0      收藏:0      [点我收藏+]

CXF错误:Unsupported major.minor version 51.0

java.lang.UnsupportedClassVersionError

?

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.

蕃薯耀 2015年9月27日 12:08:26 星期日

http://fanshuyao.iteye.com/

?

使用CXF学习WebService时,出现如下错误:

?

?

public static void main(String[] args) {
    ServerFactoryBean factoryBean = new ServerFactoryBean();
    String address = "http://192.168.0.36:8082/ws/jax";
    factoryBean.setAddress(address);
    factoryBean.setServiceClass(PersonServiceImpl.class);
    factoryBean.create();
    System.out.println(address + "?WSDL");
}

?

?

?

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/cxf/frontend/ServerFactoryBean : Unsupported major.minor version 51.0
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClassCond(Unknown Source)
	at java.lang.ClassLoader.defineClass(Unknown Source)
	at java.security.SecureClassLoader.defineClass(Unknown Source)
	at java.net.URLClassLoader.defineClass(Unknown Source)
	at java.net.URLClassLoader.access$000(Unknown Source)
	at java.net.URLClassLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at com.spring.cxf.ws.PhoneWebService.main(PhoneWebService.java:9)

?

?

错误原因:

使用jdk6和apache-cxf-3.1.2,但cxf-3.1.2已经不支持jdk6,需要jdk7以上

?

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

?

解决方法一:

把CXF换成apache-cxf-2.7.17

?

解决方法二:

升级jdk到7

?

?

?

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.

蕃薯耀 2015年9月27日 12:08:26 星期日

http://fanshuyao.iteye.com/

CXF错误:Unsupported major.minor version 51.0,java.lang.UnsupportedClassVersionErro

原文:http://fanshuyao.iteye.com/blog/2246409

(1)
(1)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!