Sure, unless the call starts a new thread or goes through an interceptor
stack, as far as jboss is concerned its the same context/object/whatever.

There may be some problems with serialized datasources, at the moment you
might need to look up the ds from its name if you don't bind using an
object factory.

david jencks

On 2002.05.23 19:44:02 -0400 Dmitri Colebatch wrote:
> Hi,
> 
> This is something I was going to ask anyway, and kinda ties in here.
> 
> If I develop a module, and bind it locally in JNDI, and this module
> requires database access.  Can I have something like what JD
> drew below, and maintain tx context... eg:
> 
>   1. client calls EJB with required tx
>   2. EJB calls my module
>   3. my module accesses db through DataSource
>   4. my module returns
>   5. EJB call completes, and tx commits
> 
> make sense?  I'm not introducing any new threads, so afaik it should be
> ok - but wanted to check?  COuld someone confirm for me
> please?
> 
> cheers
> dim
> 
> ----- Original Message -----
> From: "David Jencks" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, May 24, 2002 7:15 AM
> Subject: Re: [JBoss-user] Is it possible to use a Local Interface to an
> EJB from an MBean t hread in the same VM?
> 
> 
> > If you start a new thread, you've lost your transaction context.  The
> error
> > looks a bit as if a transaction is missing.  How about trying with a
> > current jboss 3 version and telling us what the transaction settings on
> > your ejb's are?
> >
> > david jencks
> >
> > On 2002.05.23 16:35:00 -0400 JD Brennan wrote:
> > > I've got
> > >
> > > client -> EJB -> MBean -> EJB
> > >   1        2       3       4
> > >
> > > this works fine when 2, 3 and 4 are all in the same
> > > thread, but when I have the MBean create a new thread
> > > I get NullPointerException (stack trace is below) trying
> > > to call my EJB through a local interface.
> > >
> > > I'm using an MBean so I can create a thread to have
> > > things run asynchronously in JBoss.  Is this not
> > > the right way to design this?  Should it work?
> > >
> > > JBoss 3.0 Beta
> > > Linux
> > > JDK 1.4
> > >
> > > Thanks!
> > > JD
> > >
> > > Stack trace:
> > > 13:22:08,797 ERROR [LogInterceptor] TransactionRolledbackException,
> > > causedBy:
> > > java.lang.NullPointerException
> > >         at
> > > org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.getApplicationTxDataMap(JDBC
> > > StoreManager.java:196)
> > >         at
> > > org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.getApplicationTxData(JDBCSto
> > > reManager.java:212)
> > >         at
> > > org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.getEntityTxDataMap(JDBCStore
> > > Manager.java:224)
> > >         at
> > > org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.getEntityTxData(JDBCStoreMan
> > > ager.java:233)
> > >         at
> > > org.jboss.ejb.plugins.cmp.jdbc.ReadAheadCache.getPreloadDataMap(ReadAheadCac
> > > he.java:368)
> > >         at
> > > org.jboss.ejb.plugins.cmp.jdbc.ReadAheadCache.load(ReadAheadCache.java:204)
> > >         at
> > > org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.execute(JDBCLoadEntityC
> > > ommand.java:76)
> > >         at
> > > org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.execute(JDBCLoadEntityC
> > > ommand.java:62)
> > >         at
> > > org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadEntity(JDBCStoreManager.
> > > java:415)
> > >         at
> > > org.jboss.ejb.plugins.CMPPersistenceManager.loadEntity(CMPPersistenceManager
> > > .java:388)
> > >         at
> > > org.jboss.resource.connectionmanager.CachedConnectionInterceptor.loadEntity(
> > > CachedConnectionInterceptor.java:304)
> > >         at
> > > org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchron
> > > izationInterceptor.java:283)
> > >         at
> > > org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(Cach
> > > edConnectionInterceptor.java:147)
> > >         at
> > > org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterce
> > > ptor.java:187)
> > >         at
> > > org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.jav
> > > a:107)
> > >         at
> > > org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor
> > > .java:96)
> > >         at
> > > org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.
> > > java:219)
> > >         at
> > > org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:61)
> > >         at
> > > org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:12
> > > 7)
> > >         at
> > > org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:166)
> > >         at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:474)
> > >         at
> > > org.jboss.ejb.plugins.local.BaseLocalContainerInvoker.invoke(BaseLocalContai
> > > nerInvoker.java:307)
> > >         at
> > > org.jboss.ejb.plugins.local.BaseLocalContainerInvoker$EntityProxy.invoke(Bas
> > > eLocalContainerInvoker.java:407)
> > >         at $Proxy531.getTaskType(Unknown Source)
> > >         at
> > > com.rendition.service.TaskDaemon$TaskRunner.run(TaskDaemon.java:420)
> > >         at java.lang.Thread.run(Thread.java:536)
> > > 13:22:08,802 ERROR [STDERR] javax.ejb.TransactionRolledbackLocalException:
> > > Error getting application tx data map.
> > > Embedded Exception
> > > null; nested exception is:
> > >         javax.ejb.EJBException: Error getting application tx data
> map.
> > > Embedded Exception
> > > null
> > > Embedded Exception
> > > Error getting application tx data map.
> > > Embedded Exception
> > > null; nested exception is:
> > >         javax.ejb.EJBException: Error getting application tx data
> map.
> > > Embedded Exception
> > > null
> > > --
> > >
> > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
> > > <HTML>
> > > <HEAD>
> > > <META HTTP-EQUIV="Content-Type" CONTENT="text/html;
> charset=iso-8859-1">
> > > <META NAME="Generator" CONTENT="MS Exchange Server version
> 5.5.2653.12">
> > > <TITLE>Is it possible to use a Local Interface to an EJB from an
> MBean
> > > thread in the same VM?</TITLE>
> > > </HEAD>
> > > <BODY>
> > >
> > > <P><FONT SIZE=2>I've got</FONT>
> > > </P>
> > >
> > > <P><FONT SIZE=2>client -&gt; EJB -&gt; MBean -&gt; EJB</FONT>
> > > <BR><FONT SIZE=2>&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> > > 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> > > 3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4</FONT>
> > > </P>
> > >
> > > <P><FONT SIZE=2>this works fine when 2, 3 and 4 are all in the
> > > same</FONT>
> > > <BR><FONT SIZE=2>thread, but when I have the MBean create a new
> > > thread</FONT>
> > > <BR><FONT SIZE=2>I get NullPointerException (stack trace is below)
> > > trying</FONT>
> > > <BR><FONT SIZE=2>to call my EJB through a local interface.</FONT>
> > > </P>
> > >
> > > <P><FONT SIZE=2>I'm using an MBean so I can create a thread to
> > > have</FONT>
> > > <BR><FONT SIZE=2>things run asynchronously in JBoss.&nbsp; Is this
> > > not</FONT>
> > > <BR><FONT SIZE=2>the right way to design this?&nbsp; Should it
> > > work?</FONT>
> > > </P>
> > >
> > > <P><FONT SIZE=2>JBoss 3.0 Beta</FONT>
> > > <BR><FONT SIZE=2>Linux</FONT>
> > > <BR><FONT SIZE=2>JDK 1.4</FONT>
> > > </P>
> > >
> > > <P><FONT SIZE=2>Thanks!</FONT>
> > > <BR><FONT SIZE=2>JD</FONT>
> > > </P>
> > >
> > > <P><FONT SIZE=2>Stack trace:</FONT>
> > > <BR><FONT SIZE=2>13:22:08,797 ERROR [LogInterceptor]
> > > TransactionRolledbackException, causedBy:</FONT>
> > > <BR><FONT SIZE=2>java.lang.NullPointerException</FONT>
> > > <BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> > > 
>org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.getApplicationTxDataMap(JDBCStoreManager.java:196)</FONT>
> > > <BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> > > 
>org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.getApplicationTxData(JDBCStoreManager.java:212)</FONT>
> > > <BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> > > 
>org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.getEntityTxDataMap(JDBCStoreManager.java:224)</FONT>
> > > <BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> > > 
>org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.getEntityTxData(JDBCStoreManager.java:233)</FONT>
> > > <BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> > > 
>org.jboss.ejb.plugins.cmp.jdbc.ReadAheadCache.getPreloadDataMap(ReadAheadCache.java:368)</FONT>
> > > <BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> > > 
>org.jboss.ejb.plugins.cmp.jdbc.ReadAheadCache.load(ReadAheadCache.java:204)</FONT>
> > > <BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> > > 
>org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.execute(JDBCLoadEntityCommand.java:76)</FONT>
> > > <BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> > > 
>org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.execute(JDBCLoadEntityCommand.java:62)</FONT>
> > > <BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> > > 
>org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadEntity(JDBCStoreManager.java:415)</FONT>
> > > <BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> > > 
>org.jboss.ejb.plugins.CMPPersistenceManager.loadEntity(CMPPersistenceManager.java:388)</FONT>
> > > <BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> > > 
>org.jboss.resource.connectionmanager.CachedConnectionInterceptor.loadEntity(CachedConnectionInterceptor.java:304)</FONT></P>
> > >
> > > <P><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> > > 
>org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchronizationInterceptor.java:283)</FONT>
> > > <BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> > > 
>org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:147)</FONT></P>
> > >
> > > <P><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> > > 
>org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:187)</FONT>
> > > <BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> > > 
>org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:107)</FONT>
> > > <BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> > > 
>org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:96)</FONT>
> > > <BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> > > 
>org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:219)</FONT>
> > > <BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> > > org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:61)</FONT>
> > > <BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> > > 
>org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:127)</FONT>
> > > <BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> > > org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:166)</FONT>
> > > <BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> > > org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:474)</FONT>
> > > <BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> > > 
>org.jboss.ejb.plugins.local.BaseLocalContainerInvoker.invoke(BaseLocalContainerInvoker.java:307)</FONT>
> > > <BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> > > 
>org.jboss.ejb.plugins.local.BaseLocalContainerInvoker$EntityProxy.invoke(BaseLocalContainerInvoker.java:407)</FONT>
> > > <BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> > > $Proxy531.getTaskType(Unknown Source)</FONT>
> > > <BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> > > com.rendition.service.TaskDaemon$TaskRunner.run(TaskDaemon.java:420)</FONT>
> > > <BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> > > java.lang.Thread.run(Thread.java:536)</FONT>
> > > <BR><FONT SIZE=2>13:22:08,802 ERROR [STDERR]
> > > javax.ejb.TransactionRolledbackLocalException: Error getting
> application
> > > tx data map.</FONT>
> > > <BR><FONT SIZE=2>Embedded Exception</FONT>
> > > <BR><FONT SIZE=2>null; nested exception is: </FONT>
> > > <BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> > > javax.ejb.EJBException: Error getting application tx data map.</FONT>
> > > <BR><FONT SIZE=2>Embedded Exception</FONT>
> > > <BR><FONT SIZE=2>null</FONT>
> > > <BR><FONT SIZE=2>Embedded Exception</FONT>
> > > <BR><FONT SIZE=2>Error getting application tx data map.</FONT>
> > > <BR><FONT SIZE=2>Embedded Exception</FONT>
> > > <BR><FONT SIZE=2>null; nested exception is: </FONT>
> > > <BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> > > javax.ejb.EJBException: Error getting application tx data map.</FONT>
> > > <BR><FONT SIZE=2>Embedded Exception</FONT>
> > > <BR><FONT SIZE=2>null</FONT>
> > > <BR><FONT SIZE=2>--</FONT>
> > > </P>
> > >
> > > </BODY>
> > > </HTML>
> > >
> >
> > _______________________________________________________________
> >
> > Don't miss the 2002 Sprint PCS Application Developer's Conference
> > August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
> >
> > _______________________________________________
> > JBoss-user mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/jboss-user
> >
> 
> 
> _______________________________________________________________
> 
> Don't miss the 2002 Sprint PCS Application Developer's Conference
> August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
> 
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user
> 
> 

_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm

_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to