I can't get org.apache.httpcomponents to work in Wildfly 10. I didn't try 9. The error I get is, basically.
Caused by: java.lang.ClassNotFoundException: org.apache.http.client.methods.HttpUriRequest from [Module "deployment.opca-ear.ear.opca-ejb.jar:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
... 185 more
I looked at Wildfly 8.1 ClassNotFound org.apache.http.conn.ClientConnectionManager, but jboss-deployment-structure.xml
described there is not working here.
I tried various combinations of things in the POM file, but I'm not getting anywhere with that.
The class fails when being constructed, so the import statements are causing problems.
I haven't been able to get access to the module or get the needed jar files to be deployed into the ear lib directory.
EDIT: I'm using JBoss Developer Studio. I seem to be making some progress in that if I copy my opca-ear.ear file to the deployment directory manually then the httpclient and httpcore jars get deployed, but they don't if I deploy from jbstudio, so I guess it's an issue with jboss-modules.jar
deployments. Not being able to debug/deploy from jbstudio is going to be a pain. Httpclient and httpcore are in my opca-ear.ear file in the lib directory, as well as the ejb/target/opca-ear/lib directory.
If I could get something like jboss-deployment-structure.xml
or perhaps an entry in the a manifest file working so that wildfly provides the client access to the org.apache.httpcomponents resources then I wouldn't have to worry about jboss-modules.jar
.
SOLUTION: As noted in the accepted answer, jboss-deployment-structure.xml
only works on "full" deployments, so I used a manifest.mf entry
Dependencies: org.apache.httpcomponents
and updated the maven-ejb-plugin to use it:
<artifactId>maven-ejb-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<!-- Tell Maven we are using EJB 3.1 -->
<ejbVersion>3.1</ejbVersion>
<archive>
<manifestFile>${basedir}/src/main/resources/META-INF/manifest.mf</manifestFile>
</archive>
</configuration>