[
http://jira.jboss.com/jira/browse/JBSEAM-1327?page=all ]
Dan Allen updated JBSEAM-1327:
------------------------------
Attachment: JBSEAM-1327-take2-1.2.1.GA.txt
JBSEAM-1327-take2-trunk.txt
As it turns out, ServletContext#getResource() is not a reliable way to get a java.io.File
from a path within an exploded archive. Different application servers take different
approaches. JBoss specifically returns a URL object that uses the "jndi"
protocol (hence why the previous patches didn't work for JBoss). From that URL, there
isn't much luck of finding the directory.
However, once I opened my eyes a little wider (and rolled my mind back a couple of years)
I (re)discovered the ServletContext#getRealPath() method. Granted, this function is not
something you would use in a production environment since it only works for exploded
archives. Alas, that is the only time we need it, so it lends itself perfectly to this
situation!
The new patches use servletContext.getRealPath("/WEB-INF/dev") to find the hot
deployable classloader directory. I erred on the side of caution on the TRUNK so as to
not change the API of the RedeployableStrategy. To maintain the same method signatures, I
wrap the resulting String in a URL. Feel free to refactor at will.
hot deployment directory should not be tied to name and location of
debug jar
-----------------------------------------------------------------------------
Key: JBSEAM-1327
URL:
http://jira.jboss.com/jira/browse/JBSEAM-1327
Project: JBoss Seam
Issue Type: Feature Request
Components: Core
Affects Versions: 1.2.1.GA
Environment: JDK 1.5, Ubuntu Linux 7.04, Jetty running under Maven 2
Reporter: Dan Allen
Priority: Critical
Fix For: 1.3.0.BETA1
Attachments: JBSEAM-1327-1.txt, JBSEAM-1327-take2-1.2.1.GA.txt,
JBSEAM-1327-take2-trunk.txt, JBSEAM-1327_1.2.1.GA.txt, JBSEAM-1327_trunk.txt,
JBSEAM-1328.txt
The logic for determining the location of the hot deployable directory for Java classes
currently relies on the location and name of the jboss-seam-debug jar file. While this
may work when the jar file is placed in WEB-INF/lib, relative to the WEB-INF/dev
directory, and named jboss-seam-debug.jar, it breaks down when it is loaded by the
application server by a different means or has a different name.
For instance, when running a Seam application using Jetty from within Maven 2, the
location of the jar file is in the local repository.
What I find particularly scary is the hard-coded string offsets:
String hotDeployDirectory = path.substring( 9, path.length()-46 ) + "dev";
To get a better understanding of the problem, I added some logging messages to capture
the path resolver logic when jetty builds its classpath from the maven repository.
META-INF/debug.xhtml detected at
jar:file:/home/dallen/.m2/repository-public/jboss/seam/jboss-seam-debug/1.2.1.GA/jboss-seam-debug-1.2.1.GA.jar!/META-INF/debug.xhtml
Hot deploy directory is
/home/dallen/.m2/repository-public/jboss/seam/jboss-seam-debug/1.2.1.GA/jbossdev
If I place the jboss-seam-debug-1.2.1.ga.jar file in the src/main/webapp/WEB-INF/lib
directory, then things get a little bit better, but still not quite right.
META-INF/debug.xhtml detected at
jar:file:/home/dallen/projects/connoisseur/src/main/webapp/WEB-INF/lib/jboss-seam-debug-1.2.1.GA.jar!/META-INF/debug.xhtml
Hot deploy directory is
/home/dallen/projects/connoisseur/src/main/webapp/WEB-INF/lib/jbossdev
What I propose is for the WEB-INF/dev directory to be loaded using the servlet context.
That way, it will always be the directory that is most likely located in the project of
the developer. Since this feature is intended strictly for development, this seams to
make the most sense.
I will provided a patch for both Seam 1.2.1.ga and the trunk.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira