Hi, Have tried the various suggestions posted and thought I would wrap up with the findings, in case anyone else is reading this thread with the same problem.
This problem does indeed manifest itself in moving from JBoss 4.0.1 and 4.0.2 because as [EMAIL PROTECTED] says anonymous wrote : difference between 4.0.1 and 4.0.2 is 4.0.2 JBoss has changed to the Servlet spec classloading model, i.e. it uses the Tomcat classloader. So, there were two options: Option 1. Reconfigure the server to reverse this change (which gives you the same class loading behaviour as you would see in 4.0.1.) This is achieved by changing the settings in "$jboss-4.0.2"\server\default\deploy\jbossweb-tomcat55.sar\META-INF\jboss-service.xml to: <attribute name="Java2ClassLoadingCompliance">true</attribute> | <attribute name="UseJBossWebLoader">true</attribute> Actually I found you only seem to need to change the latter of these. What is confusing about this area is that if you read "What's new in JBoss 4.0". It explains that 4.0.1 has the same default config as 3.2. I.e. the class loading is using JBoss's effecient model and NOT a J2EE 1.4 compliant one. (Efficient, but not compartmentalized). It tells you that if you want to go J2EE compliant you should change the above settings to false (the default in 4.0.2) and make a change in "$jboss-4.0.2"\server\default\conf\jboss-servie.xml : <mbean code="org.jboss.naming.NamingService" | name="jboss:service=Naming"> | <!-- The call by value mode. true if all lookups are unmarshalled using | the caller's TCL, false if in VM lookups return the value by reference. | --> | <attribute name="CallByValue">true</attribute> | ... | </mbean> However the default config in 4.0.2 IS supposed to be J2EE compliant, but if you check the CallByValue setting above it is still false. So I think you end up with "compartmentalized" class loader namespace but objects are STILL being passed by reference instead of being mashalled across the layers. Hence the ClassCast problems after the JNDI lookup. Anyway on to option 2... Option 2. Leave the settings as they are delivered for JBoss 4.0.2 and make sure that any classes are not duplicated anywhere in an ear. I.e. remove your EJB-Client.jar from your .war and any other utility classes used in both layers (they are provided only in ejb.jar). This is probably the simplest option (as gozilla points out), but does mean that if you do suddenly want to move your web and ejb tiers onto different virtual/physical machines, you will need to do some repackaging to put the stuff back in. Interesting further discovery. Regardless of which option I tried I came up with a different problem, and I can't find it documented in any of the "what's new" docs. As soon as I started getting beyond the ClassCastExceptions I found that I would get "java.lang.IllegalArgumentException: setAttribute: Non-serializable attribute" whenever trying to put a non-serializable object into the session. I am not clustered so I couldn't see why the object would have to be serializable (activation/passivation issues aside). After some investigation I could track it down to one thing. My web.xml had the element in it. Take it out and no llegalArgumentExceptions, put it back and you get them again. It seem that a new feature of 4.0.2 checks if you have shown the "intent" of having your app distributable and throws an exception if you try to set an attribute that would not allow a session to be distributed between servers. As I said, it may be there but I can't find it in any of the change logs. BTW: If you are using JBoss-IDE for eclipse and you don't specifically say you don't want your app distributable (via your xdoclet config) you will get the tag in your web.xml. Anyway, I am happy now - thanks to everyone who helped me resolve this. Cheers, PJ View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3878195#3878195 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3878195 ------------------------------------------------------- This SF.Net email is sponsored by Oracle Space Sweepstakes Want to be the first software developer in space? Enter now for the Oracle Space Sweepstakes! http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click _______________________________________________ JBoss-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jboss-user
