12 Replies Latest reply on Jun 23, 2010 1:10 AM by HuiSheng Xu

    null pointer exception when integrating jbpm4.3,spring2.5.6,hibernate3

    praneet nandan Newbie

      hi

      am getting this when integrating all

       

      SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener

      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngine' defined in ServletContext resource [/WEB-INF/classes/jbpm4-context.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [protected org.jbpm.api.ProcessEngine org.jbpm.pvm.internal.processengine.SpringHelper.createProcessEngine()] threw exception; nested exception is java.lang.NullPointerException

           at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:423)

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:901)

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:815)

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)

           at java.security.AccessController.doPrivileged(Native Method)

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)

           at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)

           at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:217)

           at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)

           at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)

           at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)

           at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)

           at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)

           at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)

           at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)

           at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)

           at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)

           at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3830)

           at org.apache.catalina.core.StandardContext.start(StandardContext.java:4337)

           at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)

           at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)

           at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)

           at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)

           at org.apache.catalina.core.StandardService.start(StandardService.java:516)

           at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)

           at org.apache.catalina.startup.Catalina.start(Catalina.java:566)

           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

           at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

           at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

           at java.lang.reflect.Method.invoke(Unknown Source)

           at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)

           at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

      Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [protected org.jbpm.api.ProcessEngine org.jbpm.pvm.internal.processengine.SpringHelper.createProcessEngine()] threw exception; nested exception is java.lang.NullPointerException

           at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:127)

           at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:414)

           ... 32 more

      Caused by: java.lang.NullPointerException

           at org.jbpm.pvm.internal.processengine.ProcessEngineImpl.checkDb(ProcessEngineImpl.java:152)

           at org.jbpm.pvm.internal.processengine.SpringProcessEngine.create(SpringProcessEngine.java:70)

           at org.jbpm.pvm.internal.cfg.ConfigurationImpl.buildProcessEngine(ConfigurationImpl.java:92)

           at org.jbpm.pvm.internal.processengine.SpringHelper.createProcessEngine(SpringHelper.java:47)

           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

           at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

           at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

           at java.lang.reflect.Method.invoke(Unknown Source)

           at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:115)

           ... 33 more

      my applicationcontext.xml is

       

       

      <?xml version="1.0" encoding="UTF-8"?>

      <beans xmlns="http://www.springframework.org/schema/beans"

           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

           xmlns:aop="http://www.springframework.org/schema/aop"

           xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd

                http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

                http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd

                http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd

                http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"

           xmlns:context="http://www.springframework.org/schema/context"

           xmlns:p="http://www.springframework.org/schema/p"

           xmlns:tx="http://www.springframework.org/schema/tx"

           xmlns:util="http://www.springframework.org/schema/util">

           

      <tx:annotation-driven transaction-manager="transactionManager"/>

       

           

           

      <bean id="ds"

                class="org.springframework.jdbc.datasource.DriverManagerDataSource">

                <property name="driverClassName" value="com.mysql.jdbc.Driver"></property>

                <property name="url" value="jdbc:mysql://localhost/praneetjbpm43" />

                <property name="username" value="root"></property>

                <property name="password" value="root"></property>

                

           </bean>

       

       

      <bean

        id="transactionManager"

        class="org.springframework.orm.hibernate3.HibernateTransactionManager"

        p:sessionFactory-ref="sf" />

       

      <bean id="sf" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">

       

      <property name="dataSource" ref="ds"></property>

      <property name="schemaUpdate" value="true"></property>

       

      <property name="hibernateProperties">

      <props>

      <prop key="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</prop>

      <prop key="hibernate.show_sql">true</prop>

      <prop key="hibernate.hbm2ddl.auto">update</prop>

      <prop key="hibernate.query.substitutions">true 1, false 0</prop>

       

      </props>

      </property>

       

      <property name="mappingLocations">

      <list>

      <value>classpath:jbpm.execution.hbm.xml</value>

      <value>classpath:jbpm.history.hbm.xml</value>

      <value>classpath:jbpm.task.hbm.xml</value>

      <value>classpath:jbpm.repository.hbm.xml</value>

      <value>classpath:jbpm.identity.hbm.xml</value>

      </list>

      </property>

       

      <!--  <property name="configLocation" value="classpath:jbpm.hibernate.cfg.xml" />

       

      -->

       

       

      </bean>

       

       

      <util:list id="annotatedHibernateClasses"></util:list>

       

      <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">

      <property name="sessionFactory" ref="sf"></property>

      </bean>

       

       

      <!-- ========================= Configuring JBPM4.3 ============================= -->

       

      <bean id="springHelper" class="org.jbpm.pvm.internal.processengine.SpringHelper">

       

      <property name="jbpmCfg" value="jbpm.cfg.xml"></property>

       

      </bean>

       

      <bean id="processEngine" factory-bean="springHelper" factory-method="createProcessEngine" >

      </bean>

       

       

       

       

       

      </beans>

       

       

      my jbpm.cfg.xml is

       

      <?xml version="1.0" encoding="UTF-8"?>

      <jbpm-configuration>

           <import resource="jbpm.jpdl.cfg.xml" />

           <import resource="jbpm.identity.cfg.xml" />

           <!-- <import resource="jbpm.jobexecutor.cfg.xml" /> -->

           

           <process-engine-context>

           

          <string name="spring.cfg" value="applicationContext.xml" />

                <repository-service />

                <repository-cache />

                <execution-service />

                <history-service />

                <management-service />

                <identity-service />

                <task-service />

                <command-service>

                     <retry-interceptor />

                     <environment-interceptor />

                     <spring-transaction-interceptor />

                </command-service>

                <script-manager default-expression-language="juel"

                     default-script-language="juel"

                     read-contexts="execution, environment, process-engine, spring"

                     write-context="">

                     <script-language name="juel"

                          factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" />

                </script-manager>

                <authentication />

                <id-generator />

                <types resource="jbpm.variable.types.xml" />

                <address-resolver />

                <business-calendar>

                     <monday hours="9:00-12:00 and 12:30-17:00" />

                     <tuesday hours="9:00-12:00 and 12:30-17:00" />

                     <wednesday hours="9:00-12:00 and 12:30-17:00" />

                     <thursday hours="9:00-12:00 and 12:30-17:00" />

                     <friday hours="9:00-12:00 and 12:30-17:00" />

                     <holiday period="01/07/2008 - 31/08/2008" />

                </business-calendar>

           </process-engine-context>

           <transaction-context>

           <transaction type="spring" />

                <repository-session />

                <db-session />

                <message-session />

                <timer-session />

                <history-session />

                <hibernate-session current="true" />

                <mail-session>

          <mail-server>

            <session-properties>

              <property name="mail.smtp.host" value="localhost" />

              <property name="mail.smtp.port" value="25" />

              <property name="mail.from" value="system@localhost.com" />

            </session-properties>

          </mail-server>

        </mail-session>

           </transaction-context>

      </jbpm-configuration>

       

        • 1. Re: null pointer exception when integrating jbpm4.3,spring2.5.6,hibernate3
          Michael Wohlfart Expert

          try this in your jbpm.cfg.xml:

           

          <command-service name="txRequiredCommandService">
            <retry-interceptor />
            <environment-interceptor />
            <spring-transaction-interceptor />

          </command-service>

           


          • 2. Re: null pointer exception when integrating jbpm4.3,spring2.5.6,hibernate3
            praneet nandan Newbie

            after changing what u have said am getting new exception like this

             

             

            SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener

            org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngine' defined in ServletContext resource [/WEB-INF/classes/jbpm4-context.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [protected org.jbpm.api.ProcessEngine org.jbpm.pvm.internal.processengine.SpringHelper.createProcessEngine()] threw exception; nested exception is org.hibernate.MappingException: Unknown entity: org.jbpm.pvm.internal.id.PropertyImpl

                 at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:423)

                 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:901)

                 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:815)

                 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)

                 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)

                 at java.security.AccessController.doPrivileged(Native Method)

                 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)

                 at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)

                 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:217)

                 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)

                 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)

                 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)

                 at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)

                 at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)

                 at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)

                 at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)

                 at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)

                 at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)

                 at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3830)

                 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4337)

                 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)

                 at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)

                 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)

                 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)

                 at org.apache.catalina.core.StandardService.start(StandardService.java:516)

                 at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)

                 at org.apache.catalina.startup.Catalina.start(Catalina.java:566)

                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

                 at java.lang.reflect.Method.invoke(Unknown Source)

                 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)

                 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

            Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [protected org.jbpm.api.ProcessEngine org.jbpm.pvm.internal.processengine.SpringHelper.createProcessEngine()] threw exception; nested exception is org.hibernate.MappingException: Unknown entity: org.jbpm.pvm.internal.id.PropertyImpl

                 at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:127)

                 at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:414)

                 ... 32 more

            Caused by: org.hibernate.MappingException: Unknown entity: org.jbpm.pvm.internal.id.PropertyImpl

                 at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:580)

                 at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1365)

                 at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:121)

                 at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210)

                 at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:56)

                 at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195)

                 at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:50)

                 at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)

                 at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:562)

                 at org.hibernate.impl.SessionImpl.save(SessionImpl.java:550)

                 at org.hibernate.impl.SessionImpl.save(SessionImpl.java:546)

                 at org.jbpm.pvm.internal.id.PropertyImpl.setPropertyValue(PropertyImpl.java:178)

                 at org.jbpm.pvm.internal.id.PropertyImpl.setNextDbid(PropertyImpl.java:85)

                 at org.jbpm.pvm.internal.cmd.CheckDbCmd.execute(CheckDbCmd.java:63)

                 at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)

                 at org.jbpm.pvm.internal.tx.SpringCommandCallback.doInTransaction(SpringCommandCallback.java:45)

                 at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:128)

                 at org.jbpm.pvm.internal.tx.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:55)

                 at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)

                 at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)

                 at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)

                 at org.jbpm.pvm.internal.processengine.ProcessEngineImpl.checkDb(ProcessEngineImpl.java:152)

                 at org.jbpm.pvm.internal.processengine.SpringProcessEngine.create(SpringProcessEngine.java:70)

                 at org.jbpm.pvm.internal.cfg.ConfigurationImpl.buildProcessEngine(ConfigurationImpl.java:92)

                 at org.jbpm.pvm.internal.processengine.SpringHelper.createProcessEngine(SpringHelper.java:47)

                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

                 at java.lang.reflect.Method.invoke(Unknown Source)

                 at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:115)

                 ... 33 more

            • 3. Re: null pointer exception when integrating jbpm4.3,spring2.5.6,hibernate3
              Michael Wohlfart Expert

              this is a hibernate mapping issue:

               

              [...]

              Caused by: org.hibernate.MappingException: Unknown entity:  org.jbpm.pvm.internal.id.PropertyImpl

                   at  org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:580)

              [...]

               

              the mapping for org.jbpm.pvm.internal.id.PropertyImpl is in jbpm.repository.hbm.xml  there should be a table

              JBPM4_PROPERTY in your database schema, maybe it helps to use "create" instead of "update" for hibernate.hbm2ddl.auto

              or you could manually create the schema like documented at

              http://www.mastertheboss.com/en/jbpm/209-jbpm-4-tutorial-installation.html

               

              to me it looks like there is something wrong with your hibernate mapping config

              • 4. Re: null pointer exception when integrating jbpm4.3,spring2.5.6,hibernate3
                praneet nandan Newbie

                am still getting same problem,

                   do u have code or small application where u have done this ,coz am trying to this from 4 days am still unable to find way out

                • 5. Re: null pointer exception when integrating jbpm4.3,spring2.5.6,hibernate3
                  Ronald van Kuijk Master

                  It's your config, no application can solve this.

                   

                  I see in your spring config that a hibernate mapping for the propery table is not there. Sure it is a config file for jBPM 4.3?

                   

                  Create/update of the db is something Hibernate can do for you IF you have the correct mapping.

                   

                  And do you realy still use the spring hibernate template? Or is that a newly introduced one and not the old one?

                   

                  Ronald

                  • 6. Re: null pointer exception when integrating jbpm4.3,spring2.5.6,hibernate3
                    praneet nandan Newbie

                    i have used something like this

                     

                    <property name="mappingLocations">

                    <list>

                    <value>classpath:jbpm.execution.hbm.xml</value>

                    <value>classpath:jbpm.history.hbm.xml</value>

                    <value>classpath:jbpm.task.hbm.xml</value>

                    <value>classpath:jbpm.repository.hbm.xml</value>

                    <value>classpath:jbpm.identity.hbm.xml</value>

                    </list>

                    </property>

                     

                     

                    And do you realy still use the spring hibernate template? Or is that a newly introduced one and not the old one?

                    ya its old one ,but  i can change it with hibernateDaoSupport class but its not a big deal

                    • 7. Re: null pointer exception when integrating jbpm4.3,spring2.5.6,hibernate3
                      Ronald van Kuijk Master

                      Sorry, I formulated wrongly... I should have said:

                       

                      I see in your config that the file that should contain the mapping for PropertyImpl is there (jbpm.reposititory.hbm.xml), but does it contain this mapping. If not, check if you have the latests config files

                      • 10. Re: null pointer exception when integrating jbpm4.3,spring2.5.6,hibernate3
                        praneet nandan Newbie

                        update those...

                        what to update and from where i can get updated version

                        • 11. Re: null pointer exception when integrating jbpm4.3,spring2.5.6,hibernate3
                          Lalit Bhatia Newbie

                          hi Praneet,

                           

                          how did you manage to resolve this problem, I m facing the same problem for last 1 day. I am trying to integrate jbpm4.3 with Spring 3.0.3

                           

                          Thanks

                          Lalit

                          • 12. Re: null pointer exception when integrating jbpm4.3,spring2.5.6,hibernate3
                            HuiSheng Xu Master

                            Hi Lalit,

                             

                            Please check your configuration xml file, and make sure there is correct commandService being configured.  like follow:

                             

                            <command-service name="txRequiredCommandService">
                                  <skip-interceptor />
                                  <retry-interceptor />
                                  <environment-interceptor />
                                  <standard-transaction-interceptor />
                                </command-service>

                             

                                <command-service name="newTxRequiredCommandService">
                                  <retry-interceptor />
                                  <environment-interceptor policy="requiresNew" />
                                  <standard-transaction-interceptor />
                                </command-service>