Ashok Kuppuswamy [
https://community.jboss.org/people/akuppu] created the discussion
"Re: I got a NameNotFoundException when i want to createEntityManagerFactory
,What's wrong?"
To view the discussion, visit:
https://community.jboss.org/message/780087#780087
--------------------------------------------------------------
Are you using spring.
If you are using spring, I did the following to get it working. I think by-passed the jndi
lookup by explicitly setting the dataSource for
org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
My spring context xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans"
xmlns:context="
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context"
xmlns:tx="
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance
http://www.w3.org/2001/XMLSchema-instance"
xmlns:jbpm="
http://drools.org/schema/drools-spring
http://drools.org/schema/drools-spring"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://drools.org/schema/drools-spring
http://drools.org/schema/drools-spring
file:///C:/akuppu/development/juno/workspace/VBT2-trunk/src/config/drools-spring.xsd">
<bean id="jbpmEMF"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
depends-on="btmConfig">
<property name="persistenceUnitName"
value="org.jbpm.persistence.jta"/>
<property name="dataSource" ref="dataSource"/>
<property name="persistenceXmlLocation">
<value>classpath:jbpm-custom-persistence.xml</value>
</property>
<!-- <property name="jpaVendorAdapter">
<bean
class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter">
<property name="databasePlatform"
value="org.apache.openjpa.jdbc.sql.H2Dictionary" />
</bean>
</property> -->
</bean>
<bean id="btmConfig" factory-method="getConfiguration"
class="bitronix.tm.TransactionManagerServices">
<property name="serverId" value="spring-btm" />
<property name="journal" value="null" />
</bean>
<bean id="BitronixTransactionManager"
factory-method="getTransactionManager"
class="bitronix.tm.TransactionManagerServices"
depends-on="btmConfig,dataSource" destroy-method="shutdown" />
<bean id="jbpmTxManager"
class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="transactionManager"
ref="BitronixTransactionManager" />
<property name="userTransaction"
ref="BitronixTransactionManager" />
</bean>
<jbpm:kbase id="kbase">
<jbpm:resources>
<jbpm:resource type="BPMN2"
source="classpath:Evaluation.bpmn"/>
</jbpm:resources>
</jbpm:kbase>
<jbpm:ksession id="ksession" type="stateful"
kbase="kbase">
<jbpm:configuration>
<jbpm:jpa-persistence>
<jbpm:transaction-manager ref="jbpmTxManager"/>
<jbpm:entity-manager-factory ref="jbpmEMF"/>
</jbpm:jpa-persistence>
</jbpm:configuration>
</jbpm:ksession>
<bean id="dataSource"
class="bitronix.tm.resource.jdbc.PoolingDataSource"
init-method="init" destroy-method="close" >
<property name="className"
value="bitronix.tm.resource.jdbc.lrc.LrcXADataSource" />
<property name="uniqueName" value="jdbc/jbpm-ds"
/>
<property name="minPoolSize" value="1" />
<property name="maxPoolSize" value="3" />
<property name="allowLocalTransactions" value="true"
/>
<property name="driverProperties">
<props>
<prop
key="driverClassName">org.h2.Driver</prop>
<prop
key="url">jdbc:h2:tcp://localhost/jbpm;DB_CLOSE_DELAY=1000</prop>
<prop key="user">sa</prop>
<prop key="password"></prop>
</props>
</property>
</bean>
My jbpm-custom-persistence.xml
<persistence xmlns="
http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance
http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit name="org.jbpm.persistence.jta"
transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<!-- <jta-data-source>jdbc/jbpm-ds</jta-data-source>
-->
<!-- Use this if you are using JPA1 / Hibernate3 -->
<mapping-file>META-INF/JBPMorm.xml</mapping-file>
<mapping-file>META-INF/ProcessInstanceInfo.hbm.xml</mapping-file>
<!-- Use this if you are using JPA2 / Hibernate4 -->
<!--mapping-file>META-INF/JBPMorm-JPA2.xml</mapping-file
-->
<class>org.drools.persistence.info.SessionInfo</class>
<class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
<class>org.drools.persistence.info.WorkItemInfo</class>
<class>org.jbpm.process.audit.ProcessInstanceLog</class>
<class>org.jbpm.process.audit.NodeInstanceLog</class>
<class>org.jbpm.process.audit.VariableInstanceLog</class>
<properties>
<property name="hibernate.max_fetch_depth"
value="3" />
<property name="hibernate.hbm2ddl.auto"
value="update" />
<property name="hibernate.show_sql"
value="false" />
<property name="hibernate.dialect"
value="org.hibernate.dialect.H2Dialect" />
<property
name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.BTMTransactionManagerLookup"
/>
</properties>
</persistence-unit>
</persistence>
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/780087#780087]
Start a new discussion in jBPM at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]