Dom4J problems on jboss 7 with maven
haukegulich May 11, 2013 3:14 PMDear users,
I am kind of frustrated because I just want to deploy my maven project on jboss 7. In my application I am using
Dom4J for parsing a xml file.
If I am executing that method by itsself within eclipse, it is working. If I am deploying this application if gives me an
{color:red}
19:49:42,239 ERROR [stderr | ] | Exception in thread "Timer-2" java.lang.NoClassDefFoundError: org/dom4j/DocumentException |
19:49:42,239 ERROR [stderr | ] | at de.hauke.hausautomation.webservice.homematic.Homematic$1.run(Homematic.java:54) |
19:49:42,240 ERROR [stderr | ] | at java.util.TimerThread.mainLoop(Timer.java:555) |
19:49:42,241 ERROR [stderr | ] | at java.util.TimerThread.run(Timer.java:505) |
19:49:42,242 ERROR [stderr | ] | Caused by: java.lang.ClassNotFoundException: org.dom4j.DocumentException from [Module "deployment.ear-1.0.0.ear.server.jar:main" from Service Module Loader] |
19:49:42,245 ERROR [stderr | ] | at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) |
19:49:42,246 ERROR [stderr | ] | at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) |
19:49:42,247 ERROR [stderr | ] | at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) |
19:49:42,247 ERROR [stderr | ] | at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) |
19:49:42,248 ERROR [stderr | ] | at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) |
19:49:42,249 ERROR [stderr | ] | ... 3 more |
{color}
I am using maven and my pom.xml looks like this:
{code:xml}
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.hauke.hausautomation.webservice.homematic</groupId>
<artifactId>server</artifactId>
<version>3.0.0</version>
<packaging>ejb</packaging>
<name>server</name>
<parent>
<groupId>de.hauke.hausautomation.webservice.homematic</groupId>
<artifactId>main</artifactId>
<version>1.0.0</version>
<relativePath>../main</relativePath>
</parent>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2/
</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-web-6.0</artifactId>
<version>2.0.0.Final</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>de.hauke.hausautomation.webservice</groupId>
<artifactId>client</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.ftpserver</groupId>
<artifactId>ftpserver-core</artifactId>
<version>1.0.6</version>
</dependency>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
</dependency>
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.2.6.ga</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.3.2.GA</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>3.3.2.GA</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.ws</groupId>
<artifactId>jbossws-spi</artifactId>
<version>1.1.2.SP1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>server</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.3</version>
<configuration>
<ejbVersion>3.0</ejbVersion>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
</plugin>
</plugins>
</build>
</project>
{code}
I set up dom4j as provided because if I remove to scope line at dom4j, jboss can not parse my hibernate.cfg.xml file anymore. I read something about
that issue and it seems to occure if there are version conflicts between dom4j.
I also checked in eclipse via "effective pom" if dom4j will be included from another dependency.
I also tried to upload the dom4j.jar at the jboss administrative panel and activate that deployment, but with the same result.
Does anyone has an idee? Do you need more informations?
Thanks,
Hauke