You could try to do this, though break EJB spec:

    remoteMethod() {
         LoadNativeLibAction action = new LoadNativeLibAction("SWEOJNI");
         AccessController.doPrivileged(action);
    }

    private static class LoadNativeLibAction implements PrivilegedAction {
        String nativeLibName = null;

        public LoadNativeAction(String nativeLibName) {
            this.nativeLibName = nativeLibName;
        }

        public Object run() {
            try {
                System.loadLibrary(nativeLibName);
            } catch (Exception ex) {
                ex.printStackTrace();
            }
            return null;
        }
    }

    Good luck.

Regards
Jinsong

-----Original Message-----
From: Xie, Jinpeng [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 10, 2002 1:44 PM
To: [EMAIL PROTECTED]
Subject: Re: how to load native library to ejb container


Actually, I want to use a third party java library that wraps native c++
library in a session bean.

I used it in servlets that deployed in IBM Websphere Application Server
3.5.3.
In the servlet, I used System.loadLibrary("SWEOJNI"). It works.

I search it online. Somebody suggested the permession in server.policy file
can be changed to loadLibrary.
I tried a couple of times. It failed because I don't know how?

Any suggestion?


Jim

-----Original Message-----
From: Marco Wang [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 10, 2002 10:03 AM
To: [EMAIL PROTECTED]
Subject: Re: how to load native library to ejb container


To do it in session bean is not allowed by EJB spec.

 -Marco


-----Original Message-----
From: Xie, Jinpeng [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 10, 2002 9:59 AM
To: [EMAIL PROTECTED]
Subject: how to load native library to ejb container


In a stateless session bean, I need to load native library by using
System.loadLibrary("SWEOJNI") in setSessionContext. I got the following
error:

Could not create stateless EJB: java.security.AccessControlException: access
denied (java.lang.RuntimePermission loadLibrary.SWEOJNI) at
com.sun.ejb.containers.StatelessSessionContainer.createStatelessEJB(Stateles
sSessionContainer.java:358)
at
com.sun.ejb.containers.StatelessSessionContainer.getContext(StatelessSession
Container.java:285) at
com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:365)
at
fsu.ais.jstew.ejb.ItemListGatewayBean_EJBObjectImpl.prepareForLogin(ItemList
GatewayBean_EJBObjectImpl.java:230)
------------------------------------------

How do I set up permission to allow container to load native libraries? Any
help is highly appriciated.


Jim

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

==========================================================================To
unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to