Author: techfox9

JBoss vs WebLogic – JNDI issues..

Friday, June 11th, 2010 @ 5:07 pm

In JBoss, one can get a reference to the Remote bean directly:

    context = new InitialContext(jndiprops);
    BookTestBeanRemote beanRemote = 
        (BookTestBeanRemote) context.lookup("BookTestBean/remote");
} catch (NamingException e) {

In WebLogic 10.3, I was not able to do the same thing.
The exception said that WebLogic JNDI failed to find the bean.
As some searches indicated, I should have used something like this for
the lookup string: “BookTestBean#com.blah.BookTestBeanRemote” ..
I tried all kinds of combinations but I was not able to make it work.

In JBoss, the “Home” interface is not required. In WebLogic, it is required.
This may have something to do with different levels of implementation
of the EJB spec but I would think JBoss 5 and WebLogic 10
should be pretty close in compatibility.. maybe.. what do I know?

Based on this, the only way I was able to make WebLogic work, was via
the “Home” interface:

Context context;
    context = new InitialContext(jndiprops);

    UserTransaction txn = (UserTransaction) context.lookup("javax.transaction.UserTransaction");
    if (txn != null) {
        String jndiLookupStr = "";
	// jndiLookupStr = "BookTestBean#de.laliluna.library.BookTestBeanRemote";
        jndiLookupStr = "BookTestBean";

        Object oref = context.lookup(jndiLookupStr);
        BookTestBeanHome homeRef = (BookTestBeanHome) PortableRemoteObject.narrow(oref,
        BookTestBeanRemote beanRef = homeRef.create();

    } // txn != null
catch (Exception e) {

This page says that remote reference retrieval is possible with WebLogic:

JBoss, Weblogic


Comments are closed.