Apache Axiom runtine jars not being set
Please
I need to work with the libs from apache axiom project in a maven project (jar packing):
https://ws.apache.org/axiom/quickstart-samples.html
I've added the jars in pom.xml as follows:
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-api</artifactId>
<version>1.2.22</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-impl</artifactId>
<version>1.2.22</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-dom</artifactId>
<version>1.2.22</version>
<scope>runtime</scope>
</dependency>
My project iml has:
<orderEntry type="library" name="Maven: org.apache.ws.commons.axiom:axiom-api:1.2.22" level="project" />
.....
<orderEntry type="library" scope="RUNTIME" name="Maven: org.apache.ws.commons.axiom:axiom-impl:1.2.22" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.apache.ws.commons.axiom:axiom-dom:1.2.22" level="project" />
I'm trying to unit test my code using axiom in my project and get the following error:
java.lang.NoClassDefFoundError: org/apache/axiom/soap/impl/dom/SOAPFaultNodeImpl
...
at org.apache.axis2.saaj.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:109)
...
Caused by: java.lang.ClassNotFoundException: org.apache.axiom.soap.impl.dom.SOAPFaultNodeImpl
My other unit tests(not using axion) are running fine.
I have download axiom from the project site and created in IntelliJ a lib in the project named "lib-axiom" pointing to the extracted dir containing all the jars from the framework($AXIOM_DIR/lib).
After that I have created 3 modules for my project:
1. lib-axiom-test (with test scope)
2. lib-axiom-compile (with compile scope)
3. lib-axiom-runtime (with runtime scope)
all using the same IntelliJ project lib ("lib-axiom") in "Dependencies". None of them is working. I mean, I still face the class loading missing to run my test.
I rebuilt the project after each setting. Shouldn't the 3 modules to be shown in the project iml file after the rebuild?
Also I have tried the following maven plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<additionalClasspathElements>
<additionalClasspathElement>$AXIOM_DIR/lib/axiom-dom-1.2.22.jar</additionalClasspathElement>
<additionalClasspathElement>$AXIOM_DIR/lib/axiom-impl-1.2.22.jar</additionalClasspathElement>
</additionalClasspathElements>
</configuration>
</plugin>
Please what is wrong ? How can I can set the axiom jars in the project classpath so that I can run my tests ?
Thks!!
Please sign in to leave a comment.
Are you sure the axiom-impl and axiom-dom libraries need to have runtime scope? Does it help to check it to compile?
Check if IDE navigates you to SOAPFaultNodeImpl class using Navigate | Class action. If the class is found - check in which jar library it is located. Then make sure this jar is included into the module's dependencies of the module specified in JUnit Run/Debug configuration for the Using classpath of module.
Hello
Thks for the reply. The project iml file had records of different libs (from the past) rather than the ones I needed. I just found out hours after I sent the post.
There were other developers working on it before me and they used a different dependency that also includes axiom.
It is ok now.
According to the axiom docs, dom and impl libs must set as be runtime in pom.xml. I will need to copy the jars to my server when I publish my app.
Best Regards.