Thursday, September 3, 2009

EJB client connecting to Weblogic

Lookup service for EJB

requires wlfullclient.jar or wlthint3client.jar on classpath (must be first)

http://docs.oracle.com/cd/E17904_01/web.1111/e13717/wlthint3client.htm
http://docs.oracle.com/cd/E17904_01/web.1111/e13717/basics.htm#i1068418

    public void lookupService()  {
try {
Properties props = new Properties();
props.put(Context.PROVIDER_URL, "t3://localhost:7001");
props.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
Context ctx = new InitialContext(props);
service = (TestTimer) ctx.lookup("ejb/TestTimer#testEAR.TestTimer");
} catch (NamingException e) {
e.printStackTrace();
}
}

No comments:

Post a Comment