1 Reply Latest reply on Sep 11, 2014 4:05 PM by Wolf-Dieter Fink

    Consume EJB registred in Jboss 7.1 in app stand alone or JEE5 in glassfish 2.1

    Danilo Sousa Newbie

      I'm having trouble consuming EBJs Jboss 7.1.1 a legacy project that runs on glassfish 2.1

      I created a stand alone java app to consume the ejbs and it worked OK.

       

      Properties jndiProps = new Properties();
              jndiProps.put(Context.INITIAL_CONTEXT_FACTORY,
                      "org.jboss.naming.remote.client.InitialContextFactory");
              jndiProps.put(Context.PROVIDER_URL, "remote://localhost:4447");
              jndiProps.put(Context.SECURITY_PRINCIPAL, "ejb");
              jndiProps.put(Context.SECURITY_CREDENTIALS, "123");
              jndiProps.put("jboss.naming.client.ejb.context", true);
              jndiProps.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
              Context ctx = new InitialContext(jndiProps);
              EjbRemote speaker = (EjbRemote) ctx.
                      lookup("ejb:ear/ejb/EJBBean!br.com.provider.ejb.repository.EjbRemote");
                  System.out.println( speaker.hello() );
      

      I using Lib

       

      <dependency>
                  <groupId>org.jboss.as</groupId>
                  <artifactId>jboss-as-ejb-client-bom</artifactId>
                  <version>7.1.1.Final</version>
                  <type>pom</type>
                  <scope>compile</scope>
              </dependency>
      

       

      This worked perfectly, however when I try to do it in my ear design that runs on glassfish 2.1 i have the log

      has unsupported major or minor version numbers, which are greater than those found in the Java Runtime Environment version 1.6.0_65

       

      I tested the app stand alone in order to consume ejbs without the utilization of libjboss-as-ejb-client-bom, insert the following libs

       

       <dependency>
                  <groupId>org.jboss</groupId>
                  <artifactId>jboss-remote-naming</artifactId>
                  <version>1.0.1.Final</version>
              </dependency>
              <dependency>
                  <groupId>org.jboss.xnio</groupId>
                  <artifactId>xnio-nio</artifactId>
                  <version>3.0.3.GA</version>
              </dependency>
              <dependency>
                  <groupId>org.jboss.marshalling</groupId>
                  <artifactId>jboss-marshalling-river</artifactId>
                  <version>1.3.11.GA</version>
              </dependency>
              <dependency>
                  <groupId>jboss</groupId>
                  <artifactId>jbossall-client</artifactId>
                  <version>4.2.2.GA</version>
              </dependency>
              <dependency>
                  <groupId>jboss</groupId>
                  <artifactId>jboss-remoting</artifactId>
                  <version>4.2.2.GA</version>
              </dependency>
      

       

      was displayed:

      Exception in thread "main" java.lang.NoClassDefFoundError: javax/ejb/NoSuchEJBException

      I believe to be out of a context jee

      someone already consumed ejbs a jboss 7.1.1 By Glasfish 2.1 in application JEE5 or standalone?

       

      Thanks