loadlibrary - Access Denied (java.lang.RunTimePermission)

Hi guys,

I was wondering if you could help me.

I am working in a Windows NT environment where I have developed a EJB to call some C methods via a DLL.

In my java source code, I call the loadlibrary() function to load the DLL in order to call the C method.

Unfortunately, I am getting "Access Denied - (java.lang.RunTimePermission" error messages during execution).

I have applied permission in the java.policy file for this DLL but I still continue to get this message.

I have read from Sun documentation that the EJB architecture does not allow for loading of native methods. Does this hold true ?

If not, any ideas where I am going wrong ?

I would be most grateful for any advice.

Thanks in advance.

Tony

[781 byte] By [tho88] at [2007-9-26 5:09:04]
# 1

You will need to setup a policy file for the SecurityManager that allows the loading of runtime dll's. Check the EJB server for information about how to setup policy files. Most Java server applications use security policy files anyway so you should have no problems setting this up.

In the appropriate policy file add the following

grant file:/some/path/to/your/EJB.classORjar {

permission java.lang.RuntimePermission "loadLibrary.yourLib"

}

Or something similar to that. "yourLib" should be changed to the string you use in the System.loadLibrary method.

andyba at 2007-6-29 19:09:21 > top of Java-index,Java HotSpot Virtual Machine,Specifications...