As a point of clarification, the ClassCastException with PortableRemoteObject.narrow happens even when I don't change the EJB classes or interfaces. It happens even when I merely change servlets or JSPs that access the EJBs.
Yes, this was a known bug. You could try CVS to
get the latest version.
I still observe the problem with ClassCastException in JBoss 3.0.0 RC1
The problem specifically happens in the following case:
- Deploy an .ear file to the server, run tests that use EJB session / entity beans in the .ear
- Redeploy the .ear (with or without any changes)
- Rerun the tests. The ClassCastException happens in PortableRemoteObject.narrow when trying to obtain an EJB session home from the server (i.e. from within the execution of a different EJB session bean).
This problem was reported as fixed yesterday.
The fix should also make jndi processing faster inside
the same VM.
Adrian, did you try out narrow in the latest CVS of JBoss 3.0.0? I couldn't get the latest (2002-04-24) CVS working with my database, so my application doesn't deploy.
Strange. I am using the 2002-04-24 HEAD snapshot of JBoss 3.1.0 alpha, and the ClassCastException doesn't occur when I redeploy a regular packed EAR. It only happens when I redeploy an unpacked EAR (by changing files and touching the deployment descriptor). Seems like something's been fixed in JBoss, but not yet with the code that handles unpacked deployments.
Better than having to restart the whole server, but still agonizingly slow for development.
Anybody else have the ClassCastException problem with unpacked EAR files?
I tried with 3.0 last night.
The narrow works. But I didn't try with unpacked.
I have the same Problem with JBoss 3.0.0 stable from jboss.org.
I get a ClassCastException after these steps:
1) Start Server and deploy *.ear -> everything is fine
2) Start a TestClient -> works
3) Hot redeploy my *.ear-File -> seems to work too
4) Using the same TestClient.
Then I get this:
javax.ejb.EJBException: nested exception is: java.lang.ClassCastException: $Proxy93
... 19 more
Any solutions for this?
I have a servlet (TrackerServlet), which makes an EJB remote call from it's init method. Also the lookup and narrow logic is inside of this method. When I deploy my ear at the first time after restarting my JBoss 3.0.0 (final version with Tomcat) everything works fine. But when I undeploy it and make a redeploy, I got the following exception:
at com.jaron.tracker.client.Settings.getTrackerController(Unknown Source)
at com.jaron.tracker.client.TrackerServlet.init(Unknown Source)
at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
at $Proxy4.deploy(Unknown Source)
The EJB itself is deployed on a different machine with the same configuration. On that machine the redeploy works.
Can somebody help me?
I don't even get the ClassCastException after I redeploy an ear. I get "hit any key to continue" (Ant batch file terminates). I look in the server.log and there's no indication at all of any kind of problem. It just quits. Very abruptly. This is on JBoss_3_1_0_1 using the Jetty servlet engine.
I had the some problem in running JBoss 3.0.0 and JBoss 3.0.1RC1 in WinXP.
However, when I moved to Linux this problem does not happen.
Does anyone knows this error is only in WinXP?
I just tested this on the 3.0.0 release, on WinXP/JDK1.4.1 and RH Linux 7.3/JDK1.4.0 and it happens on both :-( I am using cactus to do my unit testing, and it is the cactus servlet that sees the problem.
The problem is in JNDI, here is my analysis (I amm testing an EJB called User):
1. On first deployment, lookup of local/User (UserLocalHome interface) returns User:$Proxy34. This is the same object listed in the management view as bound to local/User, and all the tests work fine.
2. Do a hot redeploy
3. Lookup local/User from the servlet returns User:$Proxy34 as before, while in the management view local/User is bound to proxy: $Proxy43. The tests fail with a ClassCastException.
I think I had a similar problem with a JCA resource I wrote and a test program which I installed as a service. The fix for mine was to add the resource as a dependancy in the test service's xml file eg.
<?xml version="1.0" encoding="UTF-8"?>
Hope this helps.
I have tried jboss-3.0.0 with jetty, jboss-3.0.0_tomcat-4.0.3, and jboss-3.0.1_tomcat-4.0.4. I have the same problem as described above everywhere.
I think this thread and http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t=forums/ describes the same problem. And it seems to be some caching of proxy in JBoss, so that after hot deployment it is impossible to narrow proxies that have already been looked up to home-interfaces? It is only a problem from a servlet or other running in the same JVM as JBoss
If I have understood correctly this is a bug, and a bug that it is fairly difficult to live with. Any work-arounds? Any hopes for a fix shortly?