7 Replies Latest reply on May 29, 2013 9:38 AM by jaikiran pai

    During migration from AS7.1.1 final to EAP6.1 beta remote lookup fails with ClassCastException

    Natasha Biryukov Newbie

      Hi everyone,

      we're in a middle of migration to JBoss EAP6.1 from JBoss AS7.1.1 because of the memory leake issue:

      https://community.jboss.org/thread/220655

       

      But now, in EAP6.1 beta remote lookups fails with the following exception:

      java.lang.ClassCastException: org.jboss.naming.remote.client.RemoteContext cannot be cast to javax.jms.ConnectionFactory

       

      This code perfectly worked in AS7.1.1 final.

      Any ideas what's missing?

       

      I have the jboss-eap-6.1\bin\client\jboss-client.jar in the class path.

      The lookup code is:

      Properties jndiProps = new Properties();

                          jndiProps.put("java.naming.security.principal", "applicationRealmUser");

                          jndiProps.put("java.naming.security.credentials", "applicationRealmPwd1!");

                          jndiProps.put("java.naming.provider.url", "remote://localhost:4447");

                          jndiProps.put("java.naming.factory.initial", "org.jboss.naming.remote.client.InitialContextFactory");

                          jndiProps.put("jboss.naming.client.ejb.context",true);

       

                          try {

                                    InitialContext context = new InitialContext(jndiProps);

                                    ConnectionFactory factory =  (ConnectionFactory) context.lookup("ConnectionFactoryPersistent");

                                    System.out.println(factory);

                          } catch (Exception e) {

                                    System.out.println("Error " + e);

                          }