4 Replies Latest reply on Sep 8, 2009 11:25 AM by Hussein Baghdadi

    Why I'm getting PermissionStore issue?

    Hussein Baghdadi Novice

      Hey,


      I got this exception as I'm trying to run a test:




          WARN  [org.jboss.seam.security.permission.PersistentPermissionResolver] no permission store available - please install a PermissionStore with the name 'org.jboss.seam.security.jpaPermissionStore' if persistent permissions are required.
           ERROR [org.jboss.seam.exception.Exceptions] handled and logged exception
           java.lang.IllegalStateException: Could not start transaction
                at org.jboss.seam.jsf.SeamPhaseListener.begin(SeamPhaseListener.java:598)
                at org.jboss.seam.jsf.SeamPhaseListener.begin(SeamPhaseListener.java:583)
                at org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsBeforePhase(SeamPhaseListener.java:327)
                at org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:144)
                at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:118)
                at org.jboss.seam.mock.AbstractSeamTest$Request.renderResponsePhase(AbstractSeamTest.java:615)
                at org.jboss.seam.mock.AbstractSeamTest$Request.emulateJsfLifecycle(AbstractSeamTest.java:608)
                at org.jboss.seam.mock.AbstractSeamTest$Request.access$100(AbstractSeamTest.java:177)
                at org.jboss.seam.mock.AbstractSeamTest$Request$2.doFilter(AbstractSeamTest.java:497)
                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
                at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
                at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:390)
                at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517)
                at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
                at org.jboss.seam.mock.AbstractSeamTest$Request.run(AbstractSeamTest.java:491)
                at sy.inet.smsbulksend.test.GroupManagerTest.testListGroups(GroupManagerTest.java:18)
                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:597)
                at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:604)
                at org.testng.internal.Invoker.invokeMethod(Invoker.java:470)
                at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:564)
                at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:830)
                at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
                at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
                at org.testng.TestRunner.runWorkers(TestRunner.java:678)
                at org.testng.TestRunner.privateRun(TestRunner.java:624)
                at org.testng.TestRunner.run(TestRunner.java:495)
                at org.testng.SuiteRunner.runTest(SuiteRunner.java:300)
                at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:295)
                at org.testng.SuiteRunner.privateRun(SuiteRunner.java:275)
                at org.testng.SuiteRunner.run(SuiteRunner.java:190)
                at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:792)
                at org.testng.TestNG.runSuitesLocally(TestNG.java:765)
                at org.testng.TestNG.run(TestNG.java:699)
                at org.testng.TestNG.privateMain(TestNG.java:824)
                at org.testng.TestNG.main(TestNG.java:802)
           Caused by: java.lang.IllegalStateException: A JTA EntityManager cannot use getTransaction()
                at org.hibernate.ejb.AbstractEntityManagerImpl.getTransaction(AbstractEntityManagerImpl.java:317)
                at org.jboss.seam.persistence.EntityManagerProxy.getTransaction(EntityManagerProxy.java:112)
                at org.hibernate.search.jpa.impl.FullTextEntityManagerImpl.getTransaction(FullTextEntityManagerImpl.java:166)
                at org.jboss.seam.persistence.EntityManagerProxy.getTransaction(EntityManagerProxy.java:112)
                at org.jboss.seam.transaction.EntityTransaction.getDelegate(EntityTransaction.java:62)
                at org.jboss.seam.transaction.EntityTransaction.begin(EntityTransaction.java:82)
                at org.jboss.seam.jsf.SeamPhaseListener.begin(SeamPhaseListener.java:593)
                ... 50 more





      Would you please enlight me what is going wrong?


      Thanks.

        • 1. Re: Why I'm getting PermissionStore issue?
          Joshua D Novice
          Not sure if this is the cause, but have you declared the following in your WEB-INF\components.xml

              <security:jpa-permission-store user-permission class="com.mycompany.model.UserPermission"/>
          • 2. Re: Why I'm getting PermissionStore issue?
            Christian Bauer Master

            Hussein Baghdadi wrote on Sep 07, 2009 15:57:


                WARN  [org.jboss.seam.security.permission.PersistentPermissionResolver] no permission store available - please install a PermissionStore with the name 'org.jboss.seam.security.jpaPermissionStore' if persistent permissions are required.
                 ERROR [org.jboss.seam.exception.Exceptions] handled and logged exception
            




            Those are two lines. The first line is a WARN message, which can be ignored. The second (and following) lines are a real ERROR. They have nothing to do with each other.

            • 3. Re: Why I'm getting PermissionStore issue?
              Coen Damen Novice

              The problem is that you have a JTA transaction manager, what you need is a JPA transaction manager.


              So for instance in components.xml at the EJB level (in META-INF)


              
              <persistence:managed-persistence-context name="entityManager"
                              auto-create="true"
                              persistence-unit-jndi-name="java:seamDemoEntityManagerFactory" />
              



              Then you need to reference this entityManagerFactory in the persistance.xml, so for instance:


               
              
              <persistence-unit name="COMICS">
                              <provider>org.hibernate.ejb.HibernatePersistence</provider>
                              <jta-data-source>java:seamdemoDatasource</jta-data-source>
                              <properties>
                                      <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />
                                      <property name="hibernate.hbm2ddl.auto" value="validate" />
                                      <property name="hibernate.show_sql" value="true" />
                                      <property name="hibernate.format_sql" value="true" />
                                      <property name="jboss.entity.manager.factory.jndi.name"
                                              value="java:seamdemoEntityManagerFactory" />
                                      <property name="hibernate.default_schema" value="COMICS" />
                                      <property name="hibernate.connection.url" value="jdbc:oracle:thin:@localhost:1521:XE" />
                                      <property name="hibernate.connection.driver_class" value="oracle.jdbc.OracleDriver" />
                                      <property name="hibernate.connection.username" value="comics" />
                                      <property name="hibernate.connection.password" value="comics" />
                              </properties>
                      </persistence-unit>
              
              



              If this does not work, can you post both your files. It might be that you have TRANSACTION RESOURCE LOCAL in your persistence.xml.


              Cheers,
              Coenos

              • 4. Re: Why I'm getting PermissionStore issue?
                Hussein Baghdadi Novice

                The issue is solved.


                A team mate doesn't modify persistence-test.xml to use RESOURCE LOCAL


                Would some one please explain to me what the warn message is and why I'm getting it?


                Thanks.