7 Replies Latest reply on Jun 26, 2003 11:37 AM by tomdee

    SAR and EJB EAR - how can classes in SAR reference classes i

    tomdee

      i have a jar file (FOO.jar) deployed as a SAR format where I created a FOO.SAR directory and the necessary jboss-service.xml in META-INF dir.

      I can get that deployed no problem.

      In FOO.jar, it's referencing classes that are packaged in an EAR. How do i deploy both and make sure that my EAR is deployed before SAR is deployed? and that SAR can see classes that are in the EAR ?

      Simply deploy the EAR file to jboss/server/default/deploy would'nt work I am getting ClassNotFoundException when a class in FOO.sar try to create an instance of a class in the EAR.


      Thanks.


        • 1. Re: SAR and EJB EAR - how can classes in SAR reference class
          jonlee

          Refer to the org.jboss.deployment.scanner.PrefixDeploymentSorter and its description in conf/jboss-service.xml of your JBoss instance. You can force deployment order through this rather than the default deployment strategy. However, it seems a better idea to have the shared libraries placed in the SAR rather than the EAR (unless you would foresee deploying the EAR without the SAR).

          • 2. Re: SAR and EJB EAR - how can classes in SAR reference class
            tomdee

            Jon
            so if i always deploy the EAR with the SAR what's the right format? I've tried this but my servlet in myServlet.WARfailed to load due to ClassNotFoundException

            [pre]
            MYAPP.SAR (Dir)
            +-- META-INF (Dir)
            +-- jboss-service.xml
            +-- application.xml
            +-- jboss-app.xml
            +-- myEJB.JAR
            +-- myServlet.WAR
            +-- my3RDparty.JAR
            [/pre]

            • 3. Re: SAR and EJB EAR - how can classes in SAR reference class
              raja05

              If you are going to deploy them as separate units, i mean have a FOO.sar and FOO.ear(that has the ejb components), you can put in a "depends" on the jboss-service.xml of ur SAR file, like,


              jboss.j2ee:jndiName=,service=EJB


              Look at any of the -service.xml files for the exact syntax.

              And loading classes from SAR to EAR shouldnt be a problem as its a flat structure for all classes in deploy directory.

              Let me know if it works. Ive to try a similar thing that im planning on doing today.

              -Raj

              • 4. Re: SAR and EJB EAR - how can classes in SAR reference class
                tomdee

                Raja
                I ended up deploying this way.


                FOO.EAR as a directory
                [pre]
                foo.ear
                +-- META-INF
                +-- myEJB.jar
                +-- myServlet.war
                +-- my3rdParty.jar
                [/pre]
                FOO.SAR as a directory
                [pre]
                foo.sar
                +-- META-INF
                +-- jboss-service.xml
                [/pre]
                and inside jboss-service.xml, i added a classpath
                [pre]

                [/pre]

                The only outstanding question now is I need
                foo.sar to depend on a (load on startup=1) servlet (not EJB) inside myServlet.war.

                Is that possible and if yes what JNDI name do i use to reference the servlet in my element?

                • 5. Re: SAR and EJB EAR - how can classes in SAR reference class
                  jonlee

                  Don't know if it is possible as I haven't tried referencing a servlet. Someone was doing this on the mailing list but had problems from what I remember.

                  If you use the jmx-console, you can see the domain and naming used for deployed services. You'll see a match for your EJB (jboss.j2ee:jndiName=...,service=EJB) on which you were going to make your depend. You can get your servlet information from there. I guess give it a try as the system encourages experimentation.

                  • 6. Re: SAR and EJB EAR - how can classes in SAR reference class
                    tomdee

                    Doesn't look like it's possible to have the SAR depends on a servlet. but reading over the documentation again, it says that SAR is deployed nested depth first. So in theory, if i have
                    [pre]
                    FOO.SAR
                    +--- META-INF
                    +--- FOO.EAR
                    [/pre]

                    FOO.EAR should deploy first before deploying fully deploying anything mentioned in META-INF/jboss-service.xml

                    Looks like that is working it only works AFTER JBoss has finished starting up. (ie. startup JBoss, then drop in directory FOO.SAR). OTherwise, the EJB in FOO.EAR fails to deploy b/c it requires jboss:service=invoker,type=jrmp.
                    See below

                    MBeans waiting for other MBeans:

                    [ObjectName: jboss.j2ee:jndiName=MyTestEJB,service=EJB
                    state: FAILED
                    I Depend On:
                    Depends On Me: java.lang.RuntimeException: invoker is null: jboss:service=invoker,type=jrmp]

                    • 7. Re: SAR and EJB EAR - how can classes in SAR reference class
                      tomdee

                      I figured this out

                      http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t= this is an issue in 3.2.1 where EJB requires JRMP but didn't have a dependency stated