使用maven在grails中运行测试用例时加载器约束违规

时间:2012-09-05 09:34:20

标签: web-services grails maven testcase

我正在使用maven运行grails中的测试用例并获得以下堆栈跟踪。

我有以下冲突。

loader constraint violation: when resolving field "DATETIME" the class loader (instance of org/codehaus/groovy/grails/cli/support/GrailsRootLoader) of the referring class, javax/xml/datatype/DatatypeConstants, and the class loader (instance of <bootloader>) for the field's resolved type, javax/xml/namespace/QName, have different Class objects for that type

java.lang.LinkageError: loader constraint violation: when resolving field "DATETIME" the class loader (instance of org/codehaus/groovy/grails/cli/support/GrailsRootLoader) of the referring class, javax/xml/datatype/DatatypeConstants, and the class loader (instance of <bootloader>) for the field's resolved type, javax/xml/namespace/QName, have different Class objects for that type
    at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl.<clinit>(RuntimeBuiltinLeafInfoImpl.java:224)
    at com.sun.xml.bind.v2.model.impl.RuntimeTypeInfoSetImpl.<init>(RuntimeTypeInfoSetImpl.java:61)
    at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.createTypeInfoSet(RuntimeModelBuilder.java:127)
    at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.createTypeInfoSet(RuntimeModelBuilder.java:79)
    at com.sun.xml.bind.v2.model.impl.ModelBuilder.<init>(ModelBuilder.java:152)
    at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.<init>(RuntimeModelBuilder.java:87)
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:422)
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:286)
    at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:139)
    at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:117)
    at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:211)
    at javax.xml.bind.ContextFinder.find(ContextFinder.java:372)
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)
    at com.sun.xml.ws.spi.ProviderImpl$2.run(ProviderImpl.java:220)
    at com.sun.xml.ws.spi.ProviderImpl$2.run(ProviderImpl.java:218)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.xml.ws.spi.ProviderImpl.getEPRJaxbContext(ProviderImpl.java:217)
    at com.sun.xml.ws.spi.ProviderImpl.<clinit>(ProviderImpl.java:88)
    at java.lang.Class.newInstance0(Class.java:355)
    at java.lang.Class.newInstance(Class.java:308)
    at javax.xml.ws.spi.FactoryFinder.newInstance(FactoryFinder.java:36)
    at javax.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:95)
    at javax.xml.ws.spi.Provider.provider(Provider.java:82)
    at javax.xml.ws.Service.<init>(Service.java:56)
    at javax.xml.ws.Service.create(Service.java:698)
    at com.j2.api.fax.myaccount.client.MyaccountClient$1.makeObject(MyaccountClient.java:28)
    at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1148)
    at com.j2.api.fax.myaccount.client.MyaccountClient.authenticateByPhoneNumber(MyaccountClient.java:66)
    at com.j2.api.fax.myaccount.client.MyaccountClient$authenticateByPhoneNumber.call(Unknown Source)
    at com.j2.helpers.LoginHelper.authenticateCustomerByPhoneNumber(LoginHelper.groovy:86)
    at com.j2.helpers.LoginHelper$authenticateCustomerByPhoneNumber.call(Unknown Source)
    at com.j2.spa.MobileService.login(MobileService.groovy:508)
    at com.j2.spa.MobileService$login.call(Unknown Source)
    at com.j2.spa.MobileController$_closure7.doCall(MobileController.groovy:109)
    at com.j2.spa.MobileController$_closure7.call(MobileController.groovy)
    at MobileControllerTests.testLogin_Failure_UsernameNotFound(MobileControllerTests.groovy:42)

我已经尝试了很多,但无法解决它。

任何帮助都非常适合.. 感谢

1 个答案:

答案 0 :(得分:0)

我遇到类似的问题,解决方法是排除stax-api模块。我正在使用Gradle进行以下配置:

configurations {
compile.exclude module: 'stax-api'}

如果你正在使用maven,我认为它是相似的。希望它有所帮助。