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

阅读更多

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/

你可能感兴趣的:(major.minor,version,51.0,蕃薯耀,蕃薯)