[jboss-user] [jBPM] - Re: JBPM's persistence reusing existing connection

Pooja Arora do-not-reply at jboss.com
Tue Jan 3 07:11:39 EST 2012


Pooja Arora [http://community.jboss.org/people/arorapo] created the discussion

"Re: JBPM's persistence reusing existing connection"

To view the discussion, visit: http://community.jboss.org/message/644326#644326

--------------------------------------------------------------
Hi 

I am trying to integrate JBPM5(5.1.0.Final) with Sybase.
so, I have picked persistence.xml  and copied it in meta-inf directory of my application. now when I try to run below code.

            EntityManagerFactory emf = Persistence.createEntityManagerFactory("org.jbpm.persistence.jpa" );
            Environment env = KnowledgeBaseFactory.newEnvironment();
            env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
            env.set(EnvironmentName.TRANSACTION_MANAGER, TransactionManagerServices.getTransactionManager());    
            ksession = JPAKnowledgeService.newStatefulKnowledgeSession(kbase, null, env);
I got mentioned exception while creating ksession

*Caused by: java.lang.NullPointerException*
*    at org.drools.persistence.SingleSessionCommandService.<init>(SingleSessionCommandService.java:138)*
It comes up at below line in SingleSessionCommandService.java
 *((InternalKnowledgeRuntime) ksession).setId( this.sessionInfo.getId() );*
as *this.sessionInfo.getId()* is returning *null*.

My persistence.xml has below contents
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<persistence version="1.0"
    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
                                  http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm 
                                  http://java.sun.com/xml/ns/persistence/orm_1_0.xsd http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
    xmlns:orm=" http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance"
    xmlns=" http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence">

    <persistence-unit name="org.jbpm.persistence.jpa" transaction-type="RESOURCE_LOCAL">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <!--<jta-data-source>java:/jdbc/testDS1</jta-data-source> mapping-file>META-INF/JBPMorm.xml</mapping-file -->
        <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
        <class>org.drools.persistence.info.SessionInfo</class>
        <class>org.drools.persistence.info.WorkItemInfo</class>
        <properties>
            <property name="connection.driver_class" value="com.sybase.jdbc2.jdbc.SybDriver" />
            <property name="connection.url" value="<sybase.url>" />
            <property name="hibernate.dialect" value="org.hibernate.dialect.SybaseDialect" />
            <property name="connection.username" value="<username>" />
            <property name="connection.password" value="<password>" />
            <property name="hibernate.max_fetch_depth" value="3" />
            <property name="hibernate.hbm2ddl.auto" value="create" />
            <property name="hibernate.show_sql" value="true" />
        </properties>
    </persistence-unit>

</persistence>
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Please let me know if I am heading in right direction and your suggestions on the same.

Cheers
Pooja
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/644326#644326]

Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120103/4aed4094/attachment-0001.html 


More information about the jboss-user mailing list