-
1. Re: Wildfly Native Libraries
ctomc May 6, 2015 12:45 PM (in response to ldevrie)how and from which code are you loading native library?
is that code part of the same module?
-
2. Re: Wildfly Native Libraries
ldevrie May 6, 2015 1:57 PM (in response to ctomc)Yes, the code that uses the native library is part of the same module. For example, using from my original question, the classes in myjar1.jar are doing JNI calls to the native module in the underlying lib/linux_x86_64 directory.
So, the directory structure looks like this:
myjar1.jar
|
----lib
|
----linux-x86_64
|
------ libNativeCode.so
The classes in myjar1.jar are doing the JNI calls to libNativeCode.so
However, right now the only way I can get this to work is to export the LD_LIBRARY_PATH to the libNativeCode.so. From what I read, this is not supposed to be necessary.
-
3. Re: Wildfly Native Libraries
dmlloyd May 6, 2015 3:51 PM (in response to ldevrie)I suspect the problem might be that you have added an explicit "<resource-root path="lib"/>" to your module definition. This is not necessary and could possibly be confusing the resource loader somehow.
-
4. Re: Wildfly Native Libraries
ldevrie May 6, 2015 4:23 PM (in response to dmlloyd)I have tried about every combination of parms in the module.xml that I could find, all to no avail. I tried the resource without a lib reference at all, I tried with just a period, with nothing in the dependencies. I can't seem to get anything to work.
Is it possible that there is some kind of naming convention that must be adhered to for it to work ? What I mean is if the jar is named myjar1.jar, does the native library have to be named libmyjar1.so ??? I sure hope this is not the case because we have one jar and two .so's.
Any recommendation are appreciated. Thanks.
-
5. Re: Wildfly Native Libraries
ctomc May 6, 2015 4:49 PM (in response to ldevrie)try enabling trace logging for "org.jboss.modules" category
it will help you debug this.
-
6. Re: Wildfly Native Libraries
dmlloyd May 6, 2015 9:19 PM (in response to ldevrie)No, there is no special naming convention. At this point random combinations are probably not useful though; some methodical troubleshooting is required. The first thing is to be certain that it is the code in the module which is calling System.loadLibrary() or System.load(), as these methods are sensitive to the class loader of the calling class. Secondly, the only resource roots you need in the descriptor are the two JARs; adding in "." or "lib" may be actively preventative in terms of getting the library to load. So this should be our troubleshooting baseline.
Native library name mapping and loading is not part of the trace logging, so this will not be a useful thing to do. One possibility is to use the Linux strace utility to identify exact path names being opened. The last point I want to emphasize is that paths are case-sensitive, and that you should double-check that you are indeed running on a 64-bit JVM.
-
7. Re: Wildfly Native Libraries
kyatham Jul 4, 2018 2:15 AM (in response to ldevrie)Hi,
Native libraries are not loading in my case . I tried all the possible ways but its not loading the jar. Below are the details:
Hi, Below are the requested details:
[root@hostname rsa]# pwd
/opt/wildfly/modules/com/xx/iam/rsa
[root@hostname rsa]# tree .
.
└── main
├── lib
│ └── linux-x86_64
│ └── librsacookieapi.so
├── module.xml
└── RSACookieAPI.jar
3 directories, 4 files
[root@hostname rsa]#
moudle.xml
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.xx.iam.rsa">
<resources>
<resource-root path="lib"/>
<resource-root path="RSACookieAPI.jar" />
</resources>
<dependencies>
</dependencies>
</module>
jboss-deployment-structure.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="com.xx.iam.rsa" export="true" />
</dependencies>
</deployment>
</sub-deployment>
</jboss-deployment-structure>
[root@hostname rsa]# java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
[root@hostname rsa]#
And i changed LD_library_path to linux-x86_64 folder. Please let me know if iam missing anything.