users@glassfish.java.net

delegate="true" or delegate="false"

From: <glassfish_at_javadesktop.org>
Date: Sat, 12 Dec 2009 02:45:40 PST

Hi all,

I have read almost all post in forums and web, I have still problems about delegation model of my EAR application which is consisting WEB and EJB module. My web module is also consisting restful web services.

I have read necessary documenations and it says:


[b]
The Java Servlet speciication recommends that a webmodule's class loader look in the local class loader before delegating to its parent. You canmake this class loader follow the delegation inversion model in the Servlet speciication by setting delegate="false" in the class-loader element of the sun-web.xml ile. It is safe to do this only for a webmodule that does not interact with any other modules. For details, see “class-loader” in Sun GlassFish Enterprise Server v3 Application Deployment Guide.

The default value is delegate="true", which causes a webmodule's class loader to delegate in the samemanner as the other class loaders. Youmust use delegate="true" for a web application that accesses EJB components or that acts as a web service client or endpoint. For details about sun-web.xml, see Sun GlassFish Enterprise Server v3 Application Deployment Guide.
[/b]


Shortly, I want to use always my bundled libraries in my modules without regard to be included in my application server. If my modules had this library, they should be loaded from my application.


1 - ) For example, Glassfish V3 is bundled with Jersey 1.1.4.1. If my modules need to use 1.1.5-ea-SNAPSHOT what my delegation value in my sun-web.xml should be ? (Both of my modules need to use 1.1.5-ea-SNAPHOT)


2 - ) As far as I know, the packages javax.* are not loaded with this delegation model. If I want to use new version of these libraries, what should I do? For example JSR-303 libraries is good example of it. I want to use new snaphots of Hibernate Validater which has javax.validation.* packages. I am not sure in this case what will happen.


3 - ) What is the motivation behind this setting which is default false. I think that it should be default false. Because If an application has a library, it means that it delibrately consisting it. That is to say, it should be loaded.

4 - ) Again from my understandings, this setting is just for web modules. What is the equalivant setting in EJB Modules.
[Message sent by forum member 'sessizlik' ]

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