在使用mobilefirst安装的Liberty Core 8.5(独立测试环境)中使用jaxb,Jax-ws jar文件时,我遇到了一些问题(JVM验证错误)。
但是在开发服务器中同样适用。
vax.servlet.ServletException: java.lang.VerifyError: JVMVRFY013 class loading constraint violated; class=com/sun/xml/ws/client/WSServiceDelegate, method=createDispatch(Ljavax/xml/namespace/QName;Ljavax/xml/bind/JAXBContext;Ljavax/xml/ws/Service$Mode;)Ljavax/xml/ws/Dispatch;, pc=0
at com.worklight.adapters.rest.JAXRSSandbox$2.doFilter(JAXRSSandbox.java:378)
at com.worklight.adapters.rest.JAXRSSandbox.handleRequest(JAXRSSandbox.java:383)
Caused by: java.lang.VerifyError: JVMVRFY013 class loading constraint violated; class=com/sun/xml/ws/client/WSServiceDelegate, method=createDispatch(Ljavax/xml/namespace/QName;Ljavax/xml/bind/JAXBContext;Ljavax/xml/ws/Service$Mode;)Ljavax/xml/ws/Dispatch;, pc=0
at com.worklight.adapters.rest.JAXRSAdapterRequestInterceptor.accessTheResourceWithIdentity(JAXRSAdapterRequestInterceptor.java:98)
at com.worklight.adapters.rest.JAXRSAdapterRequestInterceptor.access$000(JAXRSAdapterRequestInterceptor.java:41)
at com.worklight.adapters.rest.JAXRSAdapterRequestInterceptor$1.run(JAXRSAdapterRequestInterceptor.java:86)
at com.worklight.adapters.rest.JAXRSAdapterRequestInterceptor$1.run(JAXRSAdapterRequestInterceptor.java:83)
at com.worklight.adapters.rest.JAXRSAdapterRequestInterceptor.handleRequest(JAXRSAdapterRequestInterceptor.java:83)
[4/19/16 23:56:00:135 EDT] 000001a8 com.ibm.ws.logging.internal.impl.IncidentImpl I FFDC1015I: An FFDC Incident has been created: "javax.servlet.ServletException: java.lang.VerifyError: JVMVRFY013 class loading constraint violated; class=com/sun/xml/ws/client/WSServiceDelegate, method=createDispatch(Ljavax/xml/namespace/QName;Ljavax/xml/bind/JAXBContext;Ljavax/xml/ws/Service$Mode;)Ljavax/xml/ws/Dispatch;, pc=0 com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter 82" at ffdc_16.04.19_23.55.59.0.log
[4/19/16 23:56:00:368 EDT] 000001a8 com.ibm.ws.logging.internal.impl.IncidentImpl I FFDC1015I: An FFDC Incident has been created: "javax.servlet.ServletException: java.lang.VerifyError: JVMVRFY013 class loading constraint violated; class=com/sun/xml/ws/client/WSServiceDelegate, method=createDispatch(Ljavax/xml/namespace/QName;Ljavax/xml/bind/JAXBContext;Ljavax/xml/ws/Service$Mode;)Ljavax/xml/ws/Dispatch;, pc=0 com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter 144" at ffdc_16.04.19_23.56.00.0.log
[4/19/16 23:56:00:386 EDT] 000001a8 com.ibm.ws.logging.internal.impl.IncidentImpl I FFDC1015I: An FFDC Incident has been created: "javax.servlet.ServletException: java.lang.VerifyError: JVMVRFY013 class loading constraint violated; class=com/sun/xml/ws/client/WSServiceDelegate, method=createDispatch(Ljavax/xml/namespace/QName;Ljavax/xml/bind/JAXBContext;Ljavax/xml/ws/Service$Mode;)Ljavax/xml/ws/Dispatch;, pc=0 com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters 1064" at ffdc_16.04.19_23.56.00.1.log
[4/19/16 23:56:00:407 EDT] 000001a8 com.ibm.ws.webcontainer.webapp E SRVE0315E: An exception occurred: java.lang.Throwable: javax.servlet.ServletException: java.lang.VerifyError: JVMVRFY013 class loading constraint violated; class=com/sun/xml/ws/client/WSServiceDelegate, method=createDispatch(Ljavax/xml/namespace/QName;Ljavax/xml/bind/JAXBContext;Ljavax/xml/ws/Service$Mode;)Ljavax/xml/ws/Dispatch;, pc=0
Caused by: javax.servlet.ServletException: java.lang.VerifyError: JVMVRFY013 class loading constraint violated; class=com/sun/xml/ws/client/WSServiceDelegate, method=createDispatch(Ljavax/xml/namespace/QName;Ljavax/xml/bind/JAXBContext;Ljavax/xml/ws/Service$Mode;)Ljavax/xml/ws/Dispatch;, pc=0
at com.worklight.adapters.rest.JAXRSSandbox$2.doFilter(JAXRSSandbox.java:378)
at com.worklight.adapters.rest.JAXRSSandbox.handleRequest(JAXRSSandbox.java:383)
Caused by: java.lang.VerifyError: JVMVRFY013 class loading constraint violated; class=com/sun/xml/ws/client/WSServiceDelegate, method=createDispatch(Ljavax/xml/namespace/QName;Ljavax/xml/bind/JAXBContext;Ljavax/xml/ws/Service$Mode;)Ljavax/xml/ws/Dispatch;, pc=0
at com.worklight.adapters.rest.JAXRSAdapterRequestInterceptor.accessTheResourceWithIdentity(JAXRSAdapterRequestInterceptor.java:98)
at com.worklight.adapters.rest.JAXRSAdapterRequestInterceptor.access$000(JAXRSAdapterRequestInterceptor.java:41)
at com.worklight.adapters.rest.JAXRSAdapterRequestInterceptor$1.run(JAXRSAdapterRequestInterceptor.java:86)
at com.worklight.adapters.rest.JAXRSAdapterRequestInterceptor$1.run(JAXRSAdapterRequestInterceptor.java:83)
at com.worklight.adapters.rest.JAXRSAdapterRequestInterceptor.handleRequest(JAXRSAdapterRequestInterceptor.java:83)
javax.servlet.ServletException: java.lang.VerifyError: JVMVRFY013 class loading constraint violated; class=com/sun/xml/ws/client/WSServiceDelegate, method=createDispatch(Ljavax/xml/namespace/QName;Ljavax/xml/bind/JAXBContext;Ljavax/xml/ws/Service$Mode;)Ljavax/xml/ws/Dispatch;, pc=0
at com.worklight.adapters.rest.JAXRSSandbox$2.doFilter(JAXRSSandbox.java:378)
at com.worklight.adapters.rest.JAXRSSandbox.handleRequest(JAXRSSandbox.java:383)
Caused by: java.lang.VerifyError: JVMVRFY013 class loading constraint violated; class=com/sun/xml/ws/client/WSServiceDelegate, method=createDispatch(Ljavax/xml/namespace/QName;Ljavax/xml/bind/JAXBContext;Ljavax/xml/ws/Service$Mode;)Ljavax/xml/ws/Dispatch;, pc=0
at com.worklight.adapters.rest.JAXRSAdapterRequestInterceptor.accessTheResourceWithIdentity(JAXRSAdapterRequestInterceptor.java:98)
at com.worklight.adapters.rest.JAXRSAdapterRequestInterceptor.access$000(JAXRSAdapterRequestInterceptor.java:41)
at com.worklight.adapters.rest.JAXRSAdapterRequestInterceptor$1.run(JAXRSAdapterRequestInterceptor.java:86)
at com.worklight.adapters.rest.JAXRSAdapterRequestInterceptor$1.run(JAXRSAdapterRequestInterceptor.java:83)
at com.worklight.adapters.rest.JAXRSAdapterRequestInterceptor.handleRequest(JAXRSAdapterRequestInterceptor.java:83)
在我的server.xml中,我映射了Jar文件,也使用了delegation =" parentLast"确保首先加载Application JARS
<application id="MyProject" name="MyProject" location="MyProject.war" type="war">
<classloader delegation="parentLast">
<privateLibrary id="worklightlib_MyProject">
<fileset dir="${shared.resource.dir}/MyProject/lib" includes="worklight-jee-library.jar"/>
<fileset dir="${shared.resource.dir}/MyProject/lib" includes="management-api.jar"/>
<fileset dir="${shared.resource.dir}/MyProject/lib" includes="jaxb-api.jar"/>
<fileset dir="${shared.resource.dir}/MyProject/lib" includes="jaxb-core.jar"/>
<fileset dir="${shared.resource.dir}/MyProject/lib" includes="policy.jar"/>
<fileset dir="${shared.resource.dir}/MyProject/lib" includes="jaxws-rt.jar"/>
<fileset dir="${shared.resource.dir}/MyProject/lib" includes="stax-ex.jar"/>
<fileset dir="${shared.resource.dir}/MyProject/lib" includes="gmbal-api-only.jar"/>
<fileset dir="${shared.resource.dir}/MyProject/lib" includes="streambuffer.jar"/>
<fileset dir="${shared.resource.dir}/MyProject/lib" includes="ha-api.jar"/>
<fileset dir="${shared.resource.dir}/MyProject/lib" includes="jaxb-impl.jar"/>
<fileset dir="${wlp.install.dir}/lib" includes="com.ibm.ws.crypto.passwordutil_*.jar"/>
</privateLibrary>
</classloader>
</application>
如果我没有错,那么在应用程序战争中添加的JAR文件与自由核心默认加载的JAR相冲突。
我还尝试从Application中删除所有JAXB jar。
这实际上修复了问题,我能够调用服务但是当有异常时我开始得到以下错误。
java.lang.NoClassDefFoundError: Could not initialize class com.sun.xml.internal.ws.fault.SOAPFaultBuilder
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:107)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107)
at $Proxy36.downloadPDB(Unknown Source)
at path.to.my.code.downloadInvalidFileID(SingleMethodTest.java:64)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:338)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:997)
答案 0 :(得分:0)
最终找到解决方案。
我将配置与开发环境相匹配。唯一的区别是我没有在myProject.war / WEB-INF / lib中包含这些jar。在添加之后它解决了问题。
但是我不相信解决方案,因为我已经将这些jar放在共享位置并且也在server.xml中引用。因此不应要求使用WAR部署它。但它解决了我的问题。