2 Replies Latest reply on Jul 16, 2002 6:35 AM by Franz Prilmeier

    BMP EJB Lifecycle Problem

    Franz Prilmeier Newbie

      Hello,

      I have some legacy EJB code which I do not want to change. It should run both on WebLogic and on JBoss (3.0). The problem is, EJBs in WebLogic have a slightly different Lifecycle than those in JBoss. The EJB code uses the value-object design pattern, where references between Entities are modelled by Collections between the value objects. That way, cached data may become inconsistent with the persistent reality.

      Example:
      1. Create Entity A
      2. Create Entity B of different kind (Different EJB class).
      3. Create reference between A and B
      4. Delete A.

      Result: B still has a reference to A.

      So I need a way to tell the container, that he must not cache those Entity Beans, but always call ejbLoad. The best way would be in the deployment descriptor, because it is a code and implementation independent way. In the volunteer documentation there is a section about container-configurations, but to be honest, I do not understand it and I cannot estimate if it is relevant for me. So can you please tell me what I have do to?

      Best Regards,
      Franz Prilmeier

        • 1. Re: BMP EJB Lifecycle Problem
          Horia Muntean Newbie

          Commit options B,C or D should do the trick. Those commit options are better explained in the EJB2.0 specs (in the specs are noted only A,B and C options) witch can be found at http://java.sun.com/products/ejb/docs.html#specs

          • 2. Re: BMP EJB Lifecycle Problem
            Franz Prilmeier Newbie

            Thanks, I will verify that.

            Actually I now have problems deploying the bean. I always recieve NullPointerExceptions.

            My jboss.xml is:

            <?xml version="1.0"?>
            <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.0//EN" "http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">

            <enterprise-beans>

            <ejb-name>ProcessPattern EJB</ejb-name>

            <jndi-name>ejb/Pattern</jndi-name>

            <configuration-name>Non Caching Configuration</configuration-name>

            <resource-ref>
            <res-ref-name>jdbc/lisaPool</res-ref-name>

            <jndi-name>java:/jdbc/lisadb</jndi-name>
            </resource-ref>

            </enterprise-beans>

            <resource-managers>
            </resource-managers>

            <container-configurations>
            <container-configuration>
            <container-name>Non Caching Configuration</container-name>

            <commit-option>C</commit-option>
            </container-configuration>
            </container-configurations>


            And the Exception I got during deployment:

            11:42:46,916 ERROR [MainDeployer] could not create deployment: njar:file:/C:/Pro
            gramme/Server/httpd/jboss-3.0.0/server/myserver/tmp/deploy/server/myserver/deplo
            y/lisa.ear/57.lisa.ear^/pattern.jar
            org.jboss.deployment.DeploymentException: Failed to load metadata; - nested thro
            wable: (java.lang.NullPointerException)
            at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:331)
            at org.jboss.deployment.MainDeployer.create(MainDeployer.java:637)
            at org.jboss.deployment.MainDeployer.create(MainDeployer.java:631)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:512)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:481)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
            java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
            sorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
            nDispatcher.java:284)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
            at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
            at $Proxy4.deploy(Unknown Source)
            at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymen
            tScanner.java:405)
            at org.jboss.deployment.scanner.URLDeploymentScanner.scanDirectory(URLDe
            ploymentScanner.java:586)
            at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentS
            canner.java:465)
            at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(A
            bstractDeploymentScanner.java:237)
            at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:1
            62)
            at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
            sorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
            nDispatcher.java:284)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
            at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceControl
            ler.java:894)
            at $Proxy0.start(Unknown Source)
            at org.jboss.system.ServiceController.start(ServiceController.java:340)
            at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
            sorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
            nDispatcher.java:284)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
            at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
            at $Proxy3.start(Unknown Source)
            at org.jboss.deployment.SARDeployer.start(SARDeployer.java:243)
            at org.jboss.deployment.MainDeployer.start(MainDeployer.java:678)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:513)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:481)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:465)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
            java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
            sorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
            nDispatcher.java:284)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
            at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:314)
            at org.jboss.system.server.ServerImpl.start(ServerImpl.java:216)
            at org.jboss.Main.boot(Main.java:142)
            at org.jboss.Main$1.run(Main.java:375)
            at java.lang.Thread.run(Thread.java:536)
            Caused by: java.lang.NullPointerException
            at org.jboss.metadata.ConfigurationMetaData.importJbossXml(Configuration
            MetaData.java:266)
            at org.jboss.metadata.ApplicationMetaData.importJbossXml(ApplicationMeta
            Data.java:489)
            at org.jboss.metadata.XmlFileLoader.load(XmlFileLoader.java:184)
            at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:326)
            ... 48 more

            So could you help me please.