I am migration Java Web Application from jboss 6.0 to wildfly 11. I am getting
"java.lang.ClassCastException: __redirected.__XMLInputFactory cannot be cast to org.codehaus.stax2.XMLInputFactory2" while running the code on wildfly 11.0.0.Final. Junit tests are working without error.
Looks like there is some dependency issue in wildfly but unable to find any solution. Appreciate any help to resolve this issue.. I have included following woodstox dependencies in pom.
woodstox-core-asl 4.4.1 stax2-api 3.1.4
Thanks Sanjay
答案 0 :(得分:1)
这是由类路径中的重复类引起的。
Wildfly将stax2-api作为woodstocks模块的一部分,参见wildfly dist文件夹中的modules / system / layers / base / org / codehaus / woodstox / main /。
如果你的应用程序的lib文件夹中也有它,这将导致问题。
解决方案是在pom.xml中将依赖项设置为<scope>provided</scope>
(或构建),或者如果您确实需要特殊版本,请通过jboss-deployment-structure.xml排除wildfly的模块
有关Wildfly中的类加载的详细信息,请参阅https://docs.jboss.org/author/display/WFLY10/Class+Loading+in+WildFly。