2 Replies Latest reply on Nov 15, 2013 7:27 AM by viswameera

    remote client ejb1.2 call the Jboss 6.1 server

    viswameera Newbie


      I am stuck with the remote cleint call using ejb1.2 to the beans running in jboss 6.1 server.

       

      We are in the mid of migrating our j2ee application from Jboss 5 to 6.1

       

      Please help to resolve this issue

       

      thanks

      Meera V

        • 1. Re: remote client ejb1.2 call the Jboss 6.1 server
          Henrik Hoffmann Newbie

          could you please give more input?

           

          what is the error and may post some code of you

          • 2. Re: remote client ejb1.2 call the Jboss 6.1 server
            viswameera Newbie

            We are basically migrating from JBoss 5 to Jboss 6.1.  We have EJB 1.2 packed in our ear file and able to fix all the migration error and the application works fine.  Along with this, we do have a remote client application calling the ejbs packed in the ear  also.  I am stuck in that point now

            Please find the code snippet

            client code "...............................................................

            logger.info("DefaultJDBCFacility1 get else  1111 ...");

                     final Hashtable jndiProperties = new Hashtable();

                     jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");

                     ctx = new InitialContext(jndiProperties);

                     logger.info("DefaultJDBCFacility1 get else  2222...");

               

                 String homeClassName = "org.ts.tris.util.client.service.ClientServiceHome";

                 String jndiName = "ejb:TrisApp/TrisEJB/ClientService!org.ts.tris.util.client.service.ClientServiceHome";

                   Object obj = ctx.lookup(jndiName);

                  logger.info("DefaultJDBCFacility1 ... lookup completed...");

                  logger.info("DefaultJDBCFacility1 ... next to lookup Portable class.."+PortableRemoteObject.narrow(obj,ClientServiceHome.class).getClass().getName());

                  logger.info("DefaultJDBCFacility1 ... next to lookup Portable class.."+PortableRemoteObject.narrow(obj,ClientServiceHome.class).getClass().getInterfaces().getClass().getName());

                 

                  ClientServiceHome home = (ClientServiceHome) PortableRemoteObject.narrow(obj,ClientServiceHome.class);

                  //ClientServiceHome home = (ClientServiceHome)obj;

                  logger.info("DefaultJDBCFacility1 ... Portableable object completed");

                  ClientService cs = (ClientService) home.create();

                  logger.info("DefaultJDBCFacility1 ... create () complete ..." );

             

            .........................................................................

             

            ClientServiceHome is home inteface packed in the ear and runs the JBoss 6.1 app server.

            The above code is aclient code which should get the home object. 

            I am stuck while getting home object for ClientServiceHome.  ie in this line

            ................................

            ClientServiceHome home = (ClientServiceHome) PortableRemoteObject.narrow(obj,ClientServiceHome.class);

            ................................................

             

            It throws the following error

            2013-11-15 05:58:31,626 [main] INFO  org.ts.tris.dao.DefaultJDBCFacility  - DefaultJDBCFacility1 get else  1111 ...

            2013-11-15 05:58:31,628 [main] INFO  org.ts.tris.dao.DefaultJDBCFacility  - DefaultJDBCFacility1 get else  2222...

            2013-11-15 05:58:31,738 [main] INFO  org.jboss.ejb.client  - JBoss EJB Client version 1.0.21.Final-redhat-1

            2013-11-15 05:58:31,761 [main] INFO  org.ts.tris.dao.DefaultJDBCFacility  - DefaultJDBCFacility1 ... lookup completed...

            2013-11-15 05:58:31,764 [main] ERROR org.ts.tris.dao.DefaultJDBCFacility  - getDatasource 2

            java.lang.ClassCastException

                    at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:245)

                    at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:153)

                    at org.ts.tris.dao.DefaultJDBCFacility.getDataSource(DefaultJDBCFacility.java:80)

                    at org.ts.tris.dao.DefaultJDBCFacility.<init>(DefaultJDBCFacility.java:39)

                    at org.ts.tris.TrisDaemon.main(TrisDaemon.java:121)

            Caused by: java.lang.ClassCastException: com.sun.proxy.$Proxy0 cannot be cast to org.omg.CORBA.Object

                    at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:228)

                    ... 4 more

            2013-11-15 05:58:31,768 [main] ERROR org.ts.tris.TrisDaemon  - Error when getting connection:java.lang.NullPointerException

            2013-11-15 05:58:31,768 [main] INFO  org.ts.tris.TrisDaemon  - Trying to get connection again...

            2013-11-15 05:58:31,768 [main] ERROR org.ts.tris.TrisDaemon  - TrisDaemon Init:java.lang.NullPointerException

            ............................................................................

            I have the jboss-ejb-client.properties set as follows

            endpoint.name=client-endpoint

            remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false

            remote.connections=default

            remote.connection.default.host=10.191.253.93

            remote.connection.default.port=8455

            remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false

            remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT=false

            #remote.connection.default.username=appuser

            #remote.connection.default.password=apppassword

            remote.connection.default.username=ejbuser

            remote.connection.default.password=******