我的Java版本是Java(TM)SE运行时环境(版本1.6.0_37-b06)。 我的Maven依赖是针对javax.xml.messaging.URLEndpoint类的:
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
我的代码是:
import javax.xml.soap.*;
...
SOAPConnectionFactory factory = SOAPConnectionFactory.newInstance();
SOAPConnection connection = factory.createConnection();
SOAPMessage message = createSOAPRequest();
String url = "http://localhost:8080/serviceapp/hello";
connection.call(message, url);
我得到的堆栈跟踪是:
java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/xml/messaging/URLEndpoint
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at
错误的原因是什么?