Bugs item #643673, was opened at 2002-11-25 18:40
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=643673&group_id=22866
Category: JBossServer
Group: None
Status: Closed
Resolution: Invalid
Priority: 5
Submitted By: Alvaro Mota Goncalves (alvaromota)
Assigned to: Nobody/Anonymous (nobody)
Summary: ClassCastException
Initial Comment:
SO - Linux RedHat
JVM 1.3.1-06 Sun , 1.3.1 - Blackdown , 1.4.1 Sun
JBOSS Server 3.0.4 and 3.0.3
A session Bean packaged in a jar file (Session01.jar)
is calling
one entity bean packaged in another jar file
(Entity01.jar) .
Works great.
I have one client in Tomcat in another machine.
If I hot-deploy Session01.jar, it's work. But hot-deploy
Entity01
get
20:34:59,449 ERROR [LogInterceptor] RuntimeException:
java.lang.ClassCastException: $Proxy156
at
com.da.motion.testeAlvaro.model.statelessEJB.SManterTesteEJB.find
All(SManterTes
teEJB.java:75)
The solution is to hot-deploy Entity01 and Session01 in
sequence works fine.
Thanks
Alvaro
----------------------------------------------------------------------
>Comment By: Christian Riege (lqd)
Date: 2002-11-26 09:05
Message:
Logged In: YES
user_id=176671
alvaro,
simply put: you can't.
scott explained this in great detail below: "The type of a
class is its fully qualified name + the class loader that
loaded it.". Once you lookup the EntityBean from your
SessionBean, the class is defined by the Unified ClassLoader
(this is what UCL stands for btw) that loaded your
"Entity01.jar". On redeploy, this UCL will be gone and a new
one is created. So the reference that the Session Bean has
points to the old UCL which is now invalid.
Redeploying Session01.jar helps b/c once you call the
Finder, the class will be loaded again (Session01.jar
doesn't know about it yet).
Package both files in an .ear and redeploy that. Everything
else WILL NOT WORK.
----------------------------------------------------------------------
Comment By: Alvaro Mota Goncalves (alvaromota)
Date: 2002-11-26 00:17
Message:
Logged In: YES
user_id=354157
Mr Scott
When the session doesn't reference the local entity, the
entity redeploy
works. But, when the session makes at least one lookup to
Entity, the problem occurs.
Since the lookup Session-->Entity doesn't keep state,
Why the link between the Session and the entity keeps the state?
Regards
Alvaro
----------------------------------------------------------------------
Comment By: Bill Wadley (wrwadley)
Date: 2002-11-25 22:33
Message:
Logged In: YES
user_id=223475
My problem:
ClassCastExceptions on results from finders: "$Proxy123"
(numbers different per invocation)
- EJB's in .jar, Servlets in .war, all in .ear.
- Hot-deploy or server restart, it didn't matter.
- changed JVM's for server (1.3.1, 1.3.1_01, 1.4.1,
1.4.1_01); didn't matter
My solution:
Stop compiling with Jikes 1.15 and use the same java/javac
that I'm running the server with (Sun JDK 1.4.1).
Now all is well.
----------------------------------------------------------------------
Comment By: Alvaro Mota Goncalves (alvaromota)
Date: 2002-11-25 21:25
Message:
Logged In: YES
user_id=354157
Ok
I need to redeploy only the ejb-jar, without needing to
redeploy the whole application (ear).
How can i do this?
Thanks
Alvaro
----------------------------------------------------------------------
Comment By: Scott M Stark (starksm)
Date: 2002-11-25 21:20
Message:
Logged In: YES
user_id=175228
Its not possible which is why these ejbs need to be deployed
together in an ear so that redeployment cycles the classes
consistently.
----------------------------------------------------------------------
Comment By: Alvaro Mota Goncalves (alvaromota)
Date: 2002-11-25 21:17
Message:
Logged In: YES
user_id=354157
Hi Mr. Scott
-->Deployments with explicit references to each other must be
deployed as a unit so that the Java type system remains
consistent.
How is possible to make an unexplicit reference to Entity Local
in another ejb-jar.file(Entity01.jar).?
Session --> Entity
The source code is:
private ECepTituloHome getHome() {
ECepTituloHome home = null;
try {
//Implementar o getHome Local para o JBOSS
InitialContext jndi = new InitialContext();
// delete all organizations
home = (ECepTituloHome)
jndi.lookup("ejb/entityEJB/ECepTituloBeanRef");
}
catch (Exception e) {
System.err.println(e.getMessage());
}
finally {
return home;
}
}
The client lookup source code is:
private SManterTesteHome getHome() {
SManterTesteHome home = null;
try {
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
env.put(Context.PROVIDER_URL, "alvaro.rededc.com.br:1099");
Context jndi = new InitialContext(env);
Object ref =
jndi.lookup("ejb/statelessEJB/SManterTesteBeanRef");
home = (SManterTesteHome) PortableRemoteObject.narrow(ref,
SManterTesteHome.class);
}
catch (Exception e) {
System.out.println("A" + e.getMessage());
e.printStackTrace();
}
finally {
return home;
}
}
Thanks
Alvaro
----------------------------------------------------------------------
Comment By: Alvaro Mota Goncalves (alvaromota)
Date: 2002-11-25 21:07
Message:
Logged In: YES
user_id=354157
My enviroment is the following.
1 ) a remote client in a linux machine
2) JBOSS in another machine, Session Fa�ade --> Entity Bean
3 ) Oracle 8.i RDMS
in server/default/deploy/ i have :
- One Remote SLSB in Session01.jar
- One Local Entity in Entity02.jar
First Scenario:
- I change SLSB and make redeploy coping and overwriting
Session01.jar
it works.
Second Scenario:
- I change Entity and make redeploy coping and overwriting
Entity01.jar
I get an error:
ClassCastException $Proxy
- I redeploy Session
it works.
i attached the server log in this message.
What's UCL?
Thanks
Alvaro
----------------------------------------------------------------------
Comment By: Bill Burke (patriot1burke)
Date: 2002-11-25 20:51
Message:
Logged In: YES
user_id=176497
Thanks for clarifying.
----------------------------------------------------------------------
Comment By: Scott M Stark (starksm)
Date: 2002-11-25 20:42
Message:
Logged In: YES
user_id=175228
All that says is that the $Proxy156 does not implement the
interface the proxy is being cast to. This is expected if you
redeploy the entity bean and perform a finder call from the
session bean that has an explicit reference to the previous
version of the entity interface. Unless there is an example
that shows the session bean has no explicit references to
the entity interfaces the redeployment described is not valid.
----------------------------------------------------------------------
Comment By: Bill Burke (patriot1burke)
Date: 2002-11-25 20:32
Message:
Logged In: YES
user_id=176497
Re-opening.
Look at the stack trace. The CCE is around $Proxy156. Is there
something going on between UCL and dynamically generated
classes via java.lang.reflect.Proxy?
----------------------------------------------------------------------
Comment By: Scott M Stark (starksm)
Date: 2002-11-25 19:26
Message:
Logged In: YES
user_id=175228
Deployments with explicit references to each other must be
deployed as a unit so that the Java type system remains
consistent. The type of a class is its fully qualified name +
the class loader that loaded it. You cannot arbitrary redeploy
components and introduce a new type and expect previously
deployed components to continue to work unless the
interaction between the components is completely stateless
with respect to the classes shared between deployments.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=643673&group_id=22866
-------------------------------------------------------
This SF.net email is sponsored by: Get the new Palm Tungsten T
handheld. Power & Color in a compact size!
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development