使用oracle webservices代理时使用时出错:java.lang.NoClassDefFoundError:org / codehaus / stax2 / XMLInputFactory2

时间:2011-05-13 14:08:52

标签: java web-services oracle noclassdeffounderror

致电:

GetAccountBalanceResponse resp = services.getAccountBalance(request);

这是完整的错误堆栈:

Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/stax2/XMLInputFactory2
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at oracle.j2ee.ws.saaj.soap.AbstractSOAPImplementation.getStaXParsedEnvelope(AbstractSOAPImplementation.java:160)
at oracle.j2ee.ws.saaj.soap.AbstractSOAPImplementation.createEnvelope(AbstractSOAPImplementation.java:55)
at oracle.j2ee.ws.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:91)
at oracle.j2ee.ws.saaj.soap.MessageImpl.getSOAPBody(MessageImpl.java:1573)
at oracle.j2ee.ws.client.StreamingSender._preHandlingHook(StreamingSender.java:711)
at oracle.j2ee.ws.client.StubBase._preHandlingHook(StubBase.java:754)
at oracle.j2ee.ws.client.StreamingSender._sendImpl(StreamingSender.java:208)
at oracle.j2ee.ws.client.StreamingSender._send(StreamingSender.java:113)
at company.bank.bbank.proxy.runtime.ServicesBinding_Stub.getAccountBalance(ServicesBinding_Stub.java:130)
at company.bank.bbank.proxy.ServicesPortClient.getAccountBalance(ServicesPortClient.java:48)
at company.bank.bbank.client.main(client.java:119)
Caused by: java.lang.ClassNotFoundException: org.codehaus.stax2.XMLInputFactory2
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 25 more

2 个答案:

答案 0 :(得分:1)

快速谷歌搜索会显示http://woodstox.codehaus.org/作为可能的库包含。我猜你要么使用这个库,要么使用依赖它的东西。下载jar文件,确保在运行应用程序时将其添加到类路径中。

可能的jar文件:http://repository.codehaus.org/org/codehaus/woodstox/stax2-api/3.1.1/stax2-api-3.1.1.jar

答案 1 :(得分:1)

问题解决了:

将此依赖项添加到您的项目中;

    <dependency>
        <groupId>org.codehaus.woodstox</groupId>
        <artifactId>stax2-api</artifactId>
        <version>3.1.1</version>
    </dependency>