views:

212

answers:

1

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"

A: 

in my experience, the username/password parameters you pass in env, during creation of the InitialContext, will be used, although my experience is mostly with Weblogic and JBOSS.

John