users@glassfish.java.net

Re: GlassFish V2.1.1 to V3 migration - JCA ClassLoader problem

From: <glassfish_at_javadesktop.org>
Date: Thu, 03 Jun 2010 09:40:43 PDT

> RAR class visibility has changed in EE6. It now
> requires an application
> server to provide an isolation level by default such
> that classes from
> only those standalone RARs that are used by an
> application are visible
> to the application. You can consult the EE6 platform
> spec for further
> details. GlassFish v3 and beyond follows this new
> rule.

I think that is how I had assumed things worked last year when I encountered my original problem. I'm just glad to hear that this is on purpose and not a bug.

>I don't know if
> GlassFish exposes an option to switch to the old
> class loading policies
> for standalone RARs.

I would prefer to learn how to write my RAR properly than to use a vendor specific feature, so this is not a problem.

 
> Coming to the ClassCastException, are you using
> delegate=false? If not,
> can you describe how
>
> com.ijws.cicokioskcl.ra.cci.CicoKioskConnectionFactory
> .class
>
> is made available to RAR and WAR so that we can
> analyse how two copies
> of it are getting loaded causing CCE.

First I'll describe the RAR. I use Maven to compile all of the classes into a .jar file, and that .jar file is bundled into a .rar file that includes a META-INF/ra.xml deployment descriptor. I deploy the RAR into GlassFish using the web admin console. The classes in my .jar implement a bunch of JCA interfaces, but there are also a bunch of model classes use by client applications to build requests, and retrieve responses.

My .war file currently makes use of model classes inside of the RAR's .jar file, but assumes that the classes are already on the classpath. So, there is not a second copy of the rar/jar bundled inside of my .war file. On GlassFish V3 I get a ClassNotFoundException when trying to use these model classes. If I bundle the JCA connector's .jar file into my .war file, then it is able to work with these classes. However, when the JCA connector returns an instance of one of these classes, I think that instance was originally created using the JCA connector's ClassLoader which is no longer shared, so that causes the class cast exception.

I suspect I need to bundle my JCA connector differently.

I tried removing the .jar from inside the .rar, so the .rar contains only a deployment descriptor. I placed the .jar in /domain1/lib/ext/ beside my JDBC drivers, but it causes major problems in the app server.

Another idea is to move only classes that my web app needs to use out of the .rar file and into a .jar file in /domain1/lib/ext/ I suspect I'll still have the same problem though.


Thanks,
Ryan
[Message sent by forum member 'rdelaplante']

http://forums.java.net/jive/thread.jspa?messageID=472617