7 Replies Latest reply on Mar 31, 2011 10:13 AM by wdfink

    persistence-manager to use for 2.1 Entity Beans

    ymaraner

      I'm porting an Enterprise Application from WebSphere and WebLogic to JBoss AS 6. This contains EJB 2.1 CMP, SLSB, SFSB, and MDB.

      I am attempting to use the following container-configurations:

      "Standard Pessimistic CMP 2.x EntityBean"

      "Standard Stateless SessionBean"

       

      "Standard Stateful SessionBean"

      "Standard Message Driven Bean"

       

      However, when I do, I get the following Exception:

       

      16:48:35,771 ERROR [AbstractKernelController] Error installing to Create: name=jboss.j2ee:ear="XxxxJBossEAR.ear",module="xxx.jar",service=EjbModule state=Configured mode=Manual requiredState=Create: java.lang.ClassCastException: org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager cannot be cast to org.jboss.ejb.EntityPersistenceManager

      at org.jboss.ejb.EjbModule.createEntityContainer(EjbModule.java:758) [:6.0.0.Final]

      at org.jboss.ejb.EjbModule.createContainer(EjbModule.java:658) [:6.0.0.Final]

      at org.jboss.ejb.EjbModule.createService(EjbModule.java:400) [:6.0.0.Final]

      at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:323) [:6.0.0.Final (Build SVNTag:JBoss_6.0.0.Final date: 20101228)]

      at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:299) [:6.0.0.Final (Build SVNTag:JBoss_6.0.0.Final date: 20101228)]

      at sun.reflect.GeneratedMethodAccessor327.invoke(Unknown Source) [:1.6.0_20]

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_20]

      at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_20]

      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157) [:6.0.0.GA]

      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96) [:6.0.0.GA]

      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88) [:6.0.0.GA]

      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:271) [:6.0.0.GA]

      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:670) [:6.0.0.GA]

      at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:189) [:2.2.0.GA]

      at $Proxy41.create(Unknown Source) at org.jboss.system.microcontainer.CreateDestroyLifecycleAction.installAction(CreateDestroyLifecycleAction.java:54) [:2.2.0.GA]

      at org.jboss.system.microcontainer.CreateDestroyLifecycleAction.installAction(CreateDestroyLifecycleAction.java:42) [:2.2.0.GA]

      at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62) [jboss-dependency.jar:2.2.0.GA]

      at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71) [jboss-dependency.jar:2.2.0.GA]

      at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) [jboss-dependency.jar:2.2.0.GA]

      at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379) [jboss-dependency.jar:2.2.0.GA]

      at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:301) [:2.2.0.GA]

      at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044) [jboss-dependency.jar:2.2.0.GA]

      at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083) [jboss-dependency.jar:2.2.0.GA]

      at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322) [jboss-dependency.jar:2.2.0.GA]

      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246) [jboss-dependency.jar:2.2.0.GA]

      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139) [jboss-dependency.jar:2.2.0.GA]

      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:939) [jboss-dependency.jar:2.2.0.GA]

      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:654) [jboss-dependency.jar:2.2.0.GA]

      at org.jboss.system.ServiceController.doChange(ServiceController.java:671) [:6.0.0.Final (Build SVNTag:JBoss_6.0.0.Final date: 20101228)]

      at org.jboss.system.ServiceController.create(ServiceController.java:405) [:6.0.0.Final (Build SVNTag:JBoss_6.0.0.Final date: 20101228)]

      at org.jboss.system.ServiceController.create(ServiceController.java:370) [:6.0.0.Final (Build SVNTag:JBoss_6.0.0.Final date: 20101228)]

      at org.jboss.system.deployers.ServiceDeployer.create(ServiceDeployer.java:184) [:6.0.0.Final]

      at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:99) [:6.0.0.Final]

      at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:49) [:6.0.0.Final]

      at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62) [:2.2.0.GA]

      at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:55) [:2.2.0.GA]

      at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:179) [:2.2.0.GA]

      at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1832) [:2.2.0.GA]

      at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1550) [:2.2.0.GA]

      at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1571) [:2.2.0.GA]

      at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1603) [:2.2.0.GA]

      at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1491) [:2.2.0.GA]

      at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379) [jboss-dependency.jar:2.2.0.GA]

      at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044) [jboss-dependency.jar:2.2.0.GA]

      at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083) [jboss-dependency.jar:2.2.0.GA]

      at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322) [jboss-dependency.jar:2.2.0.GA]

      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246) [jboss-dependency.jar:2.2.0.GA]

      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139) [jboss-dependency.jar:2.2.0.GA]

      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:939) [jboss-dependency.jar:2.2.0.GA]

      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:654) [jboss-dependency.jar:2.2.0.GA]

      at org.jboss.deployers.plugins.deployers.DeployersImpl.change(DeployersImpl.java:1983) [:2.2.0.GA]

      at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:1076) [:2.2.0.GA]

      at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:679) [:2.2.0.GA]

      at org.jboss.system.server.profileservice.deployers.MainDeployerPlugin.process(MainDeployerPlugin.java:106) [:6.0.0.Final]

      at org.jboss.profileservice.dependency.ProfileControllerContext$DelegateDeployer.process(ProfileControllerContext.java:143) [:0.2.2]

      at org.jboss.profileservice.dependency.ProfileDeployAction.deploy(ProfileDeployAction.java:151) [:0.2.2]

      at org.jboss.profileservice.dependency.ProfileDeployAction.installActionInternal(ProfileDeployAction.java:94) [:0.2.2]

      at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54) [jboss-kernel.jar:2.2.0.GA]

      at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42) [jboss-kernel.jar:2.2.0.GA]

      at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62) [jboss-dependency.jar:2.2.0.GA]

      at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71) [jboss-dependency.jar:2.2.0.GA]

      at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) [jboss-dependency.jar:2.2.0.GA]

      at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379) [jboss-dependency.jar:2.2.0.GA]

      at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044) [jboss-dependency.jar:2.2.0.GA]

      at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083) [jboss-dependency.jar:2.2.0.GA]

      at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322) [jboss-dependency.jar:2.2.0.GA]

      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246) [jboss-dependency.jar:2.2.0.GA]

      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139) [jboss-dependency.jar:2.2.0.GA]

      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:939) [jboss-dependency.jar:2.2.0.GA]

      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:654) [jboss-dependency.jar:2.2.0.GA]

      at org.jboss.profileservice.dependency.ProfileActivationWrapper$BasicProfileActivation.start(ProfileActivationWrapper.java:190) [:0.2.2]

      at org.jboss.profileservice.dependency.ProfileActivationWrapper.start(ProfileActivationWrapper.java:87) [:0.2.2]

      at org.jboss.profileservice.dependency.ProfileActivationService.activateProfile(ProfileActivationService.java:215) [:0.2.2]

      at org.jboss.profileservice.dependency.ProfileActivationService.activate(ProfileActivationService.java:159) [:0.2.2]

      at org.jboss.profileservice.bootstrap.AbstractProfileServiceBootstrap.activate(AbstractProfileServiceBootstrap.java:112) [:0.2.2]

      at org.jboss.profileservice.resolver.BasicResolverFactory$ProfileResolverFacade.deploy(BasicResolverFactory.java:87) [:0.2.2]

      at org.jboss.profileservice.bootstrap.AbstractProfileServiceBootstrap.start(AbstractProfileServiceBootstrap.java:91) [:0.2.2]

      at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:132) [:6.0.0.Final]

      at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:56) [:6.0.0.Final]

      at org.jboss.bootstrap.impl.base.server.AbstractServer.startBootstraps(AbstractServer.java:827) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]

      at org.jboss.bootstrap.impl.base.server.AbstractServer$StartServerTask.run(AbstractServer.java:417) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]

      at java.lang.Thread.run(Thread.java:619) [:1.6.0_20]

       

      I've tried to extend the standard configurations to make my SLSB, SFSB, and MDB use:

      <persistence-manager>org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager</persistence-manager>

      But that doesn't seem to make any difference.

      Does anyone have any idea how to avoid this problem?

       

      Thanks,

       

      Tim

        • 1. persistence-manager to use for 2.1 Entity Beans
          wdfink

          It depends to your requirements what configuration you should use.

          If you try to cluster you should use the 'Cluster .....' configurations.

          I use my own configuration, a copy of the standard one, to have the ability to make changes only by configuration and not change XML or XDoclet annotations

           

          Also a change of a configuration is dangerous if you don't know exactly what you want (or expect).

          E.g. the 'Pessimistic CMP2.x' configuration is not good if you need a scalable appilication.

          The *cmp* package is to handle CMP and not session beans.

           

          So provide a bit more information about your requirements and expectations and you might get helpful hints here.

          • 2. persistence-manager to use for 2.1 Entity Beans
            ymaraner

            Yes, my particular requirements will determine which configuration(s) I should use. I assume that in the end I will need to extend the standard ones in order to tweak it to fit my requirements.

             

            My real question wasn't which configuration(s) to use or how to make them fit my requirements, it was:

            Why do I get "ClassCastException: org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager cannot be cast to org.jboss.ejb.EntityPersistenceManager" when I use a configuration that specifies JDBCStoreManager as the persistence-manager?

             

            Also, as long as we are on the subject of configurations, is there any documentation on proper selection of standard configurations for different scenerios (particularly for EJB 2.1 Session and MDBs)? I can't seem to find anything.

             

            Thanks,

            Tim

            • 3. persistence-manager to use for 2.1 Entity Beans
              wdfink

              The *cmp* package is to handle CMP and not session beans.

              As I wrote, I suppose that you change the interceptor chain of SLSB, SFSB anf MDB with the CMP entity manager:

               

              <persistence-manager>org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager</persistence-manager>

              and this will cause the problem.

               

              If you are try to use a cluster you should try 'Clustered ......' if not 'Standard ......' as your template or configuration without change for SFSB, SLSB and MDB.

               

              For CMP entities you must decide what locking behaviour do you want.

              With 'Pesimistic....' a entity is somthing like a singleton and locked as long as a transaction is running with this instance.

              'Instance per Tx' or 'cmp2_jdbc2' will create a instance per transaction without any physical lock, you have to ensure consistency by your self or use optimistic bean locking.

              Also a clustered (and remote) access to entities must be well-considered because of performance and locking behaviour!

               

              But you might ask within the 'persistence' forum for this ;-)

              • 4. persistence-manager to use for 2.1 Entity Beans
                ymaraner

                Ok, for the sake of simplicity, let's not worry about the details of the optimal configuration.

                As I wrote, I suppose that you change the interceptor chain of SLSB, SFSB anf MDB with the CMP entity manager:

                <persistence-manager>org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager</persistence-manager>

                and this will cause the problem.

                If I use the following container-configurations for the specified bean types:

                 

                • 2.1 CMP Entity Beans -> "Standard CMB 2.x EntityBean"
                • 2.1 Stateless Session Beans -> "Standard Stateless SessionBean"
                • 2.1 Stateful Session Beans -> "Standard Stateful SessionBean"
                • 2.1 Message Driven Beans -> "Standard Message Driven Bean"

                 

                I still get the ClassCastException "org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager cannot be cast to org.jboss.ejb.EntityPersistenceManager"

                 

                Do all beans in a single jar file need to use the same persistence manager? Do I need to separate out my Entity Beans from my Session Beans in different jar files within the EAR?

                • 5. persistence-manager to use for 2.1 Entity Beans
                  wdfink

                  No, I looked into my examples and there is a mix of SLSB,SFSB,MDB and Entities.

                  Only if you mix Entities with the different container (cmp2_jdbc2, InstancePerTx ....) it will not work.

                  We use separation of Beans only to structure the application but technical there is no need.

                   

                  I never tried EJB2 on JBoss6, but I suppose it will work as in JBoss5.

                  Do you change the configuration files standardjboss*.xmp or use the 6.0.0Final unchanced?

                  Are you able to deploy only a part of your app?

                  • 6. persistence-manager to use for 2.1 Entity Beans
                    ymaraner

                    Thank you for the information. Does that mean that all 2.1 CMP entities have to use the exact same configuration, since they cannot use annotations, or can I extend a common base configuration and modify things like min and max capacity and pool size on a bean-by-bean basis within the same jar?

                     

                    I don't remember what led me down the path of setting explicit container configurations, but I removed all of them from my beans and the default configuration chosen by JBoss seems to work. I will eventually need to set them explicitly, in order to optimize my system, but for now, I am just trying to get the application up and running.

                     

                    Is there an easy way to determine what default container-configurations JBoss is using when nothing is explicitely specified? I would like to be able to extend the defaults and specify only the items that I need to change.

                     

                    Thanks again,

                     

                    Tim

                    • 7. persistence-manager to use for 2.1 Entity Beans
                      wdfink

                      You can mix configurations, but you have to use the same <persistence-manager>, other things you can customize.

                       

                      As I mentionend, I always use a customized configuration for CMP beans, but it is only an alias or with customized cache sizes.

                      Reason for alias is that we group the beans, e.g. master-data(2.Level cache, mostly read), dynamic-data(cache only during Tx), and so on.

                       

                      ATM I can't remember where the default is specified , but as we use cluster we have to change the configuration anyhow.