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

相關問題