5 Replies Latest reply on Sep 21, 2012 5:34 AM by wdfink

    No Persistence provider for EntityManager

    dheerajsega

      HI,
      I have tried to test my application using Testng methods.
      But my tests are failed and it returns the error::

      javax.persistence.PersistenceException: No Persistence provider for EntityManager named...

      Can anyone tell me why I am unable to test even when the persistence file is correct.

      How can I solve this?

        • 1. Re: No Persistence provider for EntityManager
          dheerajsega

          The entire errors that I got is :




          javax.persistence.PersistenceException: No Persistence provider for EntityManager named wingsEntityManagerFactory
          at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:41)
          at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:27)
          at AuthenticatorActionTest.init(AuthenticatorActionTest.java:65)
          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.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:529)
          at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:311)
          at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:149)
          at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:77)
          at org.testng.TestRunner.privateRun(TestRunner.java:614)
          at org.testng.TestRunner.run(TestRunner.java:505)
          at org.testng.SuiteRunner.privateRun(SuiteRunner.java:221)
          at org.testng.SuiteRunner.run(SuiteRunner.java:147)
          at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:576)
          at org.testng.TestNG.runSuitesLocally(TestNG.java:539)
          at org.testng.TestNG.run(TestNG.java:316)
          at org.testng.TestNG.privateMain(TestNG.java:666)
          at org.testng.TestNG.main(TestNG.java:608)

          AuthenticatorTest.testAuthenticator() 0

          javax.el.PropertyNotFoundException: ELResolver cannot handle a null base Object with identifier 'user'
          at com.sun.el.lang.ELSupport.throwUnhandled(ELSupport.java:52)
          at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:75)
          at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:195)
          at org.jboss.seam.util.UnifiedELValueBinding.getValue(UnifiedELValueBinding.java:34)
          at org.jboss.seam.core.Expressions$1.getValue(Expressions.java:69)
          at org.jboss.seam.core.Expressions.validate(Expressions.java:223)
          at org.jboss.seam.mock.SeamTest$Request.validateValue(SeamTest.java:383)
          at AuthenticatorTest$1.processValidations(AuthenticatorTest.java:42)
          at org.jboss.seam.mock.SeamTest$Request.run(SeamTest.java:465)
          at AuthenticatorTest.testAuthenticator(AuthenticatorTest.java:37)
          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.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:529)
          at org.testng.internal.Invoker.invokeMethod(Invoker.java:398)
          at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:625)
          at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:88)
          at org.testng.TestRunner.privateRun(TestRunner.java:614)
          at org.testng.TestRunner.run(TestRunner.java:505)
          at org.testng.SuiteRunner.privateRun(SuiteRunner.java:221)
          at org.testng.SuiteRunner.run(SuiteRunner.java:147)
          at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:576)
          at org.testng.TestNG.runSuitesLocally(TestNG.java:539)
          at org.testng.TestNG.run(TestNG.java:316)
          at org.testng.TestNG.privateMain(TestNG.java:666)
          at org.testng.TestNG.main(TestNG.java:608)

          • 2. Re: No Persistence provider for EntityManager
            dheerajsega

            When I gave correct persistence unit name ..the following errors occured..




            javax.persistence.PersistenceException: org.hibernate.HibernateException: Could not find datasource
            at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:217)
            at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:114)
            at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:37)
            at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:27)
            at
            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.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:529)
            at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:311)
            at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:149)
            at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:77)
            at org.testng.TestRunner.privateRun(TestRunner.java:614)
            at org.testng.TestRunner.run(TestRunner.java:505)
            at org.testng.SuiteRunner.privateRun(SuiteRunner.java:221)
            at org.testng.SuiteRunner.run(SuiteRunner.java:147)
            at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:576)
            at org.testng.TestNG.runSuitesLocally(TestNG.java:539)
            at org.testng.TestNG.run(TestNG.java:316)
            at org.testng.TestNG.privateMain(TestNG.java:666)
            at org.testng.TestNG.main(TestNG.java:608)
            Caused by: org.hibernate.HibernateException: Could not find datasource
            at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:56)
            at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
            at org.hibernate.ejb.InjectionSettingsFactory.createConnectionProvider(InjectionSettingsFactory.java:29)
            at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:61)
            at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1928)
            at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1211)
            at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:631)
            at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:760)
            at org.hibernate.ejb.Ejb3Configuration.createFactory(Ejb3Configuration.java:151)
            at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:205)
            ... 21 more
            Caused by: javax.naming.NamingException: Local server is not initialized
            at org.jnp.interfaces.LocalOnlyContextFactory.getInitialContext(LocalOnlyContextFactory.java:45)
            at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
            at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
            at javax.naming.InitialContext.init(InitialContext.java:223)
            at javax.naming.InitialContext.(InitialContext.java:175)
            at org.hibernate.util.NamingHelper.getInitialContext(NamingHelper.java:28)
            at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:52)
            ... 30 more




            javax.el.PropertyNotFoundException: ELResolver cannot handle a null base Object with identifier 'user'
            at com.sun.el.lang.ELSupport.throwUnhandled(ELSupport.java:52)
            at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:75)
            at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:195)
            at org.jboss.seam.util.UnifiedELValueBinding.getValue(UnifiedELValueBinding.java:34)
            at org.jboss.seam.core.Expressions$1.getValue(Expressions.java:69)
            at org.jboss.seam.core.Expressions.validate(Expressions.java:223)
            at org.jboss.seam.mock.SeamTest$Request.validateValue(SeamTest.java:383)
            at AuthenticatorTest$1.processValidations(AuthenticatorTest.java:42)
            at org.jboss.seam.mock.SeamTest$Request.run(SeamTest.java:465)
            at
            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.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:529)
            at org.testng.internal.Invoker.invokeMethod(Invoker.java:398)
            at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:625)
            at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:88)
            at org.testng.TestRunner.privateRun(TestRunner.java:614)
            at org.testng.TestRunner.run(TestRunner.java:505)
            at org.testng.SuiteRunner.privateRun(SuiteRunner.java:221)
            at org.testng.SuiteRunner.run(SuiteRunner.java:147)
            at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:576)
            at org.testng.TestNG.runSuitesLocally(TestNG.java:539)
            at org.testng.TestNG.run(TestNG.java:316)
            at org.testng.TestNG.privateMain(TestNG.java:666)
            at org.testng.TestNG.main(TestNG.java:608)

            • 3. Re: No Persistence provider for EntityManager
              dheerajsega

              Hi, I was able to fix it..
              Thanks

              • 4. Re: No Persistence provider for EntityManager
                loaone

                Hello

                 

                How did u solve the problem of the persistence??

                 

                 

                Thanx

                • 5. Re: No Persistence provider for EntityManager
                  wdfink

                  Hi Loaone,

                  I suppose you will not get an answer if you recycle such old thread. Maybe your JBoss version and environment is also very different.

                  You should open a new thread and provide informations about your problem.