0

我正在尝试使用http://antoniogoncalves.org/2012/10/24/no-you-dont-need-to-mock-your-soap-web-service-中描述的方法为 Webservice 编写测试测试它/

但是在打电话时Endpoint.publish我得到以下异常

java.lang.NoClassDefFoundError: com.ibm.ffdc.impl.Ffdc
    at com.ibm.ffdc.Manager.<clinit>(Unknown Source)
    at java.lang.J9VMInternals.initializeImpl(Native Method)
    at java.lang.J9VMInternals.initialize(J9VMInternals.java:235)
    at com.ibm.ws.ffdc.FFDCFilter.processException(FFDCFilter.java:82)
    at com.ibm.ws.webservices.engine.components.logger.LogFactory$2.run(LogFactory.java:159)
    at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:63)
    at com.ibm.ws.webservices.engine.components.logger.LogFactory.createLogFactory(LogFactory.java:141)
    at com.ibm.ws.webservices.engine.components.logger.LogFactory.<clinit>(LogFactory.java:98)
    at java.lang.J9VMInternals.initializeImpl(Native Method)
    at java.lang.J9VMInternals.initialize(J9VMInternals.java:235)
    at com.ibm.ws.webservices.engine.soap.MessageFactoryImpl.<clinit>(MessageFactoryImpl.java:103)
    at java.lang.J9VMInternals.initializeImpl(Native Method)
    at java.lang.J9VMInternals.initialize(J9VMInternals.java:235)
    at com.ibm.ws.webservices.engine.soap.SAAJMetaFactoryImpl.newMessageFactory(SAAJMetaFactoryImpl.java:56)
    at javax.xml.soap.MessageFactory.newInstance(MessageFactory.java:143)
    at com.sun.xml.internal.ws.api.SOAPVersion.<init>(SOAPVersion.java:179)
    at com.sun.xml.internal.ws.api.SOAPVersion.<clinit>(SOAPVersion.java:84)
    at java.lang.J9VMInternals.initializeImpl(Native Method)
    at java.lang.J9VMInternals.initialize(J9VMInternals.java:235)
    at com.sun.xml.internal.ws.api.BindingID.<clinit>(BindingID.java:336)
    at java.lang.J9VMInternals.initializeImpl(Native Method)
    at java.lang.J9VMInternals.initialize(J9VMInternals.java:235)
    at com.sun.xml.internal.ws.spi.ProviderImpl.createAndPublishEndpoint(ProviderImpl.java:104)
    at javax.xml.ws.Endpoint.publish(Endpoint.java:181)
    at <junit stuff>
Caused by: java.lang.ClassNotFoundException: com.ibm.ffdc.impl.Ffdc
    at java.net.URLClassLoader.findClass(URLClassLoader.java:434)
    at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:701)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:680)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:358)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:663)
    ... 48 more

我假设这是因为我在 IBM JRE(Websphere 8.0.x)中运行(表示慰问)

我是否可以在 IBM JRE 中使用 Endpoint.publish,而无需启动完整的 Websphere?

4

1 回答 1

0

生成此堆栈跟踪的测试或 JRE 配置以某种方式包含 Websphere 附带的 com.ibm.ws 类。如果您从测试中删除了对 Websphere 类的所有引用,那么您可以获得一个独立的 JRE,而无需使用 Websphere 更改进行测试。您可以从以下位置下载 AIX、Linux 或 z/OS:

https://www.ibm.com/developerworks/java/jdk/

于 2016-10-05T09:28:17.913 回答