Closed GoogleCodeExporter closed 9 years ago
Some changes you make to the classfile are properly hot updated. So it's not a
good
idea to always restart jetty upon classfile change.
Original comment by danilo.t...@gmail.com
on 26 Feb 2008 at 1:08
I've actually found the reason for this ... I kept all my libraries in
WEB-INF/lib,
this caused them to get loaded twice (by both runjettyrun and jetty I suppose).
A fix for this would be greatly appreciated :)
Original comment by soeren...@gmail.com
on 24 Apr 2008 at 10:02
I've developed a fix for this, which works for me and may for others: I set the
class path of the launched Bootstrap to be the minimum
to start Bootstrap and Jetty, and set the class path of the web app to the
class path of the project.
Some background explaining why I did this:
My team uses maven and tomcat (I'm the only Eclipse and jetty user), where we
have a root directory (let's call it foo :-)), which
contains several directories which I've setup as separate Eclipse projects
(e.g. foo/core/ and foo/web/ become Eclipse projects core
and web). Maven compiles to foo/core/target/classes/ and
foo/web/target/classes/, and packages such that foo/web/target/product.war
is the result, with foo/web/target/product/ is the unpacked form of the war
(i.e. all the classes are now in jars in foo/web/target/product/WEB-INF/lib/).
When I launch web (with my WebApp Dir set to web/target/product), RJR runs
fine, until I want to edit the code while it in the
debugger. Because Eclipse writes the classes to <project>/target/classes, the
JVM doesn't see that the file has changed (the JVM
read the class files from the jars in foo/web/target/product/WEB-INF/lib/).
The same applies to changes to resource files.
The reason this happens is as follows: when RJR launches, it sets the class
path to a concatenation of the following:
* The class path of the web project (i.e. the foo/<project>/target/classes/
directories, and each of the jars on the class path of
those projects).
* The 8 jars that RJR includes (e.g. jetty, servlet and
run-jetty-run-bootstrap).
When Bootstrap starts Jetty, Jetty creates a WebAppClassLoader for the webapp
that it populates with the contents of the webapp's WEB-
INF/classes and WEB-INF/lib directories, where maven puts the built jars, and
the jars they depend upon. The parent class loader is
the one for Bootstrap, which contains the directories where Eclipse will write
class files.
As a result of this arrangement, each of the classes we build, and their
dependencies, appear on the effective class path twice, and
with the jar form appearing "first" (the WebAppClassLoader will first look in
WEB-INF before falling back to the parent class loader).
When running my webapp from Eclipse, with Jetty, I want to ignore the contents
of the WEB-INF/classes and WEB-INF/lib directories, and
instead use the project's class path. So, I changed RJR to produce two class
paths, one used to start the JVM, the other passed as a
-D argument that Bootstrap uses to create a ProjectClassLoader (a new subclass
of WebAppClassLoader, that blocks the addition of the
WEB-INF/classes directory and the WEB-INF/lib jars), and this
ProjectClassLoader is used to initialize the WebAppContext.
I have not yet made this behavior conditional (well, it is in Bootstrap, but
not in the RJR plug-in).
If folks are interested, I can either attach the changes, or check them in
(which I assume would require me being added as a project
member).
Original comment by James.Sy...@gmail.com
on 10 Oct 2008 at 1:33
I am really interested. How can I get your solution?
Original comment by fernando.wermus
on 15 Apr 2009 at 8:22
Fernando,
Eelco has added me to the project. I'll work on producing a new version of RJR
(hopefully over the weekend).
James
Original comment by James.Sy...@gmail.com
on 17 Apr 2009 at 9:35
could i join?
I have exactly the same problem. have both class paths, which are very annoying.
I'll appreciate that.
Thanks,
Jia
Original comment by liujia508@gmail.com
on 1 May 2009 at 8:24
I've released version 1.1 of Run Jetty Run to address this problem (at least,
as it
impacted my use).
Changing summary from "Add scanner to restart the server when classes change"
to "Add dependent projects to class path"
Original comment by James.Sy...@gmail.com
on 4 May 2009 at 12:26
Issue 15 has been merged into this issue.
Original comment by James.Sy...@gmail.com
on 4 May 2009 at 12:55
Hi,
I just enhanced your project to redeploy(like tomcat did) the classpath which
is modified(only scan directory not jar file). And I also added two attributes
to the configuration's panel, one is Scan Interval Seconds and the other is
Enable Scanner. If someone like me desire this feature please mail to me, I
will send the updated version to you.
Cheers,
Jumper
Original comment by jumperc...@gmail.com
on 13 Oct 2010 at 2:22
I tested jumperchen's modification and it seems to work perfectly! This feature
should definitively be added to the official version.
Original comment by perttu.t...@gmail.com
on 5 Nov 2010 at 6:56
Thanks Jumper and above discussion to provide me the scanner code fix,
it will merge in 1.2 .
Original comment by tonylovejava
on 10 Mar 2011 at 5:54
it's not working in 1.2 because a wrong commit.
Will fix in 1.2.1
Original comment by tonylovejava
on 22 Mar 2011 at 7:30
Original issue reported on code.google.com by
ulrich.s...@gmail.com
on 20 Feb 2008 at 11:37