-1

我必须在我的webapp(Spring 3)中使用xerces(xsd v1.1)验证xml,需要部署在jboss 6服务器中。但是我在部署中遇到错误。这在 Tomcat 中不会发生。它抛出以下异常:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#0': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter]: Constructor threw exception; nested exception is java.lang.ClassCastException: org.apache.xalan.processor.TransformerFactoryImpl cannot be cast to javax.xml.transform.TransformerFactory

我尝试使用 jboss-web.xml 和 jboss-classloading.xml 进行一些配置,但我没有工作。有什么想法?

4

1 回答 1

0

JBoss 类加载器可能会令人沮丧(我们为安全付出的代价!)但这应该会有所帮助... 将 1.1 xerves 库放在文件系统的某个位置,然后在启动 JBoss 时添加以下 JVM 参数:

-Djava.endorsed.dirs=/PATH/TO/LIBRARIES
-Djavax.xml.stream.XMLInputFactory=com.sun.xml.internal.stream.XMLInputFactoryImpl
-Djavax.xml.stream.XMLOutputFactory=com.sun.xml.internal.stream.XMLOutputFactoryImpl
-Djavax.xml.stream.XMLEventFactory=com.sun.xml.internal.stream.events.XMLEventFactoryImpl
于 2016-05-03T16:37:53.070 回答