我正在部署一个网络服务(使用METRO 2.0
库,并将其包含在war
文件中tomcat
启用security manager
-Djava.security.manager
-Djava.security.policy=C:\apache-tomcat-8.5.6\conf\catalina.policy
我收到以下异常
SEVERE [localhost-startStop-1]
com.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized
WSSERVLET11: failed to parse runtime descriptor: java.lang.LinkageError: loader
constraint violation: loader (instance of
org/apache/catalina/loader/ParallelWebappClassLoader) previously initiated loading for a
different type with name "javax/xml/bind/annotation/XmlNsForm"
java.lang.LinkageError: loader constraint violation: loader (instance of
org/apache/catalina/loader/ParallelWebappClassLoader) previously initiated loading for a
different type with name "javax/xml/bind/annotation/XmlNsForm"
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal
(WebappClassLoaderBase.java:2268)
at org.apache.catalina.loader.WebappClassLoaderBase
$PrivilegedFindClassByName.run(WebappClassLoaderBase.java:155)
at org.apache.catalina.loader.WebappClassLoaderBase
$PrivilegedFindClassByName.run(WebappClassLoaderBase.java:144)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.loader.WebappClassLoaderBase.findClass
(WebappClassLoaderBase.java:809)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass
(WebappClassLoaderBase.java:1254)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass
(WebappClassLoaderBase.java:1119)
at com.sun.xml.bind.v2.model.impl.PropertyInfoImpl$1.<clinit>
(PropertyInfoImpl.java:365)
at com.sun.xml.bind.v2.model.impl.PropertyInfoImpl.calcXmlName
(PropertyInfoImpl.java:365)
at com.sun.xml.bind.v2.model.impl.PropertyInfoImpl.calcXmlName
(PropertyInfoImpl.java:340)
at com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl.getTypes
(ElementPropertyInfoImpl.java:136)
at com.sun.xml.bind.v2.model.impl.RuntimeElementPropertyInfoImpl.getTypes
(RuntimeElementPropertyInfoImpl.java:86)
at com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl$1.size
(ElementPropertyInfoImpl.java:78)
at java.util.AbstractList$Itr.hasNext(AbstractList.java:351)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo
(ModelBuilder.java:255)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo
(RuntimeModelBuilder.java:100)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo
(RuntimeModelBuilder.java:81)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo
(ModelBuilder.java:209)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo
(RuntimeModelBuilder.java:95)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo
(RuntimeModelBuilder.java:81)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo
(ModelBuilder.java:315)
at com.sun.xml.bind.v2.model.impl.TypeRefImpl.calcRef(TypeRefImpl.java:92)
at com.sun.xml.bind.v2.model.impl.TypeRefImpl.getTarget(TypeRefImpl.java:69)
at com.sun.xml.bind.v2.model.impl.RuntimeTypeRefImpl.getTarget
(RuntimeTypeRefImpl.java:58)
at com.sun.xml.bind.v2.model.impl.RuntimeTypeRefImpl.getTarget
(RuntimeTypeRefImpl.java:51)
at com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl$1.get
(ElementPropertyInfoImpl.java:74)
at com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl$1.get
(ElementPropertyInfoImpl.java:77)
at java.util.AbstractList$Itr.next(AbstractList.java:358)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo
(ModelBuilder.java:255)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo
(RuntimeModelBuilder.java:100)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo
(RuntimeModelBuilder.java:81)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo
(ModelBuilder.java:209)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo
(RuntimeModelBuilder.java:95)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo
(RuntimeModelBuilder.java:81)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo
(ModelBuilder.java:315)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo
(ModelBuilder.java:330)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet
(JAXBContextImpl.java:466)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:302)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build
(JAXBContextImpl.java:1140)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:154)
at com.sun.xml.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:106)
at com.sun.xml.ws.developer.JAXBContextFactory$1.createJAXBContext
(JAXBContextFactory.java:109)
at com.sun.xml.ws.model.AbstractSEIModelImpl$1.run
(AbstractSEIModelImpl.java:161)
at com.sun.xml.ws.model.AbstractSEIModelImpl$1.run
(AbstractSEIModelImpl.java:154)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext
(AbstractSEIModelImpl.java:153)
at com.sun.xml.ws.model.AbstractSEIModelImpl.postProcess
(AbstractSEIModelImpl.java:94)
at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel
(RuntimeModeler.java:258)
at com.sun.xml.ws.server.EndpointFactory.createSEIModel
(EndpointFactory.java:338)
at com.sun.xml.ws.server.EndpointFactory.createEndpoint
(EndpointFactory.java:201)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:505)
at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parseAdapters
(DeploymentDescriptorParser.java:253)
at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parse
(DeploymentDescriptorParser.java:147)
at
com.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized
(WSServletContextListener.java:124)
at org.apache.catalina.core.StandardContext.listenerStart
(StandardContext.java:4727)
at org.apache.catalina.core.StandardContext.startInternal
(StandardContext.java:5189)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal
(ContainerBase.java:724)
at org.apache.catalina.core.ContainerBase.access$000(ContainerBase.java:129)
at org.apache.catalina.core.ContainerBase$PrivilegedAddChild.run
(ContainerBase.java:150)
at org.apache.catalina.core.ContainerBase$PrivilegedAddChild.run
(ContainerBase.java:140)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:698)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:596)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run
(HostConfig.java:1805)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker
(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run
(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
另一方面,没有security manager
- 一切都很好。
经过一番搜索后,我开始明白问题是javax/xml/bind/annotation/XmlNsForm
库和tomcat
都找到了METRO 2.0
。
所以我有两个问题:
1. catalina.policy
中有某种属性可以设置为避免此问题。
2.如果没有从Metro 2.0
移除war
,还有其他方法可以解决此冲突。
提前致谢。
答案 0 :(得分:0)
所以解决方案不是使用整个Metro 2.0
捆绑包 - 只有捆绑的一些库(jars
添加而不是netbeans
内的整个捆绑包)