Hey Ingo,

> Hi Simone,
> 
> Friday, December 22, 2000, 11:33:34 PM, you wrote:
> 
> BS> Hey,
> 
> BS> Ingo, you load bean VerstorbenerBean (D) and EhegatteBean 
> (C) from a jar
> BS> (with one CL, say CL1), and PersonBean (B) and 
> AdresseBean (A) from another
> BS> one (with CL2); in C.ejbActivate you do fBPK on bean B, 
> and you pass as
> BS> argument a PersonPK object, is this true ?
> No, I do not pass PersonPK as an argument. I got PersonPK with
> getPrimaryKey() from the EntityContext in PeronBean. What is fBPK ?

fBPK == findByPrimaryKey
CL = ClassLoader

See your code below: in C(EhegatteBean).ejbActivate:

PersonPK key = new PersonPK(); // Loaded with CL1
...
person = personHome.findByPrimaryKey(key);

So you *do* pass a PersonPK object as argument to fBPK. But this class is
loaded with CL1.

Now inside PersonBean, if you call EntityContext.getPrimaryKey() you get
CL1#PersonPK, while if you do new PersonPK you get a CL2#PersonPK, hence the
ClassCastException.

Bye

Simon


> BS> If so, then you load PersonPK with CL1, and the 
> EntityContext references
> BS> CL1#PersonPK.
> BS> But then B.ejbActivate is called, and there you cast to 
> PersonPK (which is
> BS> here loaded with CL2):
> BS> CL2#PersonPK pk = (CL2#PersonPK)ectx.getPrimaryKey(). 
> Unfortunately
> BS> ectx.getPrimaryKey() returns CL1#PersonPK.
> Some of the discussion I had directly with Rickard cause of the slow
> mail transfer with this list (more then one our).
> 
> BS> If not so, can you post bean C code ? (ejbActivate and 
> ejbRemove at least)
> 
> Sure, following.
> 
> BS> Rickard, I'm not 100% sure of this, WDYT ? Am I missing 
> something ?
> BS> IMHO the cache can't do anything in this situation. How 
> should I be supposed
> BS> to fix this problem ?
> 
> BS> Ingo, I haven't thought about so much, but the only 
> solution I found is the
> BS> one you found, a third jar under lib/ext. Rickard ?
> I think that this scenario could happen often in the case of reusing
> components.

Agree.

> BS> Merry Christmas and happy new year to everybody !
> 
> Dito.
> 
> Here ejbActivate and ejbRemove from EhegatteBean (C):
> 
> ---- snip ----
>   public void ejbRemove() throws RemoteException, RemoveException {
>     super.ejbRemove(); // Just for testing
>     person.remove();
>     person = null;
>   }
> 
>   public void ejbActivate() throws RemoteException {
>     super.ejbActivate();
>     PersonHome personHome;
>     PersonPK key = new PersonPK();
>     try {
>       System.out.println("Versuche Person <" + 
> ((EhegattePK)ectx.getPrimaryKey()).Mandant +
>           "> <" + ((EhegattePK)ectx.getPrimaryKey()).Nummer + 
> "> <E> zu finden.");
>       key.Mandant = ((EhegattePK)ectx.getPrimaryKey()).Mandant;
>       key.Nummer = ((EhegattePK)ectx.getPrimaryKey()).Nummer;
>       key.Type = "E";
>       personHome = getPersonHome();
>       person = personHome.findByPrimaryKey(key);
>     } catch(NamingException nex) {
>       System.out.println("Naming: " + nex);
>       throw new RemoteException("Naming: " + nex.getMessage());
>     } catch(FinderException fex) {
>       System.out.println("Finder: " + fex);
>       throw new RemoteException("Finder: " + fex.getMessage());
>     } catch(Exception ex) {
>       System.out.println("Other: " + ex);
>       throw new RemoteException("Other: " + ex.getMessage());
>     }
>   }
> ---- snap ----
> 
> I wish Marry Cristmas and happy new year, too.
> 
> 
> so long
> 
> 
> Ingo Bruell                                 
> 
> ---
> <[EMAIL PROTECTED]>
> <ICQ# 40377720>
> Oldenburg    PGP-Fingerprint: CB01 AE12 B359 87C4 BF1C  953C 
> 8FE7 C648 169E E5FC
> Germany      PGP-Public-Key available at pgpkeys.mit.edu
> Germany      PGP-Public-Key available at pgpkeys.mit.edu
> 
> 
> 

Reply via email to