0 Replies Latest reply on Aug 20, 2015 9:08 AM by sunny dhar

    Facing Issue in jboss migration from Jboss 5.1 to Jboss Eap 6.2

    sunny dhar Newbie

      @

      Hi,

      our application has client and it connects to the ejb.We are using ejb-jar.xml on the server side to lookup ejbs. We are currently having issues with the ejb lookup in jboss6.2.

      In jboss 5.1 we were using jnp library but for eap 6.2 jnp is no longer used and remote is used.




      So i modified the code replacing jnp with remote in the code as below


       

       

       

       

      public synchronized static  getRemoteInterface( String aEnvironment )

          throws CreateException, RemoteException, NamingException,

          PropertyFileNotFoundException

      {

        if ( Communications.remoteInterface == null )

        {

        Hashtable< String, String > lHashTable =

           new Hashtable< String, String >( );

       

       

        // Determine which naming service to hit based on Environment.

        final String lProviderURL = getProperty( aEnvironment );

       

       

        System.out.println( "Attempting to get remote interface to: "

           + aEnvironment + ".  Trying Provider URL: " + lProviderURL );

       

       

       

        lHashTable.put( "java.naming.factory.initial",

          "org.jboss.naming.remote.client.InitialContextFactory" );

        //lHashTable.put( "java.naming.factory.initial",

         //  "org.jnp.interfaces.NamingContextFactory" );

        lHashTable.put( "java.naming.provider.url", lProviderURL );

        //lHashTable.put( "java.naming.factory.url.pkgs",

         //  "org.jboss.naming:org.jnp.interfaces" );

       

        lHashTable.put( "java.naming.factory.url.pkgs",

           "jboss.naming.client.ejb.context");

       

       

       

       

      ABCHome lHomeInterface;

       

       

        javax.naming.InitialContext initialContext =

           new javax.naming.InitialContext( lHashTable );

        try

        {

      // "ABC" is the JNDI name for our SessionBean.

        Object objRef = initialContext.lookup( "ABC" );

        // only narrow if necessary

        if ( java.rmi.Remote.class.isAssignableFrom( ABCHome.class ) )

        lHomeInterface =

           ( ABCHome )javax.rmi.PortableRemoteObject.narrow(

               objRef, ABCHome.class );

        else

        {

        lHomeInterface = ( ABCHome )objRef;

        }

        }

        finally

        {

        initialContext.close( );

        }

       

       

        // throws CreateException, RemoteException

        Communications.remoteInterface = lHomeInterface.create( );

        }

       

       

        return Communications.remoteInterface;

      }

       

       

      We are getting a error

       

      [06/30/15 06:34 PM IST]  Worker.getRemoteInterface( ): javax.naming.NameNotFoundException: ABC-- service jboss.naming.context.java.jboss.exported.ABC

      [06/30/15 06:34 PM IST]  LogoutWorker.executeWrappedEJBMethod( ): Calling EJB from LogoutWorker: com.gui.workers.LogoutWorker

      [06/30/15 06:34 PM IST]  Worker.haveRemoteInterface( ): haveRemoteInterface returning: false

      [06/30/15 06:34 PM IST]  Client.logoutFinished( ): Application is terminating.

       

       

       

       

       

      The same code is working with jboss 5.1 but with eap 6.2 when we do a look up it is failing. I know we need to change out look up name ABC according to the standards of eap 6.2 .

       

      Could any one please advise?