You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by Stefan Groschupf <sg...@media-style.com> on 2004/08/19 12:26:36 UTC

Re: ... a transaction, reset caller principal

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 <C2...@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
>
>