users@glassfish.java.net

Standalone EJB client using iiop/rmi

From: <glassfish_at_javadesktop.org>
Date: Fri, 22 Oct 2010 20:29:30 PDT

I have a setup

EJB 2.1 beans on a sunone application server 6.1 (I know this is a glassfish forum but could not find the answer anywhere) having bean exposed as iiop.

I want to access these beans from a standalone client. I am able to lookup the bean but when i try to access a method I get the following error

[b]Caused by: java.rmi.AccessException: Client is not authorized for this invocation.[/b]

I am not sure it the server is using ssl. There is a <iiop-service><iiop-listener> entry using ssl in sun-application-jar.xml but there is no <ior-security> entry which exposing jars.

Here is the code
[code]
public class BranchCodeClient {
   public static void main(String [] args) throws Exception{
      Properties iiop = new Properties();

      iiop.put("java.naming.factory.initial", "com.sun.jndi.cosnaming.CNCtxFactory");
      iiop.put("java.naming.provider.url", "iiop://172.30.16.105:33700/");

      InitialContext context = new InitialContext(iiop);
      BranchServiceHome home = (BranchServiceHome)PortableRemoteObject.narrow(
            context.lookup("ejb/BranchService"),
            BranchServiceHome.class);
      BranchService service = (BranchService)home.create();
      System.out.println(service.list());//ERROR OCCURS HERE
      
   }
}
[/code]
Please help...

regards
Taha
[Message sent by forum member 'tawus']

http://forums.java.net/jive/thread.jspa?messageID=486029