How do you preform an EJB lookup with application security?

Posted by Hillgod on Stack Overflow See other posts from Stack Overflow or by Hillgod
Published on 2009-05-18T18:18:10Z Indexed on 2012/12/10 11:06 UTC
Read the original article Hit count: 185

Filed under:
|
|
|

I'm trying to lookup an EJB from a standalone java application. I'm thinking in terms of WebSphere Application Server 6.1, but if someone knows how to do this for another application server, it may get me in the right direction.

What I'm currently doing:

    	initialContext= new InitialContext(env);
	initialContext.lookup("");

	lc = new LoginContext("WSLogin", new WSCallbackHandlerImpl("wasadmin", "defaultWIMFileBasedRealm", "wasadmin"));
	lc.login();
	subject = lc.getSubject();
	WSSubject.setRunAsSubject(subject);

This isn't working... my subject is still "/UNAUTHENTICATED", and I get an error when I try to lookup the EJB. I'm also specifying the following parameters to the VM when executing the application:

-Dcom.ibm.CORBA.ConfigURL="C:\was\profiles\AppSrv01\properties\sas.client.props" -Djava.security.auth.login.config="C:\was\profiles\AppSrv01\properties\wsjaas_client.conf"

© Stack Overflow or respective owner

Related posts about java

Related posts about java-ee