Yes. I found a workaround on the dev-list, by setting the classloader before lookup,
but it should be fixed.
I'have kind off the same problem with any cast to a home or remote object i get exceptions like this all the time:
at java.lang.reflect.Method.invoke(Native Method)
i don't really understand about setting the classloader before lookup, what am i supposed to set ?
oops that last one was just for junit swingui. but the problem still remains for entity beans. I get the cast exception at create(somekey) but the records are written into the database so everything seems to be fine if it wasn't for the stacktrace??
I am using JBoss-2.4.3_Tomcat-3.2.3.
could you give specific detail on how to set class loader?
This is what I did:
// FIX because of bug i JBOSS
ClassLoader oldClass = Thread.currentThread().getContextClassLoader();
Properties prop = new Properties();
prop.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory" );
prop.setProperty("java.naming.provider.url", "127.0.0.1:1099" );
InitialContext ctx = new InitialContext( prop );
Object o = ctx.lookup("something");
RegistrarHome regHome = (RegistrarHome) PortableRemoteObject.narrow( o, RegistrarHome.class );
Registrar registrar = regHome.create();
It removed this problem (but I think you have to do it on
all lookups.....) and introduced this bug:
so I ended up going back to jboss alpha from Jan 16 (08.30 AM), which works with this patch:
Forgot to say that I encountered this problem on the new jboss 3.0 beta.
I encountered a similar problem (jboss 2.4.3) after bean passivation when I stored a reference to a Stateful SessionBean in another Stateful SessionBean and posted it to the jboss userlist on January 17. 2002. But I didn't get a satisfactory answer:
> I want to store references to stateful sessionbeans in a
> Hashtable of a
> stateful sessionbean.
> I tried to store the beanhandle and got a weird behavior:
> The classname of the stored objects has been
> When I get the object from the Hashtable normally the
> classname is correct,
> but when the bean has been passivated and activated the
> classname has been
> something like '$Proxy3'
> and I get a ClassCastException on the cast to a Handle.
> I know the classname of the bean references in jboss is
> somthing like $Proxy
> (to see sometimes in Exception printStackTrace ...). It looks
> like that
> through passivation / activation the handles have been restored to the
> remoteinterfaces of the beans ....
> What's going on here ?
> How should I store bean references: as remoteinterface or handle ?
I attach a zip-file with code, jar and server.log of a simple sample.