3 Replies Latest reply on Jan 2, 2014 4:59 AM by wdfink

    Does Jboss 6.1.0 support ejb 2.1 ?

    raviananda


      Hi All,

       

      We are migrating the weblogic server to jboss 6.1.0 server,

      In process of migration, we are also migrating the ejb v 2.1.

      So, I tried to create the sample ejb 2.1 project and try to look up, but I'M getting the below exception

       

      INFO: EJBCLIENT000013: Successful version handshake completed for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@4e280c, receiver=Remoting connection EJB receiver [connection=Remoting connection <bb7759>,channel=jboss.ejb,nodename=xin009cdaa81715]} on channel Channel ID 95d56691 (outbound) of Remoting connection 009e29fb to localhost/127.0.0.1:4447

      javax.naming.NameNotFoundException: Hello -- service jboss.naming.context.java.jboss.exported.Hello

      at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:103).

       

      Please suggest me on this, Does Jboss 6.1.0 support the ejb 2.1?

      if  Yes, Please find the steps below for creating the ejb project and doing lookup.

      stp1 : created the ejb2.1 project, and created the home and remote object, also added the entry in the ejb-jar.xml

      <?xml version="1.0" encoding="UTF-8"?>

      <ejb-jar>

        <enterprise-beans>

          <session>

            <ejb-name>Hello</ejb-name>

            <home>com.ejb.HelloHome</home>

            <remote>com.ejb.HelloObject</remote>

            <ejb-class>com.ejb.HelloBean</ejb-class>

            <session-type>Stateless</session-type>

            <transaction-type>Container</transaction-type>

          </session>

        </enterprise-beans>

        <assembly-descriptor>

          <container-transaction>

            <method>

              <ejb-name>Hello</ejb-name>

              <method-name>*</method-name>

            </method>

            <trans-attribute>Required</trans-attribute>

          </container-transaction>

        </assembly-descriptor>

      <ejb-client-jar>ExampleEjb.jar</ejb-client-jar>

      </ejb-jar>

      stp2: added the jboss.xml to the meta-inf folder

      <jboss>
      <enterprise-beans>
        <session>
         <ejb-name>Hello</ejb-name>
         <jndi-name>Hello</jndi-name>
         <!-- <local-jndi-name>com.ejb.HelloBean</local-jndi-name> -->
         <method-attributes>
         </method-attributes>
        </session>

      </enterprise-beans>
      <resource-managers>
      </resource-managers>
      </jboss>

       

      stp3: created the .jar and deplyed on the jboss admin console.

      stp4: created the ejbclient project and tried to look up the deployed ejb using the bean class as show below:

      public class HelloWorld {

      public static void main( String args[]) {
        try{
         
          Properties env = new Properties();
         
          //The JNDI properties you set depend
          //on which server you are using.
          //These properties are for the Remote Server.
          env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory" );
          env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jboss.naming.remote.client");
          env.put(Context.PROVIDER_URL, "remote://localhost:4447");
          env.put("jboss.naming.client.ejb.context", true);
        
          /*env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
          env.put(Context.PROVIDER_URL,"localhost:1099");
          env.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");*/

         
          //Now use those properties to create
          //a JNDI InitialContext with the server.
          InitialContext ctx = new InitialContext( env );
         
          //Lookup the bean using it's deployment id
          Object obj = ctx.lookup("Hello");
         
          //Be good and use RMI remote object narrowing
          //as required by the EJB specification.
          HelloHome beanhome = (HelloHome)
              PortableRemoteObject.narrow(obj,HelloHome.class);

          HelloRemote bean = (HelloRemote)beanhome.create();        
          // calling the business method of remote interface       
          bean.sayHello();

       

      But I'M getting the exception as below :

      INFO: EJBCLIENT000013: Successful version handshake completed for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@4e280c, receiver=Remoting connection EJB receiver [connection=Remoting connection <bb7759>,channel=jboss.ejb,nodename=xin009cdaa81715]} on channel Channel ID 95d56691 (outbound) of Remoting connection 009e29fb to localhost/127.0.0.1:4447

      javax.naming.NameNotFoundException: Hello -- service jboss.naming.context.java.jboss.exported.Hello

      at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:103)

       

      Please suggest.

       

      Thanks

      Ravi