1

I have developed a maven-based project (maven-3.3.9) using jboss-eap-6.4 in IntelliJIDEA 14.0. I am using bouncy castle libraries and I have to set them as provided scope in maven dependency.

  1. Where exactly should I put the bouncy castle jar files?
  2. What configuration should I set?

I have tried two options for the 1st question as follows:

  • I put jar files here: jboss-eap-6.4\modules\org\bouncycastle\main\

and

  • I put jar files here: jboss-eap-6.4\modules\system\layers\base\org\bouncycastle\main\

Also, I have provided the following configuration in module.xml beside the jar files:

<?xml version=1.0" encoding=UTF-8"?>

<module xmlns="run:jboss:module:1.1" name="org.bouncycastle">
    <resources>
        <resource-root path="bcpkix-jdk15on-1.54.jar"/>
        <resource-root path="bcprov-jdk15on-1.54.jar"/>
    </resources>

    <dependencies>
        <module name="javax.api" slot="main" export="true"/>
    </dependencies>
</module>

However, when I clean and install maven I get the following error:

  • error during artifact deploment
  • caused by java.lang.RunTimeException:...
  • caused by java.lang.NoClassDefFoundError:...
  • caused by java.lang.ClassNotFoundException:...
Hosein Aqajani
  • 1,553
  • 4
  • 26
  • 46

1 Answers1

0

The errors you mentioned are deployment errors those are not related to maven.

To add a JBoss module to your application create a file named WEB-INF\jboss-deployment-structure.xml and add the module in dependency. In your case the file content should be as follows.

<jboss-deployment-structure>
    <deployment>
        <dependencies>
            <module name="org.bouncycastle"/>
        </dependencies>
    </deployment>
</jboss-deployment-structure>

While deployment, the jboss will load the module in to classpath.

user1438038
  • 5,821
  • 6
  • 60
  • 94
seenukarthi
  • 8,241
  • 10
  • 47
  • 68
  • I have not WEB-INF in my src, I have it only in my target. When I add this xml in WEB-INF I get the following error: java.lang.UnsatisfiedLinkError: Native Library already loaded in another class loader. – Hosein Aqajani May 23 '16 at 05:57
  • it should be in `src\main\webapp` folder – seenukarthi May 23 '16 at 05:57
  • I have not `WEB-INF` folder in `src\main\webapp` – Hosein Aqajani May 23 '16 at 06:09
  • I created and put the xml file in it. However, I get `java.lang.UnsatisfiedLinkError: Native Library already loaded in another class loader` – Hosein Aqajani May 23 '16 at 06:13
  • I should told you that I have a local native dll which I load it in a static block as follows: `System.load("myAdr\\myDllName.dll);` When I don't use the provided scope I have not any problem with loading this native library – Hosein Aqajani May 23 '16 at 06:17
  • This is different issue check [this](http://stackoverflow.com/questions/1030792/dll-already-loaded-in-another-classloader) – seenukarthi May 23 '16 at 09:57