8 Replies Latest reply on Sep 21, 2005 6:00 AM by Emmanuel Bernard

    When deploying I get NullPointerException at org.hibernate.m

    Patrik Björling Rygert Newbie

      I have an EJB3 application that worked fine on 4.0.3RC1, but now it fails to deploy on 4.0.3RC2+EJB3RC1.

      Does anybody know what the problem is? What should I look for? As usual JBoss doesn't tell me in what bean the problem is...

      I get the following stack trace:

      java.lang.NullPointerException
       at org.hibernate.mapping.UniqueKey.sqlConstraintString(UniqueKey.java:20)
       at org.hibernate.mapping.Table.sqlCreateString(Table.java:334)
       at org.hibernate.cfg.Configuration.generateSchemaCreationScript(Configuration.java:686)
       at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:66)
       at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:296)
       at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1033)
       at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:439)
       at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:272)
       at org.jboss.ejb3.Ejb3Deployment.initializeManagedEntityManagerFactory(Ejb3Deployment.java:476)
       at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:219)
       at org.jboss.ejb3.Ejb3Module.createService(Ejb3Module.java:34)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:252)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:234)
       at sun.reflect.GeneratedMethodAccessor2.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:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:974)
       at $Proxy0.create(Unknown Source)
       at org.jboss.system.ServiceController.create(ServiceController.java:356)
       at org.jboss.system.ServiceController.create(ServiceController.java:295)
       at sun.reflect.GeneratedMethodAccessor4.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:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
       at $Proxy17.create(Unknown Source)
       at org.jboss.ejb3.EJB3Deployer.create(EJB3Deployer.java:178)
       at org.jboss.deployment.MainDeployer.create(MainDeployer.java:919)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:773)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:737)
       at sun.reflect.GeneratedMethodAccessor16.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:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
       at $Proxy9.deploy(Unknown Source)
       at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:319)
       at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:507)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:192)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:203)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:182)


        • 1. Re: When deploying I get NullPointerException at org.hiberna
          Patrik Björling Rygert Newbie

          After some research by commenting all possible places that can cause the problem, I found out that the root of the problem is this construct:

          @Entity
          @Table(name = "ATZ_DYNAMIC_TERM", uniqueConstraints = {
           @UniqueConstraint(columnNames = {
           "STATIC_TERM_NAME", "NAME"
           })
          })


          The problem was that in RC1 I could use the column names in lower case, in RC2 they have to have the same case as the actual table columns (i.e. "STATIC_TERM_NAME" and "NAME")

          /Patrik

          • 3. Re: When deploying I get NullPointerException at org.hiberna
            Jiri Frydek Newbie

            I'm using JBoss 4.0.2 and I dowlod all latest versions of hibernate (hibernate 3.1 beta3, hibernate-annotations 3.1 beta 5 and hibernate entity manager 3.1. beta3) and after deploy I see NullPointerException too. In what version is fixed this error? Or is fixed only in CVS?

            Thx.

            Jefec

            • 4. Re: When deploying I get NullPointerException at org.hiberna
              Emmanuel Bernard Master

              This should have been fixed in HA 3.1beta5. Are you sure there is still a NPE?

              • 5. Re: When deploying I get NullPointerException at org.hiberna
                Jiri Frydek Newbie

                Yes, I get following error:

                java.lang.NullPointerException
                 at org.hibernate.mapping.UniqueKey.sqlConstraintString(UniqueKey.java:20)
                 at org.hibernate.mapping.Table.sqlCreateString(Table.java:386)
                 at org.hibernate.cfg.Configuration.generateSchemaCreationScript(Configuration.java:712)
                 at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:75)
                 at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:299)
                 at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1127)
                 at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:358)
                 at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:484)
                 at org.hibernate.ejb.Ejb3Configuration.createContainerEntityManagerFactory(Ejb3Configuration.java:202)
                 at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:78)
                 at org.jboss.ejb3.Ejb3Deployment.initializeManagedEntityManagerFactory(Ejb3Deployment.java:476)
                 at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:219)
                 at org.jboss.ejb3.Ejb3Module.createService(Ejb3Module.java:34)
                 at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:238)
                 at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:220)
                 at sun.reflect.GeneratedMethodAccessor2.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:141)
                 at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
                 at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
                 at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
                 at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
                 at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:897)
                 at $Proxy0.create(Unknown Source)
                 at org.jboss.system.ServiceController.create(ServiceController.java:330)
                 at org.jboss.system.ServiceController.create(ServiceController.java:275)
                 at sun.reflect.GeneratedMethodAccessor4.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:141)
                 at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
                 at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
                 at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
                 at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
                 at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
                


                if in my EJB is following:
                @Entity
                @Table(name="award_category_name_l10n",
                 uniqueConstraints={
                 @UniqueConstraint(columnNames={"award_category_id", "language_id"})
                 }
                )
                public class AwardCategoryNameL10n extends AwardCategoryL10n { .. }
                

                , where language_id is attribute from superclass AwardCategoryL10n.

                Thx.

                Jefec

                • 6. Re: When deploying I get NullPointerException at org.hiberna
                  Emmanuel Bernard Master

                  Do me a favor, try on EJB3 RC2 (released today). If it fails agin, then I'll have to dig into it ;-)

                  • 7. Re: When deploying I get NullPointerException at org.hiberna
                    Jiri Frydek Newbie

                    I download EJB3 RC2 and I see the same error :). After some research and testing I found my main problem. It is with the column language_id. If I change it to other attribute from AwardCategoryNameL10n, then all is correct. The problem is, that language_id is column from abstract superclass AwardCategoryL10n and if I add it to @UniqueConstraint, then deploy fails (NullPointerExceprion).

                    Thx.

                    Jefec