11 Replies Latest reply: Oct 18, 2012 12:19 PM by François Hertay RSS

    Path setting for DLL's in JBOSS 7.1.1

    Srinivas Reddy Bijjam Newbie

      Hi All

       

        We have some DLL's which are related to Java,VB. In Joss 4.X , We used to place in bin directory under Application Server.

       

        We migrated to JBOSS 7.1.1 and when I removed from bin directory and placed them in libraries folder  under C:\jboss-as-7.1.1.Final\modules\com\correction\main\libraries .

       

        I am getting this exception

       

      java.lang.UnsatisfiedLinkError: no xxxJavaWrapper in java.library.path

      java.library.path = C:\Program Files\Java\jdk1.6.0_24\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\apache-maven-3.0.4;C:\apache-maven-3.0.4\bin;C:\Python27;C:\Program Files\Java\jdk1.6.0_24;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem

      java.lang.UnsatisfiedLinkError: com.xxxJavaWrapperJNI.new_xxx()J

       

      module.xml

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

      <module xmlns="urn:jboss:module:1.0" name="com.correction">

      <resources>

              <resource-root path="xxx.jar"/>

              <resource-root path="xyz.jar"/>

               <resource-root path="libraries"/>

          </resources>

            <dependencies>

                <system export="true">

                    <paths>

                        <path name="libraries"/>

                    </paths>

                    <exports>

                        <include-set>

                            <path name="libraries"/>

                        </include-set>

                    </exports>

                </system>

           </dependencies>

       

       

      </module>

       

        But I place the same dll's in bin folder, it is working fine.

         I want to place them in module folder and set the path from there instead of bin so that I can have all the application related jar's, properties and dll files at one place for ease maintainance.

       

        Also I want to know how to set the path of txt and properties files in jboss 7.1.1

       

      Regards

      Srini

        • 1. Re: Path setting for DLL's in JBOSS 7.1.1
          guinotphil Apprentice

          It seems you can easily add native libraries within any module if you follow this schema:

           

           

          In module.xml add the line

                  <resource-root path="lib"/>

           

          (well, I think libraries may work as well, but lib is more standard)

           

          And create this lib directory. Inside it, don't just put the libraries, but subdirectories:

           

          win-i686 : win 32 dll

          win-x86_64 : win 64 dll

          linux-i686 : linux 32 library

          linux-x86_64 : linux 64

          macosx-i686 : etc..

          macosx-x86_64 ...

           

           

          By the way, a question for the JBoss AS Team, the org.jboss.as.web comes with a lib directory with the JBoss Web native libraries. But I can't find the  <resource-root path="lib"/> line within the module.xml. Why ?

           

          Regards,

           

          Philippe

          • 2. Re: Path setting for DLL's in JBOSS 7.1.1
            Tomaz Cerar Master

            Hi,

             

            lib is a special folder name and it is automatically recognized.

             

            read more about this here https://docs.jboss.org/author/display/MODULES/Native+Libraries

             

             

            --

            tomaz

            • 3. Re: Path setting for DLL's in JBOSS 7.1.1
              guinotphil Apprentice

              Thank you for the link, it's more comprehensive than what I said...

               

              I was actually confused because the org.hornetq package has the line

              <resource-root path="lib"/>

               

              Is there a specific reason for it ? Anyway, I have to consider the deletion of these lines from my own packages.

               


              • 4. Re: Path setting for DLL's in JBOSS 7.1.1
                Srinivas Reddy Bijjam Newbie

                I placed my java related wrapper dll's under folder lib in one of the module and in module.xml  I mentioned as <resource-root path="lib"/> but still I am exception

                 

                java.lang.UnsatisfiedLinkError: no xxxJavaWrapper in java.library.path

                java.library.path = C:\Program Files\Java\jdk1.6.0_24\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\apache-maven-3.0.4;C:\apache-maven-3.0.4\bin;C:\Python27;C:\Program Files\Java\jdk1.6.0_24;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem

                java.lang.UnsatisfiedLinkError: com.xxxJavaWrapperJNI.new_xxx()J

                 

                If I keep the same wrapper dlls in bin folder , I am not getting any exception.

                • 5. Re: Path setting for DLL's in JBOSS 7.1.1
                  guinotphil Apprentice

                  Have you put the DLL inside a win-i686 folder ?

                  • 6. Re: Path setting for DLL's in JBOSS 7.1.1
                    Srinivas Reddy Bijjam Newbie

                    If I keep the DLL based on 32 or 64 bit, then JBOSS will stick to the particular bit and there wont be portable.

                    We want JBOSS independent and common for both 32 and 64 bit

                    • 7. Re: Path setting for DLL's in JBOSS 7.1.1
                      François Hertay Newbie

                      You can put the 32bit DLL in the win-i686 folder and the 64bit one in the win-x86_64 folder

                       

                      DLL is by definition architecture dependant, the 32 DLL won't work with the 64bit JVM as the oposit.

                       

                      If you have native lib you will need to provide a lib for each os-arch you want to support.

                      • 8. Re: Path setting for DLL's in JBOSS 7.1.1
                        Srinivas Reddy Bijjam Newbie

                        Thanks to Philippe now dll's are getting recognised and that exception is solved

                         

                        But I am getting new exception

                         

                        java.lang.UnsatisfiedLinkError: C:\Application Server\modules\com\correctionDll\main\lib\win-i686\testJavaWrapper.dll: Can't find dependent libraries

                        java.library.path = C:\Program Files\Java\jdk1.6.0_24\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\apache-maven-3.0.4;C:\apache-maven-3.0.4\bin;C:\Python27;C:\Program Files\Java\jdk1.6.0_24;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem

                          java.lang.UnsatisfiedLinkError: com.test.testJavaWrapperJNI.new_test()J

                         

                        It is not able to take the jars which I set in the resource path

                         

                        Here are my files and module.xml

                        I have created the following directory structure under the modules directory.

                         

                        com\testDll\main

                          |- module.xml

                          |- test.jar

                          | - lib

                               |- win-i686

                                     |- testJavaWrapper.dll

                         

                        module.xml

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

                        <module xmlns="urn:jboss:module:1.1" name="com.testDll">

                        <resources>

                                <resource-root path="lib"/>

                                <resource-root path="test.jar"/>

                            </resources>

                        </module>

                         

                        jboss-deployment-structure.xml


                        <jboss-deployment-structure>

                        <ear-subdeployments-isolated>false</ear-subdeployments-isolated>

                        <deployment>

                                <dependencies>

                                            <module name="javaee.api" export="true"/>

                                            <module name="sun.jdk" export="true"/>

                                            <module name="com.lib" export="true"/>

                                             <module name="com.correctionDll" services="import" export="true"/>

                                </dependencies>

                           </deployment>  

                          </jboss-deployment-structure>

                         

                         

                        Iam using "JBoss AS 7.2.0.Alpha1-SNAPSHOT" version

                         

                        Regards

                        Srini

                        • 9. Re: Path setting for DLL's in JBOSS 7.1.1
                          François Hertay Newbie

                          The libraties you use in our dll should also be present in the lib directory.

                          • 10. Re: Path setting for DLL's in JBOSS 7.1.1
                            Srinivas Reddy Bijjam Newbie

                            Dear Francois

                                 If I keep jars in the win-i686 folder then how to give resource-root path in module.xml as I am getting exception in recognizing the jars?

                             

                            Regards

                            Srini

                            • 11. Re: Path setting for DLL's in JBOSS 7.1.1
                              François Hertay Newbie

                              The java.lang.UnsatisfiedLinkError is due to issue when loading the native part, so no jar loading issue. 

                               

                              I am not a jni specilist but I think if it can't find the depedency lib of the dll it is probalby the native library used by our dll.  The fact that java.library.path is the property used to shearch the libs is another indication that it can't find some native element (otherwise the classpath will be displayed).