[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jboss-user
Subject:    Re: [JBoss-user] ClassCastException on PortableRemoteObject.narrow
From:       David Jencks <davidjencks () directvinternet ! com>
Date:       2003-01-30 1:53:03
[Download RAW message or body]

This is expected.  Each time you redeploy you get a different 
classloader, thus different classes.  You may be able to work around 
this by including the interfaces in question ONLY in the "session bean" 
.ear, but I think you will then have to deploy in reverse order.

david jencks
On Wednesday, January 29, 2003, at 06:56 PM, Eric Klimas wrote:

> Hi all,
>
> I'm using Jboss 3.0.4 w/ Tomcat 4.1.12, running Sun's JDK (build
> 1.4.0_01-b03), on Solaris 7.  I have one ear file which contains a 
> bunch
> of local entity CMP 2.0 beans that access my database.  I have a
> separate ear file containing a session bean that looks the Entity beans
> up via the global JNDI, and trys to use the local interface to do its
> work.
>
> The problem I'm encountering, is that if I redeploy the ear file
> containing the entity beans without redeploying the ear containing the
> session bean, when I go to retrieve my local interface via the 
> following
> code I get a ClassCastException:
>
> private UserLocalHome getUserLocalHome()
> throws NamingException
> {
>     UserLocalHome home = null;
>     InitialContext ctx = new InitialContext();
>
>     try
>     {
>         home = (UserLocalHome)
>                 PortableRemoteObject.narrow(
>                      ctx.lookup("ejb/iaf/User"), UserLocalHome.class);
>
>     }
>     finally
>     {
>        ctx.close();
>     }
> }
>
> If I simply go and redeploy the ear containing the session bean after
> that, everything works again.  Is this supposed to happen and if so, 
> can
> somebody explain it.  I know that class files have the notion of a
> version, but the interface is really not changing at all between
> redeployments, etc.
>
> Also, I read on some jboss-user list archive of people experiencing
> similar problems if the ear files contained jndi.properties files.  I
> have double-checked this and can assure you that neither of my .ear
> files have this.
>
> Thanks in advance for any help,
>
> -Eric
>
> Snippet from server.log w/ exception is attached
>
> <exception.txt>



-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic