jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Groschupf ...@media-style.com>
Subject Re: ... a transaction, reset caller principal
Date Thu, 19 Aug 2004 10:26:36 GMT
Hi Kazuhito,

thank you that helped very much!
I notice a strange side effect.
After closing the transaction my caller principal is reseted.

So I use the authentication mechanism described in cactus doc and it 
working fine in my test method until i start / commit the transaction.
Someone have any idea what kind of relation transactions and the caller 
principal have in weblogic?

Thanks
Stefan



Am 19.08.2004 um 03:32 schrieb Kazuhito SUGURI:

> Hi Stefan,
>
> In article <C2D87346-F134-11D8-B1BA-000A95D4944C@media-style.com>,
> Wed, 18 Aug 2004 18:36:31 +0200,
> Stefan Groschupf <sg@media-style.com> wrote:
> sg> [junit]     Caused an ERROR
> sg>      [junit] [EJB:010116]Attempted to access the collection valued
> sg> cmr-field, 'subscribers', for bean, 'Kit', outside the scope of a
> sg> transaction. All access to the collection must be performed during 
> the
> sg> transaction in which the collection was initially retrieved.
>
> As the error message says, you need to begin transaction
> to access to the collection (retrived for n:n relation).
>
> For example, I have used codes for CMR test with JBoss like follows:
>     public class CmrTestCase
>         extends ServletTestCase
>     {
>         protected UserTransaction transaction = null;
>         protected beginTransaction(){
>             if(transaction==null){
>                 transaction = 
> (UserTransaction)context.lookup("java:comp/env/UserTransaction");
>             }
> 	    transaction.begin();
>         }
>         protected commitTransaction(){
>             if(transaction==null){
>                 return;
>             }
>             if(transaction.getStatus()==Status.STATUS_ACTIVE){
>                 transaction.commit();
>             }
>         }
>
>         public void testXXX(){
>             beginTransaction();
>             // test codes for CMR etc.
>             commitTransaction();
>         }
>     }
>
>
> Hope this helps.
> ----
> Kazuhito SUGURI
> mailto:suguri.kazuhito@lab.ntt.co.jp
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org
>
>


Mime
View raw message