Geronimo_MoinMoin_wiki > OpenEJBNova
Added by Confluence Administrator, last edited by Confluence Administrator on Aug 02, 2006
  • = "About" =

OpenEJB is the default EJB 2.x Container of Geronimo.

THIS DOCUMENT IS OUT OF DATE.

The the nova branch of OpenEJB has finally been merged with the main branch and the new cvs lives at OpenEJB's new home at Codehaus. That combined with the removal of the deployment system as it is documented here, means that it is no longer possible to deploy OpenEJB into Geronimo. More work is required and should be done Real Soon Now.

  • = Building =
    • Before building OpenEJB, Geronimo has to be built. See BuildingAndRunning
    • Get the sources from OpenEJB's nova branch
      •    cvs -d:pserver:anonymous@cvs.openejb.sf.net:/cvsroot/openejb co -r nova -d nova openejb

        If you are having proxy/firewall problems then you can try the following

           cvs -d:pserver:anonymous@cvs-pserver.sf.net:80/cvsroot/openejb login 
           cvs -d:pserver:anonymous@cvs-pserver.sf.net:80/cvsroot/openejb co -r nova -d nova openejb
    • Go to nova/nova directory and run maven build = Running = Assuming the above steps went fine, you ought to see openejb-nova-DEV.jar file in target directory. The file and src/etc/nova-ejb-service.xml are the files that need to be copied to Geronimo directories.
    • Copy src/etc/nova-ejb-service.xml to Geronimo's target/geronimo-DEV/deploy directory - this is the file that tells Geronimo that the service exists and how to find it.
    • Copy target/openejb-nova-DEV.jar to Geronimo's target/geronimo-DEV/lib directory
    • Start up Geronimo You ought to see the following:
          > maven run:main
          ...a lot of lines cut...
          [java] 22:41:00,250 TRACE [DeploymentPlan] Performing task RegisterMBeanInstance geronimo.deployment:role=DeploymentUnit,type=Service,url="file:/c:/projects/geronimo/target/geronimo-DEV/deploy/nova-ejb-service.xml"
          [java] 22:41:00,300 DEBUG [AbstractWebContainer] Ignoring registration of mbean=geronimo.deployment:role=DeploymentUnit,type=Service,url="file:/c:/projects/geronimo/target/geronimo-DEV/deploy/nova-ejb-service.xml"
          [java] 22:41:00,300 TRACE [DeploymentPlan] Performing task StartMBeanInstance geronimo.deployment:role=DeploymentUnit,type=Service,url="file:/c:/projects/geronimo/target/geronimo-DEV/deploy/nova-ejb-service.xml"
          [java] 22:41:00,300 DEBUG [ServiceDeployment] geronimo.deployment:role=DeploymentUnit,type=Service,url="file:/c:/projects/geronimo/target/geronimo-DEV/deploy/nova-ejb-service.xml" State changed from stopped to starting
          [java] 22:41:00,320 DEBUG [ServiceDeployment] geronimo.deployment:role=DeploymentUnit,type=Service,url="file:/c:/projects/geronimo/target/geronimo-DEV/deploy/nova-ejb-service.xml" State changed from starting to running
          [java] 22:41:00,320 TRACE [DeploymentPlan] Performing task CreateClassSpace geronimo.system:role=ClassSpace,name=System
          [java] 22:41:00,320 TRACE [DeploymentPlan] Performing task DeployGeronimoMBean geronimo.deployment:role=DeploymentPlanner,type=EJBModule
          [java] 22:41:00,350 TRACE [DeployGeronimoMBean] Creating GeronimoMBean name=geronimo.deployment:role=DeploymentPlanner,type=EJBModule
          [java] 22:41:00,501 DEBUG [AbstractWebContainer] Ignoring registration of mbean=geronimo.deployment:role=DeploymentPlanner,type=EJBModule
          [java] 22:41:00,501 TRACE [DeploymentPlan] Performing task InitializeMBeanInstance geronimo.deployment:role=DeploymentPlanner,type=EJBModule
          [java] 22:41:00,501 TRACE [DeploymentPlan] Performing task StartMBeanInstance geronimo.deployment:role=DeploymentPlanner,type=EJBModule
          [java] 22:41:00,501 DEBUG [GeronimoMBean] geronimo.deployment:role=DeploymentPlanner,type=EJBModule State changed from stopped to starting
          [java] 22:41:00,501 DEBUG [GeronimoMBean] geronimo.deployment:role=DeploymentPlanner,type=EJBModule State changed from starting to running
          ...a lot of lines cut...
          [java] 22:41:12,258 INFO  [Geronimo] Started Server in 21s
       

      = Deploying EJB = org.apache.geronimo.kernel.deployment.scanner.DeploymentScanner is in charge of monitoring a specified set of directories and deploying files therein. It's configured in target/geronimo-DEV/etc/boot-service.xml.

    • Configuring EJB deployment directory Open target/geronimo-DEV/etc/boot-service.xml and change the first argument of the constructor tag so it contains a directory with your EJBs, say $
      Unknown macro: {geronimo.home}

      /ejbs. NOTE: $

      is the way to get at defined Java properties available for Geronimo at runtime. It's possible to use any Java property, so define your own in maven.xml and use it.
       <arg type="java.net.URL[]">${geronimo.home}/deploy/,${geronimo.home}/ejbs/</arg>

      It's also possible to use the default directory $

      Unknown macro: {geronimo.home}

      /deploy/_ or create another one beneath, e.g. _$

      /deploy/ejbs

    • There're two approaches to deploy a bean:
      • as UNPACKED_ARCHIVE (o.a.g.kernel.deployment.scanner.URLType.UNPACKED_ARCHIVE) - a directory with META-INF/MANIFEST.MF
      • as PACKED_ARCHIVE (o.a.g.kernel.deployment.scanner.URLType.PACKED_ARCHIVE) - a file with META-INF/MANIFEST.MF File extensions aren't important.
    • Two files are mandatory to have Geronimo (org.openejb.nova.deployment.EJBmoduleDeploymentPlanner, exactly) deploy an EJB:
      • META-INF/geronimo-ejb-jar.xml (XML Schema of geronimo-ejb-jar.xml)
      • META-INF/ejb-jar.xml They have a very similar XML structure, so creating a corresponding geronimo-ejb-jar.xml boils down to do the following steps:
    • copy ejb-jar.xml as geronimo-ejb-jar.xml
    • <entity>'s needs <datasource-name>'s, otherwise Geronimo emits the message:
          [java] java.lang.NullPointerException
          [java]      at org.openejb.nova.deployment.DeployCMPEntityContainer.perform(DeployCMPEntityContainer.java:111)
          [java]      at org.apache.geronimo.kernel.deployment.DeploymentPlan.execute(DeploymentPlan.java:107)
          [java]      at org.apache.geronimo.kernel.deployment.DeploymentController.executePlans(DeploymentController.java:270)
          [java]      at org.apache.geronimo.kernel.deployment.DeploymentController.executeJob(DeploymentController.java:194)
          [java]      at org.apache.geronimo.kernel.deployment.DeploymentController.access$200(DeploymentController.java:89)
          [java]      at org.apache.geronimo.kernel.deployment.DeploymentController$DeploymentWaiter.run(DeploymentController.java:324)
          [java]      at java.lang.Thread.run(Thread.java:534)
       

      It's because EJBModuleDeploymentPlanner creates schemaTask only when <datasource-name> is available. Unfortunatelly, planCMPEntity doesn't check whether or not schemaTask is null. It's not a big deal as Validator is expected to sort it out. NOTE: You can find a sample EJB at OpenEJB Hello World! page.

    • Start up Geronimo
    • Open up Geronimo web console (http://localhost:8080/geronimo-web-console) and enter geronimo.j2ee:* as a filter. The shown entries are beans that Geronimo has successfully deployed. = More details =

The process of deploying a bean (=use case) begins when o.a.g.kernel.deployment.scanner.DeploymentScanner (defined in /etc/boot-service.xml) is started up and monitoring a set of directories (defined in boot-service.xml file) at a defined in boot-service.xml file time interval. There're two available deployment scanners:

  • FileSystemScanner - it's in charge of handling file protocol
  • WebDAVScanner - it's in charge of handling http(s) protocol

FileSystemScanner (FSS) picks up a file and checks whether it's of *_ARCHIVE type. If it is, FSS adds the file to a list of deployments. It's visible on the console as:

  • <filename> added to the list of deployments

where <filename> is the name of the deployment (i.e. file or directory).

The list is handed over to EJBModuleDeploymentPlanner, which ensures that /META-INF/geronimo-ejb-jar.xml exists. If it doesn't the file is removed from the list of deployments (no message about it, though). The check of geronimo-ejb-jar.xml existence is hander over to DeploymentHelper that attempts to open up /META-INF/ejb-jar.xml file. If /META-INF/ejb-jar.xml doesn't exist, geronimo-ejb-jar.xml is assumed to not exist as well. If it does the file is processed and shown on the console as:

  • Planning the ejb module deployment <filename>

where <filename> is the name of the deployment (i.e. file or directory)

The next steps is shown on the console as:

  • Loading deployment descriptor <filename>

It's indication that EJBmodule is about to read /META-INF/geronimo-ejb-jar.xml. The file currently contains all the required information on the EJB.

When deployed it's shown as "geronimo.deployment:role=DeploymentUnitClassSpace,url=<filename>,type=EJBModule" MBean instance.