It's me again,

I tried to go a step back and want to get only the jbpm SLSB to run.
After I hack against the issue 
https://issues.apache.org/jira/browse/OPENEJB-971, I can start up the ejb 
components of jbpm in openejb:

2009-03-12 11:40:21,259  INFO OpenEJB.startup:70 - Deployed 
Application(path=classpath.ear)
2009-03-12 11:40:21,259 DEBUG OpenEJB.startup:82 - Containers        : 5
2009-03-12 11:40:21,259 DEBUG OpenEJB.startup:82 - Type        Container ID
2009-03-12 11:40:21,259 DEBUG OpenEJB.startup:82 -    CMP ENTITY  My CMP 
Container
2009-03-12 11:40:21,259 DEBUG OpenEJB.startup:82 -    STATEFUL    My Stateful 
Container
2009-03-12 11:40:21,259 DEBUG OpenEJB.startup:82 -    MESSAGE     My MDB 
Container
2009-03-12 11:40:21,259 DEBUG OpenEJB.startup:82 -    BMP ENTITY  My BMP 
Container
2009-03-12 11:40:21,275 DEBUG OpenEJB.startup:82 -    STATELESS   My Stateless 
Container
2009-03-12 11:40:21,275 DEBUG OpenEJB.startup:82 - Deployments       : 6
2009-03-12 11:40:21,275 DEBUG OpenEJB.startup:82 - Type        Deployment ID
2009-03-12 11:40:21,275 DEBUG OpenEJB.startup:82 -    MESSAGE     
JobListenerBean
2009-03-12 11:40:21,275 DEBUG OpenEJB.startup:82 -    CMP_ENTITY  
TimerEntityBean
2009-03-12 11:40:21,275 DEBUG OpenEJB.startup:82 -    STATELESS   
TimerServiceBean
2009-03-12 11:40:21,275 DEBUG OpenEJB.startup:82 -    STATELESS   
CommandServiceBean
2009-03-12 11:40:21,275 DEBUG OpenEJB.startup:82 -    MESSAGE     
CommandListenerBean
2009-03-12 11:40:21,275 DEBUG OpenEJB.startup:82 -    STATEFUL    JbpmFacadeImpl
2009-03-12 11:40:21,275 DEBUG OpenEJB.startup:82 - SecurityService   : 
org.apache.openejb.core.security.SecurityServiceImpl
2009-03-12 11:40:21,275 DEBUG OpenEJB.startup:82 - TransactionManager: 
org.apache.geronimo.transaction.manager.GeronimoTransactionManager
2009-03-12 11:40:21,290 DEBUG OpenEJB.startup:82 - OpenEJB Container System 
ready.

But when I access the SLSB I got finally into the same exception as in my first 
post, when the jbpm context is built:

2009-03-12 12:46:09,068 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:64)
        at 
org.jbpm.persistence.jta.JtaDbPersistenceService.<init>(JtaDbPersistenceService.java:46)
        at 
org.jbpm.persistence.jta.JtaDbPersistenceServiceFactory.openService(JtaDbPersistenceServiceFactory.java:63)
        ...

There is some part in the hibernate code to get the InitialContext:

package org.hibernate.util;
...
public final class NamingHelper
{

    ...

    public static InitialContext getInitialContext(Properties props)
        throws NamingException
    {
        Hashtable hash = getJndiProperties(props);
        log.info("JNDI InitialContext properties:" + hash);
        try
        {
            return hash.size() != 0 ? new InitialContext(hash) : new 
InitialContext();
        }
        catch(NamingException e)
        {
            log.error("Could not obtain initial context", e);
            throw e;
        }
    }
    ...

I get here an IvmContext, but it seems that this context doesn't contains the 
JNDI information as the context I've build to initialize openEJB.

So I'm am lost again at the same part as before.

Regards
Marco

-----Ursprüngliche Nachricht-----
Von: [email protected] [mailto:[email protected]]
Gesendet: Mittwoch, 11. März 2009 13:55
An: [email protected]
Betreff: AW: How to use JBPM with openEJB?

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
>



Reply via email to