2 Replies Latest reply on May 10, 2011 3:47 AM by Anurag Bhatia

    Call EJB method from SAR

    Anurag Bhatia Newbie

      I have and 2 files deployed on my jboss-4.2.2.GA server -


      100project.ear (which contains other jar files)



      I have to call a method in a pojo (which in turn calls an EJB Session bean) from one of  the jars residing in the ear file. If I call the method directly from the sar then I get a ClassNotFoundException (no suprises there). I tried adding the jar to be called to the sar manifest.mf classpath but that did not work either. How do I make the sar call the method correctly?



        • 1. Call EJB method from SAR
          jaikiran pai Master

          Check the "classpath" and "codebase" attributes of the "server" element of your jboss-service.xml of the .sar. That's what controls the classpath of the .sar. For more details check the JBOSS_HOME/docs/jboss-service_4_2.dtd

          • 2. Call EJB method from SAR
            Anurag Bhatia Newbie

            @Jaikiran: Thanks a lot for the reply.

            I looked into the dtd but I could not still find a way to specify a jar in the ear file onto the sar classpath. The docs say -



            <!-- The codebase attribute specifies the base URL from which the jars or classes

            are loaded from. If the codebase is '.' then it is equal to the mbean deployment URL.

            Otherwise, it is resolved as a path spec relative to the serverHomeURL (e.g., file:/jboss-3.2.0)

            using the URL ctor URL(serverHomeURL, codebase)






               <classpath codebase='.' archives='util.jar' />

               <classpath codebase='http://classloader.dot.com' archives='*' />

               <classpath codebase="lib" archives="*"/>




            I tried adding the following classpath

               <classpath codebase='.' archives='util.jar' />


            where util.jar is inside the 100project.ear which is in the deploy directory with the 200mbean.sar