1

更新:仅当我尝试在启动应用程序后立即使用Web服务时才会出现ClassNotFoundException。如果我等待(对于某些未知事件/持续时间),则应用程序将起作用。我想知道我需要等待什么。启动后调用WebService时发生WebSphere ClassNotFoundException(但不迟于)


问题:因为确实存在一类不被一个类加载器发现我的应用程序失败。

更多信息

不能被发现的类是com.sun.xml.stream.ZephyrParserFactory。我的EAR有sjsxr.jar。此jar包含类别com.sun.xml.stream.ZephyrParserFactory

EAR还包含MyApp.jar,它包含应用程序的EJB入口点。该MyApp.jar清单引用所有需要的jar文件,包括sjsxr.jar

Manifest-Version: 1.0 
Ant-Version: Apache Ant 1.8.1 
Created-By: 1.5.0_18 (Sun Microsystems Inc.) 
Built-By: GMM Development Team 
Class-Path: aopalliance-1.0.jar commons-codec-1.4.jar commons-collecti 
ons-3.1.jar commons-lang-2.1.jar commons-logging-1.1.1.jar ehcache-co 
re-2.1.0.jar ehcache-spring-annotations-1.1.2.jar joda-time-1.6.1.jar 
    log4j-1.2.16.jar org.springframework.context.support-3.0.4.RELEASE.j 
ar sjsxr.jar slf4j-api-1.6.1.jar slf4j-log4j12-1.6.1.jar spring-aop 
-3.0.4.RELEASE.jar spring-asm-3.0.4.RELEASE.jar spring-beans-3.0.4.RE 
LEASE.jar spring-context-3.0.4.RELEASE.jar spring-core-3.0.4.RELEASE. 
jar spring-expression-3.0.4.RELEASE.jar spring-jdbc-3.0.4.RELEASE.jar 
    spring-tx-3.0.4.RELEASE.jar swiftVal.jar velocity-1.5.jar vm-startup 
.jar xbean.jar 

应用程序包含WebSphere的wsimport工具生成的Web服务客户端代码。当应用程序试图调用这个代码,以下异常被抛出:

EJB threw an unexpected (non-declared) exception during invocation of method 
    "messageIn" on bean "BeanId(MyApp#ejb.jar#NodeEJB, null)". 
Exception data: javax.xml.stream.FactoryConfigurationError: Provider 
    com.sun.xml.stream.ZephyrParserFactory not found 
    at javax.xml.stream.XMLInputFactory.newInstance(Unknown Source) 
    at org.apache.axiom.om.util.StAXUtils$7.run(StAXUtils.java:327) 
    at java.security.AccessController.doPrivileged(AccessController.java:202) 
    at org.apache.axiom.om.util.StAXUtils.getXMLInputFactory_perClassLoader(StAXUtils.java:323) 
    at org.apache.axiom.om.util.StAXUtils.getXMLInputFactory(StAXUtils.java:78) 
    at org.apache.axiom.om.util.StAXUtils.createXMLStreamReader(StAXUtils.java:133) 
    at org.apache.axis2.util.XMLUtils.toOM(XMLUtils.java:596) 
    at org.apache.axis2.util.XMLUtils.toOM(XMLUtils.java:581) 
    at org.apache.axis2.deployment.DescriptionBuilder.buildOM(DescriptionBuilder.java:97) 
    at org.apache.axis2.deployment.AxisConfigBuilder.populateConfig(AxisConfigBuilder.java:90) 
    at org.apache.axis2.deployment.DeploymentEngine.populateAxisConfiguration(DeploymentEngine.java:641) 
    at com.ibm.ws.websvcs.deployment.WASAxis2ConfigurationBuilder.loadAxisCfg(WASAxis2ConfigurationBuilder.java:492) 
    at com.ibm.ws.websvcs.deployment.WASAxis2ConfigurationBuilder.loadAxisClientConfiguration(WASAxis2ConfigurationBuilder.java:191) 
    at com.ibm.ws.websvcs.client.WSClientConfigurationFactory.getConfigContext(WSClientConfigurationFactory.java:271) 
    at com.ibm.ws.websvcs.client.WSClientConfigurationFactory.getClientConfigurationContext(WSClientConfigurationFactory.java:236) 
    at org.apache.axis2.jaxws.description.impl.DescriptionFactoryImpl.createServiceDescription(DescriptionFactoryImpl.java:92) 
    at org.apache.axis2.jaxws.description.impl.DescriptionFactoryImpl.createServiceDescription(DescriptionFactoryImpl.java:79) 
    at org.apache.axis2.jaxws.description.DescriptionFactory.createServiceDescription(DescriptionFactory.java:76) 
    at org.apache.axis2.jaxws.spi.ServiceDelegate.<init>(ServiceDelegate.java:212) 
    at org.apache.axis2.jaxws.spi.Provider.createServiceDelegate(Provider.java:59) 
    at javax.xml.ws.Service.<init>(Service.java:67) 
    at my.generated.Web_Service.<init>(Web_Service.java:44) 
... 
Caused by: java.lang.ClassNotFoundException: com.sun.xml.stream.ZephyrParserFactory 
    at java.lang.Class.forNameImpl(Native Method) 
    at java.lang.Class.forName(Class.java:136) 
    at javax.xml.stream.FactoryFinder.newInstance(Unknown Source) 
    at javax.xml.stream.FactoryFinder.find(Unknown Source) 
    at javax.xml.stream.FactoryFinder.find(Unknown Source) 
    ... 101 more 

我已确认过五六次的班,罐子和舱单前和部署后是正确的。

我也尝试重命名sjsxr.jar以避免任何潜在的日食,但问题并没有消失。

我使用的是WebSphere 7.0.0.11 ND

谁能帮助?

+0

您可以发布sjsxr.jar的MyApp.jar清单条目吗? – crnlx 2010-11-30 03:13:59

+0

添加了清单编辑了问题。 – Synesso 2010-11-30 03:32:45

回答

2

从我使用java开始已经很长时间了,只是简单地触及了WebSphere,但this可能会有帮助吗?如果使用清单查找jar文件时遇到问题,请尝试将其打包到jar中的WEB-INF/lib文件夹中。如果我正确地阅读链接页面上的信息,应该隐式地找到它,而不必在清单中引用它。

您还可以在标题为“引用EAR文件中的类”标题下半页左右查看this WebSphere link

相关问题