[jboss-user] [Security & JAAS/JBoss] - Accessing a secured bean deployed in one JBOSS from other Jb

satheeskumar do-not-reply at jboss.com
Mon Aug 27 01:42:33 EDT 2007


Hi,
The senario: The UserManagerBean is deployed in a JBOSS and this bean
 is used to login to the application. As a stand alone java class (Client)
 using the following code I could call the login() on the remote of that Bean.

System.setProperty("java.security.auth.login.config",Constants.AUTH_CONF_FILE_PATH);
props.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,"org.jboss.naming.NamingContextFactory");
props.setProperty("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
props.put(javax.naming.Context.PROVIDER_URL, "jnp://Anton:10099");
props.put("java.naming.factory.initial","org.jboss.security.jndi.LoginInitialContextFactory");
props.put(javax.naming.Context.SECURITY_PRINCIPAL, user);
props.put(javax.naming.Context.SECURITY_CREDENTIALS, password);
props.put(javax.naming.Context.SECURITY_CREDENTIALS, JCrypt.crypt(user,password));
ic = new InitialContext(props);userHome=(EJBHome)
PortableRemoteObject.narrow(ic.lookup(name), home);
userRemote = userHome . create(); .<= error 
userRemote.login();
userRemote.getCurrentUser(),........

and If I deployed this class into a another JBOSS in war file and and tried
to login() on userRemote  , Unfortunately I got the error when I create
 the userRemote from the home 

*both JBOSS are running in 2 different machine

Could you please advice on this Issue ?
the error is ...
11:32:33,698 INFO  [STDOUT] : java.rmi.AccessException: SecurityException; nested ex
ception is: javax.security.auth.login.LoginException: An error occured during login: java.lang.NullPoint
erException
11:32:33,698 ERROR [STDERR] java.rmi.AccessException: SecurityException; nested exception is:
        javax.security.auth.login.LoginException: An error occured during login: java.lang.NullPoint
erException
11:32:33,698 ERROR [STDERR]     at org.jboss.ejb.plugins.LogInterceptor.handleException(LogIntercept
or.java:370)
11:32:33,698 ERROR [STDERR]     at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.ja
va:125)

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4078211#4078211

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4078211



More information about the jboss-user mailing list