• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Help : EJB as RMI client

 
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm having some problem creating an ejb as a rmi client.
I have create the rmi server and access it through a normal java app client successfully.
However, when I try to paste the client code into a method for an ejb, I hit an error when call this method from an ejb client.
I have attached the rmi client code and error at the end
I've done a little bit of tracing and found that the Installation of Security Manager, Lookup are fine. The error was thrown when invoking the RMI server method.
My guess is that the rmi client (EJB) in this case does not have the security policy specified as in the case for a normal java app rmi client.
Is there any way I can't specify that in a EJB or my guess is actually wrong?
Interesting enough, every time I hit the error :-
access denied (java.io.FilePermission D:\AppServer\Weblogic\7.0 user_projects\testdomain\.\lowhm\upload\RMIClient read)
I can't seem to redeploy the bean again as I guess the client thread is still alive.

Thanks for any advice.
Cheers.

Han Ming

##################################################
Exception occured: java.security.AccessControlException: access denied (java.net.SocketPermission lowhm resolve)
java.security.AccessControlException: access denied (java.io.FilePermission D:\AppServer\Weblogic\7.\user_projects\testdomain\.\lowhm\upload\RMIClient\RMIClient.jar read)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:267)
at java.security.AccessController.checkPermission(AccessController.java:394)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:540)
at java.lang.SecurityManager.checkRead(SecurityManager.java:885)
at java.util.zip.ZipFile.<init>(ZipFile.java:103)
at java.util.jar.JarFile.<init>(JarFile.java:110)
at java.util.jar.JarFile.<init>(JarFile.java:52)
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:371
)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:152)
at java.lang.ClassLoader.loadClass(ClassLoader.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:310)
at ejbtest.Enterprise1Bean.invoke(Enterprise1Bean.java:49)
at ejbtest.Enterprise1Bean_st8cog_EOImpl.invoke(Enterprise1Bean_st8cog_EOImpl.java:96)
at ejbtest.Enterprise1Bean_st8cog_EOImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.activation.ActivatableServerRef.invoke(ActivatableServerRef.java:87
)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:313)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:762)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:308)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:30)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)
 
HanMing Low
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi to all,
I'm posting to myself.
Just for information for anyone interested.
The problem is due to the security policy file which is not available in a EJB where in a java app you can define the -Djava.securiy.policy
Thus, in my case, using Weblogic, you can define the policy in weblogic.policy to allow the reading of the jar and allow socket connection. Then, it should be successful.
Just try to do it without the specific grant permission and observe the AccessControlException thrown, then you'll have a good idea of which permission to grant.
Cheers.

Han Ming
 
If somebody says you look familiar, tell them you are in porn. Or in these tiny ads:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic