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 <[EMAIL PROTECTED]>,
Wed, 18 Aug 2004 18:36:31 +0200,
Stefan Groschupf <[EMAIL PROTECTED]> 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:[EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to