1 2 3 Previous Next 35 Replies Latest reply on Dec 5, 2009 5:36 AM by saraswati.santanu Go to original post
      • 15. Re: Problem moving from 4.1 to 4.2 using Spring configuratio

        Thanks Santanu.

        I have changed spring-transaction-interceptor from current="true" to current="false" and it did resolve that issue.

        Now , when i start a new process, it gives me

        org.jbpm.api.JbpmException: no org.jbpm.pvm.internal.session.DbSession in current environment

        I am using the following code

        @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
        @Override
        public void startProcess(String processName, Map variables)
        {
        executionService.startProcessInstanceByKey (processName, variables);
        }

        and the config file has db session as shown below

        <transaction-context>
        <repository-session />
        <pvm-db-session />
        <job-db-session />
        <task-db-session />
        <message-session />
        <timer-session />
        <history-session />


        <hibernate-session />

        <hibernate-session current="true" />
        <identity-session />
        </transaction-context>


        Can you let me know if somethings wrong ?

        • 16. Re: Problem moving from 4.1 to 4.2 using Spring configuratio

          Also to add, i have a Spring advice

          <tx:advice id="txAdvice" transaction-manager="txManager">
          <tx:attributes>
          <tx:method name="get*" read-only="true" propagation="SUPPORTS" />
          <tx:method name="find*" read-only="true" propagation="SUPPORTS" />
          <tx:method name="*" propagation="REQUIRED" />
          </tx:attributes>
          </tx:advice>

          • 17. Re: Problem moving from 4.1 to 4.2 using Spring configuratio
            saraswati.santanu

            It will be helpful if you can provide the stack trace

            • 18. Re: Problem moving from 4.1 to 4.2 using Spring configuratio

              Hi Santanu

              Here is the full error:

              org.jbpm.api.JbpmException: no org.jbpm.pvm.internal.session.DbSession in current environment
              org.jbpm.pvm.internal.env.EnvironmentImpl.getFromCurrent(EnvironmentImpl.java:204)
              org.jbpm.pvm.internal.env.EnvironmentImpl.getFromCurrent(EnvironmentImpl.java:190)
              org.jbpm.pvm.internal.history.events.ActivityStart.process(ActivityStart.java:40)
              org.jbpm.pvm.internal.history.HistorySessionImpl.process(HistorySessionImpl.java:31)
              org.jbpm.pvm.internal.history.HistoryEvent.fire(HistoryEvent.java:61)
              org.jbpm.pvm.internal.model.ExecutionImpl.historyDecision(ExecutionImpl.java:1088)
              org.jbpm.jpdl.internal.activity.DecisionExpressionActivity.execute(DecisionExpressionActivity.java:63)
              org.jbpm.jpdl.internal.activity.DecisionExpressionActivity.execute(DecisionExpressionActivity.java:42)
              org.jbpm.pvm.internal.model.op.ExecuteActivity.perform(ExecuteActivity.java:60)
              org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperationSync(ExecutionImpl.java:655)
              org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperation(ExecutionImpl.java:615)
              org.jbpm.pvm.internal.model.ExecutionImpl.start(ExecutionImpl.java:215)
              org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd.execute(StartProcessInstanceInLatestCmd.java:65)
              org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd.execute(StartProcessInstanceInLatestCmd.java:38)
              org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
              org.jbpm.pvm.internal.spring.CommandTransactionCallback.doInTransaction(CommandTransactionCallback.java:50)
              org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:127)
              org.jbpm.pvm.internal.tx.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:77)
              org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)
              org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)
              org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
              org.jbpm.pvm.internal.svc.ExecutionServiceImpl.startProcessInstanceByKey(ExecutionServiceImpl.java:70)

              • 19. Re: Problem moving from 4.1 to 4.2 using Spring configuratio
                saraswati.santanu

                I tried your jbpm configuration. I did not get the exception, but it did not work also. I got stuck after firing one select. It looked like a deadlock. However the problem I notices in you jbpm.cfg.xml is presence of "hibernate-session" twice. I used the second one (with curent=true) successfully.

                • 20. Re: Problem moving from 4.1 to 4.2 using Spring configuratio

                  I changed that already (only one hibernate-session with client = true ) but same result. No clue at why i am able to deploy but not start ?
                  Googled/Binged it , could find much .. Stuck on it ..

                  • 21. Re: Problem moving from 4.1 to 4.2 using Spring configuratio

                    I am getting DBSession error due to this error --

                    16:14:51,625 INFO [STDOUT] Hibernate: select propertyim0_.KEY_ as KEY1_6_, propertyim0_.VERSION_ as VERSION2_6_, propertyim
                    _.VALUE_ as VALUE3_6_ from JBPM4_PROPERTY propertyim0_ where propertyim0_.KEY_='next.dbid'
                    16:14:51,671 INFO [STDOUT] Hibernate: update JBPM4_PROPERTY set VERSION_=?, VALUE_=? where KEY_=? and VERSION_=?
                    16:14:51,734 INFO [DefaultCommandService] exception while executing command org.jbpm.pvm.internal.cmd.DeployCmd@1c0dc84
                    org.hibernate.SessionException: Session is closed!
                     at org.hibernate.impl.AbstractSessionImpl.errorIfClosed(AbstractSessionImpl.java:72)
                     at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:558)
                     at org.hibernate.impl.SessionImpl.save(SessionImpl.java:550)
                     at org.hibernate.impl.SessionImpl.save(SessionImpl.java:546)
                     at org.jbpm.pvm.internal.repository.RepositorySessionImpl.deploy(RepositorySessionImpl.java:60)
                     at org.jbpm.pvm.internal.cmd.DeployCmd.execute(DeployCmd.java:47)
                     at org.jbpm.pvm.internal.cmd.DeployCmd.execute(DeployCmd.java:33)
                     at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
                     at org.jbpm.pvm.internal.spring.CommandTransactionCallback.doInTransaction(CommandTransactionCallback.java:50)
                     at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:127)
                     at org.jbpm.pvm.internal.tx.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:77)
                     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.repository.DeploymentImpl.deploy(DeploymentImpl.java:91)


                    • 22. Re: Problem moving from 4.1 to 4.2 using Spring configuratio
                      xalperte

                      I'm pretty sure that this exception appears to be the cause of another that happens before... try to debug your code in order to find the original exception

                      • 23. Re: Problem moving from 4.1 to 4.2 using Spring configuratio

                        Only change i have is
                        <command-service name="txRequiredCommandService">
                        <retry-interceptor />
                        <environment-interceptor />
                        <spring-transaction-interceptor current="false"/>

                        Previous working code was with 4.0 and following

                        <command-service >
                        <retry-interceptor />
                        <environment-interceptor />
                        <spring-transaction-interceptor current="true"/>

                        Not sure if spring-transaction-interceptor = false makes the session close ?? Will redo everything again :(

                        • 24. Re: Problem moving from 4.1 to 4.2 using Spring configuratio

                          Rolled back everything to as it was JBPM 4CR1 with New instance of Jboss 5.0, still same error - i am so frustated



                          ERROR AT CLICK OF DEPLOY

                          17:48:52,343 INFO [STDOUT] ***********
                          17:48:52,468 INFO [STDOUT] deployed TestEmail.jpdl.xml
                          17:48:52,593 INFO [STDOUT] Hibernate: select propertyim0_.KEY_ as KEY1_6_, propertyim0_.VERSION_ as VERSION2_6_, propertyim0
                          _.VALUE_ as VALUE3_6_ from JBPM4_PROPERTY propertyim0_ where propertyim0_.KEY_='next.dbid'
                          17:48:52,609 INFO [STDOUT] Hibernate: update JBPM4_PROPERTY set VERSION_=?, VALUE_=? where KEY_=? and VERSION_=?
                          17:48:52,687 INFO [DefaultCommandService] exception while executing command org.jbpm.pvm.internal.cmd.DeployCmd@1a0b93e
                          org.hibernate.SessionException: Session is closed!
                           at org.hibernate.impl.AbstractSessionImpl.errorIfClosed(AbstractSessionImpl.java:72)
                           at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:558)
                           at org.hibernate.impl.SessionImpl.save(SessionImpl.java:550)
                           at org.hibernate.impl.SessionImpl.save(SessionImpl.java:546)
                           at org.jbpm.pvm.internal.repository.RepositorySessionImpl.deploy(RepositorySessionImpl.java:60)
                           at org.jbpm.pvm.internal.cmd.DeployCmd.execute(DeployCmd.java:47)
                           at org.jbpm.pvm.internal.cmd.DeployCmd.execute(DeployCmd.java:33)
                           at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
                           at org.jbpm.pvm.internal.spring.CommandTransactionCallback.doInTransaction(CommandTransactionCallback.java:50)
                           at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:127)
                           at org.jbpm.pvm.internal.tx.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:77)
                           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)
                          




                          JBPM Config file
                          <?xml version="1.0" encoding="UTF-8"?>
                          
                          <jbpm-configuration xmlns="http://jbpm.org/xsd/cfg">
                          
                           <process-engine-context>
                          
                           <repository-service />
                           <repository-cache />
                           <execution-service />
                           <history-service />
                           <management-service />
                           <task-service />
                           <identity-service />
                          
                           <command-service>
                           <retry-interceptor />
                           <environment-interceptor />
                           <spring-transaction-interceptor current="true"/>
                          
                           <!--<spring-transaction-interceptor />-->
                          
                           </command-service>
                          
                          
                           <hibernate-configuration>
                           <cfg resource="jbpm.hibernate.cfg.xml" />
                           </hibernate-configuration>
                          
                           <deployer-manager>
                           <jpdl-deployer />
                           </deployer-manager>
                          
                           <script-manager default-expression-language="juel"
                           default-script-language="juel"
                           read-contexts="execution, environment, process-engine"
                           write-context="">
                           <script-language name="juel" factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" />
                           </script-manager>
                          
                           <authentication />
                          
                           <job-executor auto-start="false" />
                          
                           <id-generator />
                          
                          
                          
                           <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>
                           <repository-session />
                           <pvm-db-session />
                           <job-db-session />
                           <task-db-session />
                           <message-session />
                           <timer-session />
                           <history-session />
                           <transaction />
                          
                           <hibernate-session current="true" />
                           <identity-session />
                           </transaction-context>
                          
                          </jbpm-configuration>


                          APPLICATION COMMON CONFIG
                          <?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"
                           xmlns:tx="http://www.springframework.org/schema/tx"
                           xsi:schemaLocation="
                           http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
                           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
                           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
                          
                          
                           <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
                           <property name="locations">
                           <list>
                           <value>classpath:/log4j.properties</value>
                           </list>
                           </property>
                           </bean>
                          
                           <aop:aspectj-autoproxy/>
                          
                           <tx:advice id="txAdvice" transaction-manager="txManager">
                           <tx:attributes>
                           <tx:method name="get*" read-only="true" propagation="SUPPORTS" />
                           <tx:method name="find*" read-only="true" propagation="SUPPORTS" />
                           <tx:method name="*" propagation="REQUIRED" />
                           </tx:attributes>
                           </tx:advice>
                          
                           <aop:config>
                           <aop:pointcut id="serviceOperation" expression="execution(* com.test.services.**.*(..))" type="regex" />
                           <aop:advisor advice-ref="txAdvice" pointcut-ref="serviceOperation" />
                           </aop:config>
                          
                           <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
                           <property name="driverClassName" value="com.mysql.jdbc.Driver" />
                           <property name="url" value="jdbc:mysql://localhost:3306/jbpm4" />
                           <property name="username" value="root" />
                           <property name="password" value="revchain" />
                           </bean>
                          
                           <bean id="sessionFactory"
                           class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
                           <property name="dataSource" ref="dataSource" />
                           <property name="hibernateProperties">
                           <props>
                           <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
                           <prop key="hibernate.show_sql">true</prop>
                           <prop key="hibernate.hbm2ddl.auto">update</prop>
                           </props>
                           </property>
                           <property name="configLocations">
                           <list>
                           <value>classpath:com/test/hibernate.cfg.xml</value>
                           </list>
                           </property>
                           <property name="mappingLocations">
                           <list>
                           <value>classpath:jbpm.execution.hbm.xml</value>
                           <value>classpath:jbpm.repository.hbm.xml</value>
                           <value>classpath:jbpm.jpdl.hbm.xml</value>
                           <value>classpath:jbpm.task.hbm.xml</value>
                           <value>classpath:jbpm.history.hbm.xml</value>
                           </list>
                           </property>
                           </bean>
                          
                           <bean id="txManager"
                           class="org.springframework.orm.hibernate3.HibernateTransactionManager">
                           <property name="sessionFactory" ref="sessionFactory" />
                           </bean>
                          
                          </beans>


                          H E L P

                          H E L P
                          [/img]

                          • 25. Re: Problem moving from 4.1 to 4.2 using Spring configuratio

                            Just a update -
                            It works fine with 4.0 jars - above error were because still had 4.2 jars in lib..

                            I will stick with 4 until i hear more from anyone.

                            • 26. Re: Problem moving from 4.1 to 4.2 using Spring configuratio
                              saraswati.santanu

                              Rocker,
                              are you missing db id generator in your jbpm.cfg.xml file?

                               <object class="org.jbpm.pvm.internal.id.DatabaseDbidGenerator">
                               <field name="commandService"><ref object="txRequiredCommandService" /></field>
                               </object>
                              
                               <object class="org.jbpm.pvm.internal.id.DatabaseIdComposer" init="eager" />
                              


                              You need to remove any id-generator component also if present. This is something new in 4.2. Also what I understand is you do not need to mention "hibernate-configuration" in jbpm.cfg.xml since you are already giving them in spring configuration.


                              • 27. Re: Problem moving from 4.1 to 4.2 using Spring configuratio

                                I had DBIdGenerator in my config , i rolled back everything to see whats causing the problem ..

                                May be i had id-generator in my config + hibernate-configuration as you said. Not sure if this was causing the Spring session to be closed after creating id ? I will try it and let you know .. Thanks.

                                • 28. Re: Problem moving from 4.1 to 4.2 using Spring configuratio
                                  saraswati.santanu

                                  One way to debug may be to put a breakpoint in Hibernate SessionImpl.close() method. And then look down the stack to find out what has resulted in that close call.

                                  • 29. Re: Problem moving from 4.1 to 4.2 using Spring configuratio

                                    You were right .. those 2 changes were the culprits .. I upgraded from 4 to 4.2 + deployed on WL 9.2
                                    Now if you could let me know how to resolve this issue -

                                    http://www.jboss.org/index.html?module=bb&op=viewtopic&t=164167&start=0&postdays=postDays&postorder=postOrder&highlight=highlight