cancel
Showing results for 
Search instead for 
Did you mean: 

Act. Explorer Exception: unknown variable type jpa-entity

n_s_
Champ in-the-making
Champ in-the-making
Hello,


I'm trying to use a custom process which involves references to custom JPA entities.

As noted in the manual and forum topics http://forums.activiti.org/en/viewtopic.php?f=6&t=2373&start=0
I provided a activity.cfg.xml in which I use my custom JPA Entity Manager Factory:


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

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd">


    <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property name="jpaVendorAdapter">
            <bean class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
            </bean>
        </property>

        <property name="jpaProperties">
            <bean id="jpaProperties"
                  class="org.springframework.beans.factory.config.PropertiesFactoryBean">
                <property name="properties">
                    <props>
                        <prop key="eclipselink.weaving">false</prop>
                    </props>
                </property>
            </bean>
        </property>

    </bean>


    <bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration">

        <!– Database configurations –>
        <property name="databaseSchemaUpdate" value="true"/>
        <property name="jdbcUrl" value="jdbc:h2:tcp://localhost:9092/~/test"/>
        <property name="jdbcDriver" value="org.h2.Driver"/>
        <property name="jdbcUsername" value="Testuser"/>
        <property name="jdbcPassword" value="start"/>
        <property name="jpaEntityManagerFactory" ref="entityManagerFactory"/>
        <property name="jpaHandleTransaction" value="true"/>
        <property name="jpaCloseEntityManager" value="true"/>

        <!– job executor configurations –>
        <property name="jobExecutorActivate" value="false"/>
    </bean>

</beans>

My persistence.xml declares a persistence-unit "myentities" which includes my entities. I'm able to start/control my process within a unit-test / own servlet. So JPA inside the Acitiviti Engine works.


But if I try to access my process within Activiti Explorer I receive an
"ActivitiException: unknown variable type name jpa-entity"

I guess the explorer still uses a custom persistence unit (where is it defined?) which is not aware of my JPA mappings. How can I extend Activiti Explorer so it knows my JPA entities?

Best regards, Nikola
2 REPLIES 2

trademak
Star Contributor
Star Contributor
Hi,

You can look at the WEB-INF/applicationContext.xml Spring configuration.
There you can fill-in your JPA context.

Best regards,

n_s_
Champ in-the-making
Champ in-the-making
Hello,

thanks for the quick reply.
I adjusted the file applicationContext.xml
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName" value="org.h2.Driver" />
    <property name="url" value="jdbc:h2:tcp://localhost:9092/~/test?autoReconnect=true;create=true" />
    <property name="username" value="Testuser" />
    <property name="password" value="start" />
     <property name="defaultAutoCommit" value="false" />
  </bean>
  <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
   <property name="dataSource" ref="dataSource" />
   <property name="transactionManager" ref="transactionManager"/>
   <property name="databaseSchemaUpdate" value="true" />
   <property name="jobExecutorActivate" value="true" />
        <property name="customFormTypes">
        <list>
              <ref bean="userFormType"/>
        </list>
        </property>

        <!– Database configurations –>
        <property name="jdbcUrl" value="jdbc:h2:tcp://localhost:9092/~/test"/>
        <property name="jdbcDriver" value="org.h2.Driver"/>
        <property name="jdbcUsername" value="Testuser"/>
        <property name="jdbcPassword" value="start"/>

        <property name="jpaEntityManagerFactory" ref="entityManagerFactory"/>
        <property name="jpaHandleTransaction" value="true"/>
        <property name="jpaCloseEntityManager" value="true"/>

  </bean>
and also adjusted activiti-context.xml, activiti-ui-context.xml. It compiles fine and says it is using my database
[jetty] [DEBUG] org.springframework.jdbc.datasource.SimpleDriverDataSource - Creating new JDBC Driver Connection to [jdbc:h2:tcp://localhost:9092/~/test]but I'm still not able to see my own tables in the Database  within the Explorer.
I should though, right? What am I missing?

Best regards, Nikola