-
1. Re: Classcastexception(again) driving me crazy
anderssv Jan 14, 2003 6:19 AM (in response to anderssv)So I figured the question of the EJB's in the war classpath from the quick start guide. You have to include the client interfaces in the lib dir. But that still doesn't solve the problem of classcastexception after a redeploy.
Anders, -
2. Re: Classcastexception(again) driving me crazy
anderssv Jan 14, 2003 6:28 AM (in response to anderssv)The problem is still present with the 3.0.5 release of JBoss. :(
Anders, -
3. Re: Classcastexception(again) driving me crazy
adrian.brock Jan 14, 2003 9:23 AM (in response to anderssv)Try the following piece of code:
Object obj = context.lookup("Test");
System.out.println(obj.getClass() + " " + obj.getClass().getClassLoader());
Class[] interfaces = obj.getClass().getInterfaces();
for (int i = 0; i < interfaces; ++i)
{
System.out.println(interfaces + " " + interfaces.getClassLoader());
}
Before and after the re-deployment.
Regards,
Adrian -
4. Re: Classcastexception(again) driving me crazy
adrian.brock Jan 14, 2003 9:27 AM (in response to anderssv)The italics mark-up in the forums got in the way :-)
for (int xx = 0; xx < interfaces.length; ++xx)
{
System.out.println(interfaces[xx] + " " + interfaces[xx].getClassLoader());
}
Regards,
Adrian -
5. Re: Classcastexception(again) driving me crazy
anderssv Jan 15, 2003 1:08 PM (in response to anderssv)Hjm, tried it, and the objects seem the same. Should they be changed?
Before reload, the pages load fine:
19:11:46,642 INFO [STDOUT] Loader:
class $Proxy25 : org.jboss.mx.loading.UnifiedClassLoader3@13adc56{ url=file:/C:/java/jboss-3.0.4/server/default/tmp/deploy/server/default/lib/jnpserver.jar/36.jnpserver.jar }
19:11:46,642 INFO [STDOUT] Interfaces:
interface no.f12.ejb.TestHome : org.jboss.mx.loading.UnifiedClassLoader3@1b09282{ url=file:/C:/java/jboss-3.0.4/server/default/deploy/f12.ear/f12ejb.jar/ }
interface javax.ejb.Handle : org.jboss.mx.loading.UnifiedClassLoader3@1bd2664{ url=file:/C:/java/jboss-3.0.4/server/default/tmp/deploy/server/default/lib/jboss-j2ee.jar/17.jboss-j2ee.jar }
After reload, the pages fail with a 500 error:
19:13:51,391 INFO [STDOUT] Loader:
class $Proxy25 : org.jboss.mx.loading.UnifiedClassLoader3@13adc56{ url=file:/C:/java/jboss-3.0.4/server/default/tmp/deploy/server/default/lib/jnpserver.jar/36.jnpserver.jar }
19:13:51,391 INFO [STDOUT] Interfaces:
interface no.f12.ejb.TestHome : org.jboss.mx.loading.UnifiedClassLoader3@1b09282{ url=file:/C:/java/jboss-3.0.4/server/default/deploy/f12.ear/f12ejb.jar/ }
interface javax.ejb.Handle : org.jboss.mx.loading.UnifiedClassLoader3@1bd2664{ url=file:/C:/java/jboss-3.0.4/server/default/tmp/deploy/server/default/lib/jboss-j2ee.jar/17.jboss-j2ee.jar }
The exception I'm getting is:
19:13:51,652 WARN [jbossweb] WARNING: Exception for /f12/info/Info.do?command=testEJB
java.lang.ClassCastException
at no.f12.actions.info.InfoAction.testEJB(InfoAction.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:220)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:446)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:266)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:366)
at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:293)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:581)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1687)
at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:544)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1637)
at org.mortbay.http.HttpServer.service(HttpServer.java:875)
at org.jboss.jetty.Jetty.service(Jetty.java:543)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:806)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:956)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:823)
at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:203)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:290)
at org.mortbay.util.ThreadPool$JobRunner.run(ThreadPool.java:743)
at java.lang.Thread.run(Thread.java:536)
Thanks,
Anders, -
6. Re: Classcastexception(again) driving me crazy
anderssv Jan 15, 2003 1:12 PM (in response to anderssv)Hjm, tried it, and the objects seem the same. Should they be changed?
Before reload, the pages load fine:
19:11:46,642 INFO [STDOUT] Loader:
class $Proxy25 : org.jboss.mx.loading.UnifiedClassLoader3@13adc56{ url=file:/C:/java/jboss-3.0.4/server/default/tmp/deploy/server/default/lib/jnpserver.jar/36.jnpserver.jar }
19:11:46,642 INFO [STDOUT] Interfaces:
interface no.f12.ejb.TestHome : org.jboss.mx.loading.UnifiedClassLoader3@1b09282{ url=file:/C:/java/jboss-3.0.4/server/default/deploy/f12.ear/f12ejb.jar/ }
interface javax.ejb.Handle : org.jboss.mx.loading.UnifiedClassLoader3@1bd2664{ url=file:/C:/java/jboss-3.0.4/server/default/tmp/deploy/server/default/lib/jboss-j2ee.jar/17.jboss-j2ee.jar }
After reload, the pages fail with a 500 error:
19:13:51,391 INFO [STDOUT] Loader:
class $Proxy25 : org.jboss.mx.loading.UnifiedClassLoader3@13adc56{ url=file:/C:/java/jboss-3.0.4/server/default/tmp/deploy/server/default/lib/jnpserver.jar/36.jnpserver.jar }
19:13:51,391 INFO [STDOUT] Interfaces:
interface no.f12.ejb.TestHome : org.jboss.mx.loading.UnifiedClassLoader3@1b09282{ url=file:/C:/java/jboss-3.0.4/server/default/deploy/f12.ear/f12ejb.jar/ }
interface javax.ejb.Handle : org.jboss.mx.loading.UnifiedClassLoader3@1bd2664{ url=file:/C:/java/jboss-3.0.4/server/default/tmp/deploy/server/default/lib/jboss-j2ee.jar/17.jboss-j2ee.jar }
The exception I'm getting is:
19:13:51,652 WARN [jbossweb] WARNING: Exception for /f12/info/Info.do?command=testEJB
java.lang.ClassCastException
at no.f12.actions.info.InfoAction.testEJB(InfoAction.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:220)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:446)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:266)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:366)
at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:293)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:581)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1687)
at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:544)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1637)
at org.mortbay.http.HttpServer.service(HttpServer.java:875)
at org.jboss.jetty.Jetty.service(Jetty.java:543)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:806)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:956)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:823)
at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:203)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:290)
at org.mortbay.util.ThreadPool$JobRunner.run(ThreadPool.java:743)
at java.lang.Thread.run(Thread.java:536)
Thanks,
Anders, -
7. Re: Classcastexception(again) driving me crazy
anderssv Jan 15, 2003 1:13 PM (in response to anderssv)Is there a max limit on a posting here? Can't post my reply.
-
8. Re: Classcastexception(again) driving me crazy
anderssv Jan 15, 2003 1:16 PM (in response to anderssv)Why the hell can't i reply here? Damn!
-
9. Re: Classcastexception(again) driving me crazy
anderssv Jan 15, 2003 1:19 PM (in response to anderssv)What is wrong?! I can't post.
-
10. Re: Classcastexception(again) driving me crazy
ganton516 Jan 15, 2003 1:24 PM (in response to anderssv)I believe the problem you are having is because when you re-deploy the EJB, the application using it still has a reference to the OLD EJB, and it's classloader.
Are you deploying the application as a whole ?
If you are, try closing the session to the appserver, and starting a new one, as, once again your "session" has the reference to the old class, and it's class loader, not the new one.
Hope this helps
G -
11. Re: Classcastexception(again) driving me crazy
anderssv Jan 15, 2003 1:25 PM (in response to anderssv)Test? Can i post again?
-
12. Re: Classcastexception(again) driving me crazy
anderssv Jan 15, 2003 1:32 PM (in response to anderssv)Hjm, tried it, and the objects seem the same. Should they be changed?
Before reload, the pages load fine:
19:11:46,642 INFO [STDOUT] Loader:
class $Proxy25 : org.jboss.mx.loading.UnifiedClassLoader3@13adc56{ url=file:/C:/java/jboss-3.0.4/server/default/tmp/deploy/server/default/lib/jnpserver.jar/36.jnpserver.jar }
19:11:46,642 INFO [STDOUT] Interfaces:
interface no.f12.ejb.TestHome : org.jboss.mx.loading.UnifiedClassLoader3@1b09282{ url=file:/C:/java/jboss-3.0.4/server/default/deploy/f12.ear/f12ejb.jar/ }
interface javax.ejb.Handle : org.jboss.mx.loading.UnifiedClassLoader3@1bd2664{ url=file:/C:/java/jboss-3.0.4/server/default/tmp/deploy/server/default/lib/jboss-j2ee.jar/17.jboss-j2ee.jar }
After reload, the pages fail with a 500 error:
19:13:51,391 INFO [STDOUT] Loader:
class $Proxy25 : org.jboss.mx.loading.UnifiedClassLoader3@13adc56{ url=file:/C:/java/jboss-3.0.4/server/default/tmp/deploy/server/default/lib/jnpserver.jar/36.jnpserver.jar }
19:13:51,391 INFO [STDOUT] Interfaces:
interface no.f12.ejb.TestHome : org.jboss.mx.loading.UnifiedClassLoader3@1b09282{ url=file:/C:/java/jboss-3.0.4/server/default/deploy/f12.ear/f12ejb.jar/ }
interface javax.ejb.Handle : org.jboss.mx.loading.UnifiedClassLoader3@1bd2664{ url=file:/C:/java/jboss-3.0.4/server/default/tmp/deploy/server/default/lib/jboss-j2ee.jar/17.jboss-j2ee.jar }
The exception I'm getting is:
19:13:51,652 WARN [jbossweb] WARNING: Exception for /f12/info/Info.do?command=testEJB
java.lang.ClassCastException
at no.f12.actions.info.InfoAction.testEJB(InfoAction.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:220)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:446)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:266)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:366)
at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:293)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:581)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1687)
at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:544)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1637)
at org.mortbay.http.HttpServer.service(HttpServer.java:875)
at org.jboss.jetty.Jetty.service(Jetty.java:543)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:806)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:956)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:823)
at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:203)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:290)
at org.mortbay.util.ThreadPool$JobRunner.run(ThreadPool.java:743)
at java.lang.Thread.run(Thread.java:536)
Thanks,
Anders, -
13. Re: Classcastexception(again) driving me crazy
anderssv Jan 15, 2003 4:01 PM (in response to anderssv)Sorry for the mess on the postings. Must be some hidden cache server or something that didn't update the thread.
I'm deploying the application as a whole. When re-deploying i touch the application.xml file.
I'm not sure what you mean by session to the appserver. Where can i find methods to reset it? But why doesn't jboss do that when i ask it to reload the app? Seems logical to me, but then I'm only a newbie. ;)
If you mean the session with the user/webbrowser, I've verified that it is not the same session after a reload.
Thanks for the help,
Anders, -
14. Re: Classcastexception(again) driving me crazy
ganton516 Jan 15, 2003 4:16 PM (in response to anderssv)Just out of curiosity, I tried this
(Jboss 3.0.4/Jetty)
Deploy an EJB in a jar file
Deploy a web app that uses the EJB in a war file
Pull up a test page (Works great)
Change the EJB && redeploy
Web app breaks (ClassCastException)
Redeploy web app that uses EJB
Web app works again
SO!
My conclusion is that just starting a new session, (Brand new request from new client), isn't enough, if the web-app, still has the reference to the EJB, it's going to use it, and since the EJB is now different, and has reloaded, you will get a ClassCastException.
I'm not sure if this is supposed to be this way, particularly if you are deploying your EJB && webapp, in the same ear file.
Very strange...............
Anyone else have some input ?
G