2 Replies Latest reply on Jan 3, 2012 2:57 AM by Ashutosh Pandey

    cannot run session bean on JBoss AS 7.1.0

    Ashutosh Pandey Newbie

      The same code runs successfully on Glassfish 3.1

       

      Please somebody help me, I'm new to JBoss

       

      -----------------------------------------------------------

      package pack;

      import javax.ejb.Remote;

       

      @Remote

      public interface MySessionBeanRemote {

          int add(int a,int b);

      }

      -----------------------------------------------------------

       

       

      -----------------------------------------------------------

      package pack;

       

      import javax.ejb.Stateless;

       

      @Stateless(name="MySessionBean", mappedName = "MySessionBean")

      public class MySessionBean implements MySessionBeanRemote {

       

          public MySessionBean() {

          }

       

          public int add(int a,int b){

              return a+b;

          }

      }

      -----------------------------------------------------------

       

      The client code:

      -----------------------------------------------------------

      package pack;

       

      import javax.ejb.EJB;

      import javax.naming.NamingException;

       

      public class JbossSessionBeanClient {

       

          @EJB

          private static MySessionBeanRemote remote;

         

          public static void main(String[] args) throws NamingException {

       

              System.out.println(remote.add(4, 6));

          }

       

      }

      -----------------------------------------------------------