0 Replies Latest reply on Jul 28, 2014 4:47 AM by Zhibin Huang

    Deploy JBPM 6.0.0.final to Weblogic 12.1.2.0.0 Error

    Zhibin Huang Newbie

      In our project, we used JBPM 6.0.0.Final. During the development phase, we use tomcat7.0.54 to run the webapp.It’s running without any problem.But when we deploy it to weblogic, there comes some problems.

      This is the spring configuration file used in tomcat:

       

      <bean id="dataSource" class="bitronix.tm.resource.jdbc.PoolingDataSource"
        init-method="init" destroy-method="close">
             <property name="className" value="${xa.classname}" />
             <property name="uniqueName" value="jdbc/cdpProject" />
             <property name="maxPoolSize" value="5" />
             <property name="allowLocalTransactions" value="true" />
             <property name="driverProperties">
                  <props>
                       <prop key="URL">${database.url}</prop>
                       <prop key="user">${database.username}</prop>
                       <prop key="password">${database.password}</prop>
                  </props>
             </property>
        </bean>
      
      
        <bean id="sessionFactory"
             class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
             <property name="dataSource" ref="dataSource" />
             <property name="jtaTransactionManager" ref="transactionManager" />
             <property name="mappingResources">
                  <list>
                       <value>com/taiji/eav/hbm/AttributeMeta.xml</value>
                       <value>com/taiji/eav/hbm/EntityTypeMeta.xml</value>
                  </list>
             </property>
             <property name="hibernateProperties">
                  <map>
                       <entry key="hibernate.dialect" value="${hibernate.dialect}" />
                       <entry key="hibernate.current_session_context_class" value="${hibernate.current_session_context_class}" />
                       <entry key="hibernate.cache.provider_class" value="${hibernate.cache.provider_class}" />
                  </map>
             </property>
        </bean>
      
      
        <bean id="entityManagerFactory"
             class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
             <property name="dataSource" ref="dataSource" />
             <property name="persistenceUnitName" value="org.cdp.jta" />
             <property name="persistenceXmlLocation" value="${persistenceXmlLocation}" />
             <property name="jpaVendorAdapter">
                  <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">     
                       <property name="databasePlatform" value="${hibernate.dialect}" />     
                       <property name="showSql" value="${hibernate.show_sql}" />     
                       <property name="generateDdl" value="${hibernate.generateDdl}" />
                  </bean>
             </property>
             <property name="jpaPropertyMap">
                  <map>
                       <entry key="hibernate.format_sql" value="${hibernate.format_sql}" />
                       <entry key="hibernate.transaction.jta.platform"     
                       value="org.hibernate.service.jta.platform.internal.BitronixJtaPlatform" />
                  </map>
             </property>
        </bean>
      
        <bean id="btmConfig" factory-method="getConfiguration"
             class="bitronix.tm.TransactionManagerServices">
        </bean>
      
        <bean id="bitronixTransactionManager" factory-method="getTransactionManager"
             class="bitronix.tm.TransactionManagerServices" depends-on="btmConfig, dataSource"
             destroy-method="shutdown" />
      
        <bean id="transactionManager"
             class="org.springframework.transaction.jta.JtaTransactionManager">
             <property name="transactionManager" ref="bitronixTransactionManager" /
             <property name="userTransaction" ref="bitronixTransactionManager" />
        </bean>
      
        <tx:annotation-driven transaction-manager="transactionManager" />
      
        <context:component-scan base-package="com.taiji.*" />
      

      This is the spring configuration file used in Weblogic:

       

      <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
             <property name="jndiName" value="zhdddb" />
       </bean>
      
        <bean id="sessionFactory"
             class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
             <property name="dataSource" ref="dataSource" />
             <property name="jtaTransactionManager" ref="transactionManager" />
             <property name="mappingResources">
                  <list>
                       <value>com/taiji/eav/hbm/AttributeMeta.xml</value>
                       <value>com/taiji/eav/hbm/EntityTypeMeta.xml</value>
                  </list>
             </property>
             <property name="hibernateProperties">
                  <map>
                       <entry key="hibernate.dialect" value="${hibernate.dialect}" />
                       <entry key="hibernate.current_session_context_class" value="${hibernate.current_session_context_class}" />
                       <entry key="hibernate.cache.provider_class" value="${hibernate.cache.provider_class}" />
                       <entry key="hibernate.transaction.jta.platform"
                            value="org.hibernate.service.jta.platform.internal.WeblogicJtaPlatform" />
                  </map>
             </property>
        </bean>
      
        <bean id="entityManagerFactory"
             class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
             <property name="dataSource" ref="dataSource" />
             <property name="persistenceUnitName" value="org.cdp.jta" />
             <property name="persistenceXmlLocation" value="${persistenceXmlLocation}" />
             <property name="jpaVendorAdapter">
                  <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
                       <property name="databasePlatform" value="${hibernate.dialect}" />
                       <property name="showSql" value="${hibernate.show_sql}" />
                       <property name="generateDdl" value="${hibernate.generateDdl}" />
                  </bean>
             </property>
             <property name="jpaPropertyMap">
                  <map>
                       <entry key="hibernate.format_sql" value="${hibernate.format_sql}" />
                       <entry key="hibernate.transaction.jta.platform"
                            value="org.hibernate.service.jta.platform.internal.WeblogicJtaPlatform" />
                  </map>
             </property>
        </bean>
      
        <bean id="transactionManager"
             class="org.springframework.transaction.jta.WebLogicJtaTransactionManager">
        </bean>
      
        <tx:annotation-driven transaction-manager="transactionManager" />
      
        <context:component-scan base-package="com.taiji.*" />
      

      Then we init JBPM in a spring-bean:

       

      public class KieContext {
        private static RuntimeEnvironment runtimeEnvironment = null;
        private static RuntimeManager runtimeManager = null;
      
        private EntityManagerFactory entityManagerFactory;
        private JtaTransactionManager transactionManager;
        private UserGroupCallback userGroupCallback = null;
      
        @PostConstruct
        public void init() {
             if (runtimeEnvironment != null) {
                  return;     
             }
      
             runtimeEnvironment = RuntimeEnvironmentBuilder.Factory
                                 .get()                         
                                 .newDefaultBuilder()
                                 .userGroupCallback(user())
                                 .persistence(true)
                                 .addEnvironmentEntry(EnvironmentName.TRANSACTION_MANAGER, transactionManager.getTransactionManager())
                                 .addEnvironmentEntry(EnvironmentName.TASK_USER_GROUP_CALLBACK, userGroupCallback)
                                 .entityManagerFactory(entityManagerFactory).get();
      
             RuntimeManagerFactory rmf = RuntimeManagerFactory.Factory.get();
            
             runtimeManager = rmf.newPerRequestRuntimeManager(runtimeEnvironment);
           
                // other code
                  ............
           }
      }
      

           There we use KieContext as a base class and it contains a application scope variable of Type org.jbpm.runtime.manager.impl.PerRequestRuntimeManager,all the other operations is beyond it like start process 、get taskservice object、get tasks.

           After we deploy our project to Weblogic,when we start the webapp,there comes some errors,this is the brief error(Attached is the detailed error information file):

       

      java.lang.RuntimeException: Two default beans with the same type and qualifiers:
      Type: interface org.jboss.seam.transaction.Synchronizations Qualifiers: [@javax.enterprise.inject.Default(), @javax.enterprise.inject.Any()]
       Beans are Managed Bean [class org.jboss.seam.transaction.TransactionManagerSynchronizations] with qualifiers [@Any @Synthetic]
      and Managed Bean [class org.jboss.seam.transaction.TransactionManagerSynchronizations] with qualifiers [@Any @Synthetic]
      
      java.lang.RuntimeException: Two default beans with the same type and qualifiers:
      Type:interface org.jboss.seam.transaction.SeamTransaction Qualifiers: [@org.jboss.seam.transaction.DefaultTransaction(), @javax.enterprise.inject.Any()]
      Beans are Managed Bean [class org.jboss.seam.transaction.DefaultSeamTransaction] with qualifiers [@Any @Synthetic]
       and Managed Bean [class org.jboss.seam.transaction.DefaultSeamTransaction] with qualifiers [@Any @Synthetic]
      

      After long time seaching,we still don't know why this will appear.Any idea will be grateful!Thanks in advance~