Solved

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

Posted on 2008-10-14
5
2,093 Views
Last Modified: 2013-12-02
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

0
Comment
Question by:Francois_fr
  • 2
  • 2
5 Comments
 
LVL 2

Accepted Solution

by:
formula1act earned 500 total points
ID: 22776377
0
 
LVL 1

Expert Comment

by:pratap_sms
ID: 23001323
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
 
LVL 8

Expert Comment

by:n_sachin1
ID: 23011961
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
 
LVL 1

Expert Comment

by:pratap_sms
ID: 23012314
I don't think, He is asking about Applet.
Sometimes, a webapplication might need native services.
0
 
LVL 8

Expert Comment

by:n_sachin1
ID: 23012665
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

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Maven Project: Hibernate Dependencies Conflict 10 49
hibernate insert example 13 37
Selenium docs api java index 3 64
Java Inheritance super keyword use 8 32
Verbose logging is used to diagnose garbage collector problems. By default, -verbose:gc output is written to either native_stderr.log or native_stdout.log.   It is also possible to redirect the logs to a user-specified file. This article will de…
Most of the developers using Tomcat find it easy to configure the datasource in Server.xml and use the JNDI name in the code to get the connection.  So the default connection pool using DBCP (or any other framework) is made available and the life go…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question