• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to login to the sun ri appserver from a standalone (not ACC) client

Alex Buehler
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following in my code works until the create() method of the ManagementHome object is called:

Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.enterprise.naming.SerialInitContextFactory");
props.put(Context.URL_PKG_PREFIXES, "com.sun.enterprise.naming");
props.put(Context.PROVIDER_URL, "iiop://localhost:1050");
InitialContext ic = new InitialContext(props);
Object ref = ic.lookup("ejb/mgmt/MEJB");
ManagementHome mgmtHome = (ManagementHome) PortableRemoteObject.narrow(ref, ManagementHome.class);
Management mgmt = mgmtHome.create();

After the create() method is called the following Permission is thrown:

Exception in thread "main" java.rmi.AccessException: CORBA NO_PERMISSION 0 No; nested exception is:
org.omg.CORBA.NO_PERMISSION: ----------BEGIN server-side stack trace----------
org.omg.CORBA.NO_PERMISSION: vmcid: 0x0 minor code: 0 completed: No
at com.sun.enterprise.iiop.security.SecServerRequestInterceptor.receive_request(SecServerRequestInterceptor.java:396)
at com.sun.corba.ee.impl.interceptors.InterceptorInvoker.invokeServerInterceptorIntermediatePoint(InterceptorInvoker.java:509)

I think that I need to pack my code from above into some kind of privileged action using authentication so that it can be executed correctly. But I don�t have a clue on how to do that.

I read the following docs among others:
Securing J2EE Applications
Authentication Using Custom Realms in Sun Java System Application Server
Developing Java Clients

But these didn�t give me the insight that I need to accomplish that task.

For my application to work I need to be able to login as admin into the fileRealm or admin-realm using a username/password mechanism. My application is a non application container client. I tried to use the ClientPasswordLoginModule and LoginContext included in AS8 but it didn�t work. Does someone knows how to use these and the LoginContextDriver correctly?

Does anybody has an idea how to solve this problem or could provide some example code?

Thanks in advance
Nathan Pruett
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to the EJB forum... Distributed Java is more for questions on RMI/Jini/CORBA. This question sounds like it has more to do with EJB security permissions (and possibly how they are implemented in the RI) rather than how they communitcate across the network in general.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic