4 Replies Latest reply on Aug 28, 2009 1:14 AM by thegrunt

    JBPM and Seam on Glassfish

    thegrunt
      Hi everyone,

      I'm trying to deploy Seam/JBPM onto Glassfish (by modifying the todo example) and not having success with the JBPM portion and I was wandering if anyone can help.  When I click on "Create New Item" on this page http://localhost:8080/todo-war/todo.seam, it throws this exception:

      WARNING: executePhase(INVOKE_APPLICATION 5,com.sun.faces.context.FacesContextImpl@63447a) threw exception
      javax.faces.FacesException: {todoList.createTodo}: org.jboss.seam.InstantiationException: Could not instantiate Seam component: org.jboss.seam.bpm.jbpmContext
      ...
      Caused by: javax.faces.FacesException: {todoList.createTodo}: org.jboss.seam.InstantiationException: Could not instantiate Seam component: org.jboss.seam.bpm.jbpmContext
              at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:107)
      ...
      Caused by: javax.faces.el.EvaluationException: org.jboss.seam.InstantiationException: Could not instantiate Seam component: org.jboss.seam.bpm.jbpmContext
              at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:91)
      ...
      Caused by: java.lang.IllegalStateException: jBPM transaction management is enabled, disable in jbpm.cfg.xml

      I've tried placing jbpm.cfg.xml in every single place imaginable, but nada.  Here's the file contents.

      <code>
      <jbpm-configuration>
        <jbpm-context>
          <service name="persistence">
             <factory>
                <bean class="org.jbpm.persistence.db.DbPersistenceServiceFactory">
                      <field name="isTransactionEnabled"><false/></field>
                </bean>
             </factory>
          </service>
         
          <service name="tx" factory="org.jbpm.tx.TxServiceFactory" />
          <service name="message" factory="org.jbpm.msg.db.DbMessageServiceFactory" />
          <service name="scheduler" factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" />
          <service name="logging" factory="org.jbpm.logging.db.DbLoggingServiceFactory" />
          <service name="authentication" factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory" />
        </jbpm-context>
        <string name='resource.hibernate.cfg.xml'  value='jbpm.hibernate.cfg.xml' />

      </jbpm-configuration>
      </code>

      My environment:

      J2EE Server: Glassfish 2.1 (bundled with Sun java installer, located in c:/Sun/SDK)
      Seam Version: jboss-seam-2.1.2

      Been over a year since I worked with Seam and I would love to promote it's usage in the current project I'm on.  Would anyone know a remedy for this? 

      Also if anyone happens to have a complete example EAR deployment for SEAM/JBPM/DROOLS that one could just drop into Glassfish and be willing to send it to me, I would be so greatful.

      Thanks!

        • 1. Re: JBPM and Seam on Glassfish
          kukeltje.ronald.jbpm.org

          is you config file used? Can it be there is another one somewhere on the classpath? Try 'corrupting' this one and see if it produces an error

          • 2. Re: JBPM and Seam on Glassfish
            thegrunt
            Greetings Ronald,

            Thanks for the reply.

            Looks like it can't find the file for some reason.... I've placed multiple copies of the same corrupted jbpm.cfg.xml in various locations in the ears, war, ejb just hoping something 'hits'.  The ear loads up but it doesn't auto generate the jbpm tables when hbm2ddl.auto="create-drop".

            My web.xml:

                <listener>
                    <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
                </listener>

                <filter>
                    <filter-name>Seam Filter</filter-name>
                    <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
                </filter>

                <filter-mapping>
                    <filter-name>Seam Filter</filter-name>
                    <url-pattern>/*</url-pattern>
                </filter-mapping>
               
                <servlet>
                    <servlet-name>Faces Servlet</servlet-name>
                    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                    <load-on-startup>1</load-on-startup>
                </servlet>
               
                <servlet-mapping>
                    <servlet-name>Faces Servlet</servlet-name>
                    <url-pattern>*.seam</url-pattern>
                </servlet-mapping>
               
                <session-config>
                    <session-timeout>10</session-timeout>
                </session-config>


              <!-- JEE5 EJB3 names -->
            ... other EJB3 Names

              <ejb-local-ref>
                <ejb-ref-name>jboss-seam-jee5/EjbSynchronizations/local</ejb-ref-name>
                <ejb-ref-type>Session</ejb-ref-type>
                <local>org.jboss.seam.transaction.LocalEjbSynchronizations</local>
              </ejb-local-ref>

            Component.xml:

                 <web:redirect-filter url-pattern="*.seam"/>
                 <web:exception-filter url-pattern="*.seam"/>

                <core:init jndi-pattern="java:comp/env/jboss-seam-jee5/#{ejbName}/local" debug="true"/>   

                <transaction:ejb-transaction/>

                <core:manager conversation-timeout="120000"
                              concurrent-request-timeout="500"
                              conversation-id-parameter="cid"/>
                            
                <bpm:jbpm>
                    <bpm:pageflow-definitions>
                        <value>todo2.jpdl.xml</value>
                    </bpm:pageflow-definitions>
                </bpm:jbpm>
                <security:identity authenticate-method="#{authenticator.authenticate}"/>

            Faces.xml:

                 <lifecycle>
                     <phase-listener>org.jboss.seam.jsf.SeamPhaseListener</phase-listener>
                 </lifecycle>
               
                <!-- Facelets support -->
                <application>
                    <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
                </application>
               

            Also note my entities are using JPA persistence.xml:

                 <persistence-unit name="em" transaction-type="JTA">
                      <provider>org.hibernate.ejb.HibernatePersistence</provider>
                      <jta-data-source>jdbc/__default</jta-data-source>
                      <properties>
                           <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
                           <property name="hibernate.show_sql" value="true" />
                           <property name="hibernate.hbm2ddl.auto" value="create-drop" />          
                           
                          <property name="hibernate.cache.provider_class"
                               value="org.hibernate.cache.HashtableCacheProvider"/>
                           
                      </properties>
                 </persistence-unit>

            While I'm not sure if the JBPM is anyway associated with that persistent unit.  In the todo example there is no persistence.xml. So not quite sure what's going on.  
            • 3. Re: JBPM and Seam on Glassfish
              kukeltje.ronald.jbpm.org

              if the corrupt file is never used, there must be another one on the classpath before it (can be in a jar!). Find that first.


              afaik, jBPM does not share a persistency context but has it's own hibernate session

              • 4. Re: JBPM and Seam on Glassfish
                thegrunt
                Ronald,

                Thanks!  That was pretty much it.  Had another jbpm-jpdl.jar file somewhere that was loading up first.  After I removed it, the jbpm.cfg.xml file was found and jbpm tables showed up in the database afterwards.  Now when I click "Create New Item" all it does is:

                org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.jbpm.context.exe.ContextInstance#13]
                     at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:1769)

                Two steps forward...

                Thien