Skip to main content

How to define/use a "patch" ?

3 replies [Last post]
bjb
Offline
Joined: 2003-06-12

Is there a way in glassfish to have a .jar that will contain "replacement" class so that they are loaded first instead of the glassfish class ?

As an example, I have provided a fix for the Issue 176 (
https://glassfish.dev.java.net/issues/show_bug.cgi?id=176 ) that prevent Java enum to be used as valid types in EL.

This involve replacing com.sun.el.lang.ELSupport, so I was just looking for getting the source of the class, patching and running it against my current version ...

Any ideas ?

Rgs,
JB

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jr158900
Offline
Joined: 2005-04-13

Try this,

in domains//config/domain.xml
you can find the following element.

add the following attribute : classpath-prefix="your-jar-file-name-with-absolute-path"

such that it will look like

Restart the Application server and changes will take effect.

ss141213
Offline
Joined: 2005-03-30

Copy patch.jar to $GLASSFISH_HOME/lib. There you will find other jars like appserv-rt.jar etc. Then to tell GlassFish to use classes from your jar file use classpath-prefix settings.It can be done in two ways:
either on the GlassFish admin console (select Application Server on the left, then JVM Settings tab, then Path Settings tab) or manually in the domain.xml file (java-config element, classpath-prefix attribute; separate with ${path.separator})

restart the server.

To know whether your jar is used or not, in the server.log see the ClassPath that is logged when server starts.

Hope this helps,
Sahoo

bjb
Offline
Joined: 2003-06-12

Thanks all for your inputs, it was awesome !

Here is a summary of the sucessfull procedure :

#1 Build a .jar using Netbeans EE 5 packing your class, mine is "patch-ELSupport.jar"
#2 Create a folder named "patch" in Glassfish install root and copy the Jar
#3 Go in the web admin console under ApplicationServer/JVMSettings/PathSettings/ClasspathPrefix and put the line :

${com.sun.aas.installRoot}/patch/patch-ELSupport.jar

#4 Restart Glassfish and check in the log for jar presence.

My patch was about using Java 1.5 enum in EL and is working nicely :)

At this time I picked the file over fisheye, but once we will have the jar src with each build, using this technique anybody can easilly fix one issue blocking !

Rgs,
JB

PS : I do hope JSF EG will agree to add to the final spec enum support to EL. Won't it be funny to see a Java SE 5 feature unhandled in a Java EE 5 spec ?