解决 create JAXBContext null

服务器:jboss 4.0.4-RC1
使用xfire1.2.6开发webservice客户端,向服务端发送请求报错:
17:51:22,147 ERROR [STDERR] org.codehaus.xfire.fault.XFireFault: Could not marshall type.
17:51:22,147 ERROR [STDERR]     at org.codehaus.xfire.jaxb2.JaxbType.writeObject(JaxbType.java:266)
17:51:22,148 ERROR [STDERR]     at org.codehaus.xfire.aegis.AegisBindingProvider.writeParameter(AegisBindingProvider.java:229)
17:51:22,148 ERROR [STDERR]     at org.codehaus.xfire.service.binding.AbstractBinding.writeParameter(AbstractBinding.java:273)
........
17:51:22,153 ERROR [STDERR] Caused by: javax.xml.bind.JAXBException: Failed to create JAXBContext: null
17:51:22,153 ERROR [STDERR]     at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:123)
17:51:22,153 ERROR [STDERR]     at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:66)
17:51:22,153 ERROR [STDERR]     at org.codehaus.xfire.jaxb2.JaxbType.getJAXBContext(JaxbType.java:306)
17:51:22,153 ERROR [STDERR]     at org.codehaus.xfire.jaxb2.JaxbType.writeObject(JaxbType.java:230)
17:51:22,153 ERROR [STDERR]     ... 74 more
17:51:22,153 ERROR [STDERR] Caused by: javax.xml.bind.JAXBException: Cannot load resource: 
..........jaxb.properties
17:51:22,153 ERROR [STDERR]     at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:97)

 主要由于在jboss 4.0.4-RC1/server/default/lib中存在包jboss-j2ee.jar中包含了javax.xml.bind.JAXBContext这个类和xfire核心包jaxb-api-2.0.jar也包含了javax.xml.bind.JAXBContext发生冲突.

 

需将附件包jboss-j2ee.jar替换jboss 4.0.4-RC1/server/default/lib自带jboss-j2ee.jar包

附:

在windows 环境下不会出现这种情况,而在LINUX环境出现




你可能感兴趣的:(java,xml,linux,jboss,webservice)