9 Replies Latest reply on Oct 22, 2010 2:21 AM by jaikiran pai

    Extended PC during persistence context must be n sfsb?

    Elhanan Maayan Novice

      hi.

       

      even though the pc is in a class marked as statefull and SessionScoped , i i still get this runtime exception. why is that?

        • 1. Re: Extended PC during persistence context must be n sfsb?
          Wolf-Dieter Fink Master

          Could you please give a bit more information?

           

          Environment?

          Do you run in a EJB or Servlet container?

          How do you use the persistence context?

          What kind of RuntimeExceptions?

          • 2. Re: Extended PC during persistence context must be n sfsb?
            Elhanan Maayan Novice

            enviorment is jboss 6 m5

             

            the PC is placed as memeber field and annotated annotated as PersistenceContext(Extended)

            the class that contains is is annotated as @Statull @SessionScoped

            the exception is like so:

             

            2010-10-19 10:31:50,305 ERROR [org.jboss.web.tomcat.service.deployers.TomcatDeployment] (HDScanner) ENC setup failed: java.lang.RuntimeException: It is illegal to inject an EXTENDED PC into something other than a SFSB

                at org.jboss.injection.PcEncInjector.inject(PcEncInjector.java:90) [:1.5.1]

                at org.jboss.web.tomcat.service.TomcatInjectionContainer.populateEnc(TomcatInjectionContainer.java:513) [:6.0.0.20100911-M5]

                at org.jboss.web.tomcat.service.deployers.TomcatDeployment$EncListener.lifecycleEvent(TomcatDeployment.java:427) [:6.0.0.20100911-M5]

                at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:115) [:6.0.0.20100911-M5]

                at org.apache.catalina.core.StandardContext.start(StandardContext.java:3823) [:6.0.0.20100911-M5]

                at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:299) [:6.0.0.20100911-M5]

                at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:138) [:6.0.0.20100911-M5]

                at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461) [:6.0.0.20100911-M5]

                at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118) [:6.0.0.20100911-M5]

                at org.jboss.web.deployers.WebModule.start(WebModule.java:95) [:6.0.0.20100911-M5]

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_20]

                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [: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.Beta5]

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

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

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

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

                at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206) [:2.2.0.Alpha10]

                at $Proxy41.start(Unknown Source)    at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:53) [:2.2.0.Alpha10]

                at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:41) [:2.2.0.Alpha10]

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

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

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

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

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

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

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

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

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

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

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

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

                at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:182) [:2.2.0.Alpha7]

                at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:58) [:2.2.0.Alpha7]

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                at org.jboss.system.server.profileservice.deployers.MainDeployerPlugin.process(MainDeployerPlugin.java:106) [:6.0.0.20100911-M5]

                at org.jboss.profileservice.dependency.ProfileControllerContext$DelegateDeployer.process(ProfileControllerContext.java:130) [:0.1.0.Alpha1]

                at org.jboss.profileservice.deployment.hotdeploy.HDScanner$HDScanAction.deploy(HDScanner.java:240) [:0.1.0.Alpha1]

                at org.jboss.profileservice.deployment.hotdeploy.HDScanner$HDScanAction.complete(HDScanner.java:192) [:0.1.0.Alpha1]

                at org.jboss.profileservice.management.TwoPCActionWrapper.doComplete(TwoPCActionWrapper.java:59) [:0.1.0.Alpha1]

                at org.jboss.profileservice.management.actions.AbstractTwoPhaseModificationAction.complete(AbstractTwoPhaseModificationAction.java:74) [:0.1.0.Alpha1]

                at org.jboss.profileservice.management.actions.AbstractTwoPhaseModificationAction.prepare(AbstractTwoPhaseModificationAction.java:94) [:0.1.0.Alpha1]

                at org.jboss.profileservice.management.ModificationSession.prepare(ModificationSession.java:87) [:0.1.0.Alpha1]

                at org.jboss.profileservice.management.AbstractActionController.internalPerfom(AbstractActionController.java:234) [:0.1.0.Alpha1]

                at org.jboss.profileservice.management.AbstractActionController.performWrite(AbstractActionController.java:213) [:0.1.0.Alpha1]

                at org.jboss.profileservice.management.AbstractActionController.perform(AbstractActionController.java:150) [:0.1.0.Alpha1]

                at org.jboss.profileservice.management.AbstractActionController.perform(AbstractActionController.java:135) [:0.1.0.Alpha1]

                at org.jboss.profileservice.deployment.hotdeploy.HDScanner.scan(HDScanner.java:146) [:0.1.0.Alpha1]

                at org.jboss.profileservice.deployment.hotdeploy.HDScanner.run(HDScanner.java:90) [:0.1.0.Alpha1]

                at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [:1.6.0_20]

                at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317) [:1.6.0_20]

                at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150) [:1.6.0_20]

                at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98) [:1.6.0_20]

                at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181) [:1.6.0_20]

                at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205) [:1.6.0_20]

                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_20]

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_20]

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

            • 3. Re: Extended PC during persistence context must be n sfsb?
              Wolf-Dieter Fink Master

              As I'm right, your pc is a member of a stateless session bean and you add the extended annotation.

              This mean the context existst longer that a method call wich is illegal for a SLSB.

               

              If the pc is annotated without and your method id annotated with Transaction.REQUIRED the pc live as long as your method run.

              In case of NO_Tx the entity can only used as detached.

              • 4. Re: Extended PC during persistence context must be n sfsb?
                Elhanan Maayan Novice

                so you are saying if i drop the annotation of Extended, and pc will live as slong as the stafull session?

                so when do i u se the extended scope?

                • 5. Re: Extended PC during persistence context must be n sfsb?
                  Wolf-Dieter Fink Master

                  No,

                  I suppose that you are using something other than a statefull session bean because of the message

                  'It is illegal to inject an EXTENDED PC into something other than a SFSB'

                  • 7. Re: Extended PC during persistence context must be n sfsb?
                    Wolf-Dieter Fink Master

                    IMHO there are two options

                    1) if you do not need a status or the data between two requests use the pc without the extended mode.

                    2) If you need a status or the entities from previous servlet call cover the code with the extended pc in an EJB as stateful session bean

                    • 8. Re: Extended PC during persistence context must be n sfsb?
                      Elhanan Maayan Novice

                      that's exacltly what i did:

                       

                      @Statefull

                      @ScopedSession,

                      PersonDao{

                       

                      @PersistenceContext{Exteneded

                      ..

                      }

                       

                      being called from a servlet  likeso

                       

                      @Ejb PersonDao dao;

                      • 9. Re: Extended PC during persistence context must be n sfsb?
                        jaikiran pai Master

                        Elhanan Maayan wrote:

                         

                        that's exacltly what i did:

                         

                        @Statefull

                        Looking at one of your earlier post, I thought you had a typo while posting that annotation. But you keep repeating the same @Statefull annotation in your posts. Is that really the annotation that you are using? If yes, then it's incorrect. The correct one is @javax.ejb.Stateful (Note the single l)