5 Replies Latest reply on May 28, 2008 3:17 PM by gjeudy

    Seam 2.0.1 and persistence:filters not working

    gjeudy

      Hi,


      I tried using the persistence:filter feature in components.xml as follows:


      
      <persistence:filter name="previousVersion">
      
                <persistence:name>previousVersionDiffRows</persistence:name>
      
                <persistence:parameters>
      
                     <key>workspaceSavepointCombo</key>
      
                     <value>LIVE, LATEST</value> <!-- could stick a value expression here instead -->
      
                </persistence:parameters>
      
           </persistence:filter>
      
      
           <persistence:managed-persistence-context name="entityManager" auto-create="true"
      
                persistence-unit-jndi-name="java:/rdmEntityManagerFactory">
      
                <persistence:filters>
      
                     <value>#{previousVersion}</value>
      
                </persistence:filters>
      
           </persistence:managed-persistence-context>
      
      



      I get the below exception as startup:


      2008-05-14 17:42:09,846 INFO  [org.jboss.seam.Component] Component: previousVersion, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.persistence.Filter
      
      2008-05-14 17:42:09,846 DEBUG [org.jboss.seam.Component] previousVersion.name=previousVersionDiffRows
      
      2008-05-14 17:42:09,846 DEBUG [org.jboss.seam.Component] previousVersion.parameters={workspaceSavepointCombo=LIVE, LATEST}
      
      2008-05-14 17:42:09,846 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/ReferenceDataManager]] Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener
      
      java.lang.RuntimeException: Could not create Component: previousVersion
      
           at org.jboss.seam.init.Initialization.addComponent(Initialization.java:976)
      
           at org.jboss.seam.init.Initialization.installComponents(Initialization.java:898)
      
           at org.jboss.seam.init.Initialization.init(Initialization.java:576)
      
           at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:34)
      
           at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3856)
      
           at org.apache.catalina.core.StandardContext.start(StandardContext.java:4361)
      
           at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:790)
      
           at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:770)
      
           at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:553)
      
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      
           at java.lang.reflect.Method.invoke(Method.java:585)
      
           at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:296)
      
           at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
      
           at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      
           at org.apache.catalina.core.StandardContext.init(StandardContext.java:5312)
      
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      
           at java.lang.reflect.Method.invoke(Method.java:585)
      
           at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:296)
      
           at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
      
           at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      
           at org.jboss.web.tomcat.service.TomcatDeployer.performDeployInternal(TomcatDeployer.java:301)
      
           at org.jboss.web.tomcat.service.TomcatDeployer.performDeploy(TomcatDeployer.java:104)
      
           at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:375)
      
           at org.jboss.web.WebModule.startModule(WebModule.java:83)
      
           at org.jboss.web.WebModule.startService(WebModule.java:61)
      
           at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
      
           at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
      
           at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
      
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      
           at java.lang.reflect.Method.invoke(Method.java:585)
      
           at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      
           at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      
           at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      
           at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      
           at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
      
           at $Proxy0.start(Unknown Source)
      
           at org.jboss.system.ServiceController.start(ServiceController.java:417)
      
           at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
      
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      
           at java.lang.reflect.Method.invoke(Method.java:585)
      
           at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      
           at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      
           at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      
           at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      
           at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
      
           at $Proxy54.start(Unknown Source)
      
           at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:466)
      
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      
           at java.lang.reflect.Method.invoke(Method.java:585)
      
           at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      
           at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      
           at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
      
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      
           at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
      
           at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
      
           at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
      
           at org.jboss.wsf.container.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:87)
      
           at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
      
           at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
      
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      
           at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      
           at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      
           at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
      
           at $Proxy55.start(Unknown Source)
      
           at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
      
           at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1015)
      
           at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
      
           at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
      
           at sun.reflect.GeneratedMethodAccessor30.invoke(Unknown Source)
      
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      
           at java.lang.reflect.Method.invoke(Method.java:585)
      
           at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      
           at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      
           at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
      
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      
           at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
      
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      
           at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      
           at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      
           at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
      
           at $Proxy10.deploy(Unknown Source)
      
           at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
      
           at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
      
           at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
      
           at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
      
           at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
      
           at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
      
           at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
      
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      
           at java.lang.reflect.Method.invoke(Method.java:585)
      
           at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      
           at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      
           at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      
           at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      
           at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
      
           at $Proxy0.start(Unknown Source)
      
           at org.jboss.system.ServiceController.start(ServiceController.java:417)
      
           at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
      
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      
           at java.lang.reflect.Method.invoke(Method.java:585)
      
           at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      
           at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      
           at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      
           at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      
           at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
      
           at $Proxy4.start(Unknown Source)
      
           at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
      
           at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
      
           at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
      
           at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
      
           at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
      
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      
           at java.lang.reflect.Method.invoke(Method.java:585)
      
           at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      
           at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      
           at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
      
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      
           at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
      
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      
           at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      
           at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      
           at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
      
           at $Proxy5.deploy(Unknown Source)
      
           at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
      
           at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
      
           at org.jboss.Main.boot(Main.java:200)
      
           at org.jboss.Main$1.run(Main.java:508)
      
           at java.lang.Thread.run(Thread.java:595)
      
      Caused by: java.lang.IllegalArgumentException: No converter for type: org.jboss.seam.core.Expressions$ValueExpression
      
           at org.jboss.seam.util.Conversions.getConverter(Conversions.java:61)
      
           at org.jboss.seam.Component$ConstantInitialValue.<init>(Component.java:2310)
      
           at org.jboss.seam.Component.getInitialValue(Component.java:515)
      
           at org.jboss.seam.Component.access$200(Component.java:139)
      
           at org.jboss.seam.Component$MapInitialValue.<init>(Component.java:2462)
      
           at org.jboss.seam.Component.getInitialValue(Component.java:511)
      
           at org.jboss.seam.Component.getTopInitialValue(Component.java:495)
      
           at org.jboss.seam.Component.initInitializers(Component.java:473)
      
           at org.jboss.seam.Component.<init>(Component.java:264)
      
           at org.jboss.seam.Component.<init>(Component.java:217)
      
           at org.jboss.seam.init.Initialization.addComponent(Initialization.java:961)
      
           ... 139 more



      Did I do something wrong or is this feature broken? Besides the core:filters element doesnt seem to exist even though thats the one advertised in the seam documentation.


      Please advise,
      -Guillaume

        • 1. Re: Seam 2.0.1 and persistence:filters not working
          pmuir

          Make the filter parameter value a ValueExpression



          Besides the core:filters element doesnt seem to exist even though thats the one advertised in the seam documentation.

          Please file a JIRA task, detailing where you saw this and we can update the docs.

          • 2. Re: Seam 2.0.1 and persistence:filters not working
            gjeudy

            Here's the JIRA for the doc fix: JBSEAM-3001


            I tried your suggestion but I still get the exact same exception.


            Here's the new config snippet:


            <persistence:filter name="previousVersion">
            
                      <persistence:name>previousVersionDiffRows</persistence:name>
            
                      <persistence:parameters>
            
                           <key>workspaceSavepointCombo</key>
            
                           <value>#{relPkg.parentWorkspaceSavepointCombo}</value>
            
                      </persistence:parameters>
            
                 </persistence:filter>
            
            
                 <persistence:managed-persistence-context name="entityManager" auto-create="true"
            
                      persistence-unit-jndi-name="java:/rdmEntityManagerFactory">
            
                      <persistence:filters>
            
                           <value>#{previousVersion}</value>
            
                      </persistence:filters>  
            
                 </persistence:managed-persistence-context>


            • 3. Re: Seam 2.0.1 and persistence:filters not working
              gjeudy

              Has anybody got the persistence:filter feature working? Making the filter value a ValueExpression didn't solve the problem.


              Should I file a JIRA ? This feature appears broken to me at least in Seam 2.0.1 GA and I dont see anything in the changelogs of Seam 2.0.2 GA relating to this.


              Thank you,
              -Guillaume

              • 4. Re: Seam 2.0.1 and persistence:filters not working
                pmuir

                Yeah, please file a JIRA issue, with exact instructions to reproduce - something is going a bit wrong here.


                Take a look at the wiki example for slightly different syntax which does work...

                • 5. Re: Seam 2.0.1 and persistence:filters not working
                  gjeudy

                  I just retested the same example from my 15. May 2008, 15:31 post and now it works. I'm puzzled I must have done something wrong when I tested back then.


                  Sorry for taking up your time, there's no issue here.


                  Putting a valueexpression in persistence:parameters/value did fix the problem. It would be nice to allow a string literal instead of a valueexpression in there.


                  Now you would ask me why I use a filter if I always use the same value. This is because my hibernate mappings file are re-used in other contexts that are not the seam app, however in seam context the filter value is always the same.


                  Thank you,
                  -Guillaume