JBoss Community

Moving from 4.2.2 to AS 7

created by Richard Doust in JNDI and Naming - View the full discussion

Hi.

 

I'm in the process of moving a rather large application from JBoss 4.2.2 to JBoss AS 7.1.1. There's an awful lot to know about when doing this, and sometimes the documentation can seem to lead one around in circles. I'm sure if I was starting this from scratch, I'd do better, but I'm not, so, I have a question:

 

I have a single EJB jar containing Entity and Session beans. Many of the Session beans use the services of other Session beans. To gain access to those beans, they use JNDI, using a utility method like the following:

 

EJBUtil:

 

  public static AccountManagerLocalHome getAccountManagerLocalHome()

      throws NamingException {

    return HomeFactory.getHomeFactoryInstance().lookupAccountManagerLocalHome();

  }

 

HomeFactory:

 

  public AccountManagerLocalHome lookupAccountManagerLocalHome()

      throws NamingException {

    return (AccountManagerLocalHome) lookupLocal(

        JNDINames.ACCOUNTMANAGER_LOCAL, AccountManagerLocalHome.class);

  }

 

JNDINames.java:

 

public interface JNDINames {

     public final static String ACCOUNTMANAGER_LOCAL = "java:comp/env/ejb/AccountManagerLocal";

}

 

In JBoss startup log I find this:

 

15:50:10,268 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-10) JNDI bindings for session bean named AccountManager in deployment unit subdeployment "appEJB-1.0-SNAPSHOT.jar" of deployment "appEar-1.0-SNAPSHOT.ear" are as follows:

 

 

          java:global/appEar-1.0-SNAPSHOT/appEJB-1.0-SNAPSHOT/AccountManager!com.app.session.accountManager.AccountManagerRemote

          java:app/appEJB-1.0-SNAPSHOT/AccountManager!com.app.session.accountManager.AccountManagerRemote

          java:module/AccountManager!com.app.session.accountManager.AccountManagerRemote

          java:jboss/exported/appEar-1.0-SNAPSHOT/appEJB-1.0-SNAPSHOT/AccountManager!com.app.session.accountManager.AccountManagerRemote

          java:global/appEar-1.0-SNAPSHOT/appEJB-1.0-SNAPSHOT/AccountManager!com.app.session.accountManager.AccountManagerRemoteHome

          java:app/appEJB-1.0-SNAPSHOT/AccountManager!com.app.session.accountManager.AccountManagerRemoteHome

          java:module/AccountManager!com.app.session.accountManager.AccountManagerRemoteHome

          java:jboss/exported/appEar-1.0-SNAPSHOT/appEJB-1.0-SNAPSHOT/AccountManager!com.app.session.accountManager.AccountManagerRemoteHome

          java:global/appEar-1.0-SNAPSHOT/appEJB-1.0-SNAPSHOT/AccountManager!com.app.session.accountManager.AccountManagerLocal

          java:app/appEJB-1.0-SNAPSHOT/AccountManager!com.app.session.accountManager.AccountManagerLocal

          java:module/AccountManager!com.app.session.accountManager.AccountManagerLocal

          java:global/appEar-1.0-SNAPSHOT/appEJB-1.0-SNAPSHOT/AccountManager!com.app.session.accountManager.AccountManagerLocalHome

          java:app/appEJB-1.0-SNAPSHOT/AccountManager!com.app.session.accountManager.AccountManagerLocalHome

          java:module/AccountManager!com.app.session.accountManager.AccountManagerLocalHome

 

Given the above, and assuming that this code would only be called from beans within this jar, would the code work if I were to change JNDINames.java to:

 

public interface JNDINames {

     public final static String ACCOUNTMANAGER_LOCAL = "java:app/AccountManager!com.app.session.accountManager.AccountManagerLocal";

}

 

 

Would there be a better/easier way to make this change? Keep in mind, I have about 50 session beans and about 30 entity beans, so the fewer changes the better.

 

Thanks in advance.

 

Richard

Reply to this message by going to Community

Start a new discussion in JNDI and Naming at Community