Hi David, Thank you for your response.
I saw also that there is a stateless session bean since some version of jbpm, but we have already a session facade to access our jbpm context. The part of our application using jbpm is tied more to the jbpm functionalities as the SLSB provides. Therefore it is not possible for us to move here to the jbpm SLSB, without huge impact on the existing business logic. The code base we use, started as a standalone application but are now going to JEE. In the code of the jbpm SLSB I saw that we were already used nearly similar code to access the jbpm context. The problem is that jbpm uses an own hibernate session (version 3.2 of jbpm is tied to hibernate). This session is initialized within JbpmConfiguration.getInstance().createJbpmContext(). You can configure it via the jbpm.cfg.xml and hibernate.cfg.xml (settings of database properties, transaction management etc.) which was the way if have tried and which results in the error of my first post. An alternative way is to set the hibernate session after the jbpm context was created with jbpmContext.setSession(session). At the moment I investigate this way also, but there are problems with closed session after method invokation, and I am not sure if this way is in an save transaction state. I hope that I have descripted our situation more clearly. Regards, Marco -----Ursprüngliche Nachricht----- Von: David Blevins [mailto:[email protected]] Gesendet: Dienstag, 10. März 2009 21:15 An: [email protected] Betreff: Re: How to use JBPM with openEJB? Hi Marco, The looking up of things from java:openejb is one of those areas that needs improvement. Going to see if I can't get somewhere with that now. I had a quick look at the JBMP docs and it looks like they support two modes, one where it runs as a standalone java application and one where it runs as a stateless ejb inside an ejb container. From the config you posted I'm guessing you're running it as a standalone application with OpenEJB embedded inside? Should be fine either way, just want to make sure I understand the goal as there are likely different options one way vs the other. -David On Mar 9, 2009, at 7:10 AM, <[email protected]> <[email protected] > wrote: > Hi experts, > > I try to get JBPM working with openEJB. The problem is that JBPM > cannot get the datasource for the hibernate session. > As far as I found out is that the JBPM uses an own InitialContext. > I try to configure the same initial context properties as for the > direct initial context lookup like (part of the hibernate.cfg.xml): > > <hibernate-configuration> > <session-factory> > <property name="hibernate.connection.datasource">java:openejb/ > Resource/TestDS</property> > > <property > name > = > "hibernate > .jndi > .java > .naming > .factory > .initial">org.apache.openejb.client.LocalInitialContextFactory</ > property> > <property > name="hibernate.jndi.openejb.deployments.classpath.ear">true</ > property> > <property > name="hibernate.jndi.openejb.jndiname.format">{deploymentId}/ > {interfaceType.annotationName}</property> > <property name="hibernate.jndi.openejb.altdd.prefix">test</ > property> > <property > name="hibernate.jndi.openejb.validation.output.level">VERBOSE</ > property> > > ... > > Also I found out the the database is registered under "java:openejb/ > Resource/TestDS", where I can access it via lookup in the initial > context, but it's not there as jbpm build this session. > > Here also a part of the stack trace: > > 2009-03-09 15:03:51,334 INFO org.hibernate.util.NamingHelper:26 - > JNDI InitialContext properties: > {java.naming.factory.initial=org.apache.openejb.clie > nt.LocalInitialContextFactory, > openejb.validation.output.level=VERBOSE, openejb.altdd.prefix=test, > openejb.jndiname.format={deploymentId}/{interfaceTy > pe.annotationName}, openejb.deployments.classpath.ear=true} > 2009-03-09 15:03:51,334 FATAL > org.hibernate.connection.DatasourceConnectionProvider:55 - Could not > find datasource: java:openejb/Resource/TestDS > javax.naming.NameNotFoundException: Name "java:openejb/Resource/ > TestDS" not found. > at > org > .apache.openejb.core.ivm.naming.IvmContext.federate(IvmContext.java: > 172) > at > org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java: > 129) > at javax.naming.InitialContext.lookup(InitialContext.java:351) > at > org > .hibernate > .connection > .DatasourceConnectionProvider > .configure(DatasourceConnectionProvider.java:52) > at > org > .hibernate > .connection > .ConnectionProviderFactory > .newConnectionProvider(ConnectionProviderFactory.java:124) > at > org > .hibernate > .connection > .ConnectionProviderFactory > .newConnectionProvider(ConnectionProviderFactory.java:56) > at > org > .hibernate > .cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java: > 414) > at > org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java: > 62) > at > org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2073) > at > org > .hibernate.cfg.Configuration.buildSessionFactory(Configuration.java: > 1298) > at > org > .jbpm > .persistence > .db > .DbPersistenceServiceFactory > .getSessionFactory(DbPersistenceServiceFactory.java:105) > at > org > .jbpm > .persistence > .db.DbPersistenceService.getSessionFactory(DbPersistenceService.java: > 95) > at > org > .jbpm > .persistence > .jta > .JtaDbPersistenceService > .isJtaTransactionInProgress(JtaDbPersistenceService.java:68) > at > org > .jbpm > .persistence > .jta.JtaDbPersistenceService.<init>(JtaDbPersistenceService.java:46) > at > org > .jbpm > .persistence > .jta > .JtaDbPersistenceServiceFactory > .openService(JtaDbPersistenceServiceFactory.java:66) > at org.jbpm.svc.Services.getService(Services.java:177) > at org.jbpm.svc.Services.getPersistenceService(Services.java: > 231) > at > org.jbpm.JbpmContext.getPersistenceService(JbpmContext.java:705) > at org.jbpm.JbpmContext.getGraphSession(JbpmContext.java:638) > > > I'm using openEJB 3.1 and JBPM 3.2.5.SP2. > I hope someone knows how to use JBPM within openEJB or can give me a > hint. > > Regards > Marco >
