How can I load a JNI dll on a Tomcat server ????

Hi everybody,

I hope someone know how I can fix my probleme ! So, I develop an application Client/Server with a tomcat server an a mySQL Database using java.

In the server I need to load a JNI dll using System.loadlibrary("JNIxxx"). It is well working on the standalone application but when I try to execute the same code through an applet I get this error message :

"java.security.AccessControlException: access denied (java.lang.RuntimePermission loadLibrary.JNIxxx)"

So, my question is How can I pass without through the AccessControl ? How can I add a Permission to load the dll ??

Thanks for the help,

François.

static {
    System.loadLibrary("JNIxxx");
}

Open in new window

Francois_frAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
pratap_smsCommented:
You can absolute path like C:\\your.dll    
There is one more method call apart from Load Library,   System.Load("ABSOLUTEPATH");
Try this method call, It worked for me.
0
 
n_sachin1Commented:
Are you trying running your applet via the applet viewer or from the browser?
If you are running it from the browser, you will need to sign your jar file containing the applet to allow it to make system calls (like loading a library).

Look at for details on self signing certificates.
http://www.experts-exchange.com/Programming/Languages/Java/Q_23856030.html

Please note that your dll file should be present in the jar containing your applet and you can refer it relative to its location (for eg:- if you add the dll in the root folder, you can use just the dll name).

Alternatively, you can modify your java.policy to add your applet as a trusted source.
0
 
pratap_smsCommented:
I don't think, He is asking about Applet.
Sometimes, a webapplication might need native services.
0
 
n_sachin1Commented:
He said:
but when I try to execute the same code through an applet I get this error message :

"java.security.AccessControlException: access denied (java.lang.RuntimePermission loadLibrary.JNIxxx)"
0
All Courses

From novice to tech pro — start learning today.