0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[*WildFly*] org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory 対策

Posted at

はじめに

環境は以下。

  • WildFly: 12.0.0.Final
  • Java: 1.8.0_161
  • NetBeans: 8.2
  • CentOS: 7

発生したエラー

特に明示的にライブラリでdom4jというものは使ってないが内部の何かが使っているのか、
WildFlyにデプロイしようとすると以下のエラーが発生する。

"java.lang.ClassCastException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory 
Caused by: java.lang.ClassCastException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory"

対応

$ cd wildfly-12.0.0.Final/modules/system/layers/base/org/dom4j/main/
$ ls
# dom4j-1.6.1.jar  module.xml
$ sudo wget http://central.maven.org/maven2/org/dom4j/dom4j/2.1.0/dom4j-2.1.0.jar
$ sudo vim module.xml 
<module name="org.dom4j" xmlns="urn:jboss:module:1.5">
  <resources>
    <resource-root path="dom4j-2.1.0.jar"/> <!-- ここのバージョンを上げる -->
  </resources>

  <dependencies>
      <module name="javax.api"/>
      <module name="com.sun.xml.bind"/>
      <module name="javax.xml.bind.api"/>
      <module name="org.jaxen"/>
  </dependencies>
</module>
$ sudo systemctl restart wildfly
# 再起動後デプロイできた

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?