2 Replies Latest reply on Jan 1, 2011 10:36 AM by Sakari Isoniemi

    ENC setup failed, NullPointerException

    Vinit Adhopia Newbie
      I am trying to deploy a seam-gen generated app and am running into some issues.  I am using JBoss AS 5.1 and Seam 2.2.0.

      I run seam setup and then seam generate-entities to generate a starter site (*.war) based off the tables in a mysql database.  Right after generating the site, I startup JBoss and deploy the site with seam explode and it deploys just fine.

      I then bring down JBoss and import the project into eclipse.  From Eclipse, when I try to publish the site, JBoss gives me the stacktrace found below.  Some googling suggests there is a problem with how the persistence unit is defined, but I haven't touched it since generation.  What am I missing here?

      JBoss Stacktrace:

      |17:34:43,571 INFO  [TomcatDeployment] deploy, ctxPath=/SustainingDashboard
      17:34:43,703 ERROR [TomcatDeployment] ENC setup failed
      java.lang.NullPointerException
           at org.jboss.injection.PersistenceUnitHandler.getEntityManagerFactory(PersistenceUnitHandler.java:172)
           at org.jboss.injection.PersistenceUnitHandler.getFactory(PersistenceUnitHandler.java:163)
           at org.jboss.injection.PuEncInjector.inject(PuEncInjector.java:54)
           at org.jboss.web.tomcat.service.TomcatInjectionContainer.populateEnc(TomcatInjectionContainer.java:482)
           at org.jboss.web.tomcat.service.deployers.TomcatDeployment$EncListener.lifecycleEvent(TomcatDeployment.java:471)
           at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
           at org.apache.catalina.core.StandardContext.start(StandardContext.java:4388)
           at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:310)
           at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:142)
           at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461)
           at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118)
           at org.jboss.web.deployers.WebModule.start(WebModule.java:97)
           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:592)
           at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
           at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
           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:668)
           at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)
           at $Proxy38.start(Unknown Source)
           at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42)
           at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37)
           at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
           at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
           at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
           at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
           at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:286)
           at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
           at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
           at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
           at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
           at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
           at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
           at org.jboss.system.ServiceController.doChange(ServiceController.java:688)
           at org.jboss.system.ServiceController.start(ServiceController.java:460)
           at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:163)
           at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:99)
           at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)
           at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
           at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
           at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
           at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
           at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
           at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1178)
           at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
           at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
           at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
           at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
           at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
           at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
           at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
           at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
           at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
           at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
           at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
           at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:362)
           at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:255)
           at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
           at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:280)
           at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:135)
           at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:65)
           at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:146)
           at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:170)
           at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)
           at java.lang.Thread.run(Thread.java:595)
      17:34:43,713 ERROR [AbstractKernelController] Error installing to Start: name=jboss.web.deployment:war=/SustainingDashboard state=Create mode=Manual requiredState=Installed
      org.jboss.deployers.spi.DeploymentException: URL file:/home/vinit/jboss-5.1.0.GA/server/default/tmp/3j011-7glat2-ggpnc3zh-1-ggpndy60-9o/SustainingDashboard.war/ deployment failed
           at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
           at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:316)
           at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:142)
           at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461)
           at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118)
           at org.jboss.web.deployers.WebModule.start(WebModule.java:97)
           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:592)
           at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
           at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
           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:668)
           at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)
           at $Proxy38.start(Unknown Source)
           at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42)
           at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37)
           at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
           at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
           at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
           at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
           at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:286)
           at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
           at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
           at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
           at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
           at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
           at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
           at org.jboss.system.ServiceController.doChange(ServiceController.java:688)
           at org.jboss.system.ServiceController.start(ServiceController.java:460)
           at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:163)
           at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:99)
           at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)
           at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
           at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
           at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
           at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
           at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
           at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1178)
           at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
           at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
           at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
           at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
           at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
           at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
           at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
           at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
           at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
           at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
           at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
           at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:362)
           at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:255)
           at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
           at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:280)
           at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:135)
           at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:65)
           at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:146)
           at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:170)
           at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)
           at java.lang.Thread.run(Thread.java:595)
      Caused by: java.lang.RuntimeException: java.lang.NullPointerException
           at org.jboss.web.tomcat.service.deployers.TomcatDeployment$EncListener.lifecycleEvent(TomcatDeployment.java:483)
           at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
           at org.apache.catalina.core.StandardContext.start(StandardContext.java:4388)
           at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:310)
           ... 61 more
      Caused by: java.lang.NullPointerException
           at org.jboss.injection.PersistenceUnitHandler.getEntityManagerFactory(PersistenceUnitHandler.java:172)
           at org.jboss.injection.PersistenceUnitHandler.getFactory(PersistenceUnitHandler.java:163)
           at org.jboss.injection.PuEncInjector.inject(PuEncInjector.java:54)
           at org.jboss.web.tomcat.service.TomcatInjectionContainer.populateEnc(TomcatInjectionContainer.java:482)
           at org.jboss.web.tomcat.service.deployers.TomcatDeployment$EncListener.lifecycleEvent(TomcatDeployment.java:471)
           ... 64 more
      |

      /resources/META-INF/persistence-dev.xml

      |<?xml version="1.0" encoding="UTF-8"?>
      <!-- Persistence deployment descriptor for dev profile -->
      <persistence xmlns="http://java.sun.com/xml/ns/persistence"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
                   version="1.0">
                  
         <persistence-unit name="SustainingDashboard" transaction-type="JTA">
            <provider>org.hibernate.ejb.HibernatePersistence</provider>
            <jta-data-source>SustainingDashboardDatasource</jta-data-source>
            <properties>
               <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
               <property name="hibernate.hbm2ddl.auto" value="update"/>
               <property name="hibernate.show_sql" value="true"/>
               <property name="hibernate.format_sql" value="true"/>
               <!-- Only relevant if Seam is loading the persistence unit (Java SE bootstrap) -->
               <property name="hibernate.transaction.manager_lookup_class" value="@transactionManagerLookupClass@"/>
            </properties>
         </persistence-unit>
         
      </persistence>
      |

      /resources/SustainingDashboard-dev-ds.xml  (db username and password removed)

      |<?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE datasources
          PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN"
          "http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">
      <datasources>
        
         <local-tx-datasource>
            <jndi-name>SustainingDashboardDatasource</jndi-name>
            <use-java-context>false</use-java-context>
            <connection-url>jdbc:mysql:///sustaining</connection-url>
            <driver-class>com.mysql.jdbc.Driver</driver-class>
            <user-name>*****</user-name>
            <password>*****</password>
         </local-tx-datasource>
         
      </datasources>
      |
        • 1. Re: ENC setup failed, NullPointerException
          Sakari Isoniemi Newbie

                    I have this same error with Seam 2.2.1.CR2, JBoss AS 5.1.0.GA, derby 10.5.3.0
                    Application is generated with seam-gen with 'ear' mode ( .war , .jar )

                    
          2010-12-30 20:04:54,994 INFO  [org.jboss.web.tomcat.service.deployers.TomcatDeployment] (ResourceContainer.invoker.nonDaemon-2) deploy, ctxPath=/ElectrWireGen2
          2010-12-30 20:04:55,103 ERROR [org.jboss.web.tomcat.service.deployers.TomcatDeployment] (ResourceContainer.invoker.nonDaemon-2) ENC setup failed
          java.lang.NullPointerException
                         at org.jboss.injection.PersistenceUnitHandler.getEntityManagerFactory(PersistenceUnitHandler.java:172)
                         at org.jboss.injection.PersistenceUnitHandler.getFactory(PersistenceUnitHandler.java:163)
                         at org.jboss.injection.PuEncInjector.inject(PuEncInjector.java:54)
                         at org.jboss.web.tomcat.service.TomcatInjectionContainer.populateEnc(TomcatInjectionContainer.java:482)
                         at org.jboss.web.tomcat.service.deployers.TomcatDeployment$EncListener.lifecycleEvent(TomcatDeployment.java:471)
                         at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
                         at org.apache.catalina.core.StandardContext.start(StandardContext.java:4388) at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:310)
          at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:142)



          Persistence.xml is
                    
                         <?xml version="1.0" encoding="UTF-8"?>
                         <!-- Persistence deployment descriptor for dev profile -->
                         <persistence xmlns="http://java.sun.com/xml/ns/persistence"
                                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence  http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
                                   version="1.0">

                            <persistence-unit name="ElectrWireGen2">
                               <provider>org.hibernate.ejb.HibernatePersistence</provider>
                               <jta-data-source>ElectrWireGen2Datasource</jta-data-source>
                               <!-- The <jar-file> element is necessary if you put the persistence.xml in the WAR and the classes in the JAR -->
                               <!--
                               <jar-file>../../vehicles.jar</jar-file>
                               -->
                               <properties>
                               <property name="hibernate.dialect" value="org.hibernate.dialect.DerbyDialect"/>
                               <property name="hibernate.hbm2ddl.auto" value="update"/>
                               <property name="hibernate.show_sql" value="true"/>
                               <property name="hibernate.format_sql" value="true"/>
                               <property name="jboss.entity.manager.factory.jndi.name" value="java:/ElectrWireGen2EntityManagerFactory"/>
                               </properties>
                            </persistence-unit>

                         </persistence>
          • 2. Re: ENC setup failed, NullPointerException
            Sakari Isoniemi Newbie

            Hi


            My problem is solved:


            The cause was a micmatch in database related configurations.


            See ticket
            http://community.jboss.org/thread/72555