java WebSphere ClassNotFoundException在启动后调用WebService时(但不在以后)
更新:只有在启动应用程序后立即尝试使用web服务时才会发生ClassNotFoundException
。如果我等待(某个未知事件/持续时间),应用程序将工作。我想知道我需要等待什么
问题:我的应用程序失败,因为类加载器找不到确实存在的类
更多信息:
找不到的类是com.sun.xml.stream.ZephyrParserFactory
在我的耳朵里有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
在部署之前和之后,我已经多次确认类、jar和清单是正确的
我还尝试重新命名sjsxr.jar
,以避免任何潜在的日食,但问题并没有消失
我正在使用WebSphere7.0.0.11ND
有人能帮忙吗
# 1 楼答案
我已经很久没有使用java了,只是简单地接触了WebSphere,但也许this会有所帮助?如果使用清单查找jar文件时遇到问题,请尝试将其打包到jar中的
WEB-INF/lib
文件夹中。假设我正确阅读了链接页面上的信息,那么应该隐式地找到它,而不必在清单中引用它您可能还想看看this WebSphere link,大约在页面的一半,标题是“引用EAR文件中的类”