Code Monkey home page Code Monkey logo

Comments (12)

GoogleCodeExporter avatar GoogleCodeExporter commented on August 28, 2024
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 [email protected] on 26 Feb 2008 at 1:08

from run-jetty-run.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 28, 2024
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 [email protected] on 24 Apr 2008 at 10:02

from run-jetty-run.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 28, 2024
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 [email protected] on 10 Oct 2008 at 1:33

from run-jetty-run.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 28, 2024
I am really interested. How can I get your solution?

Original comment by fernando.wermus on 15 Apr 2009 at 8:22

from run-jetty-run.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 28, 2024
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 [email protected] on 17 Apr 2009 at 9:35

from run-jetty-run.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 28, 2024
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 [email protected] on 1 May 2009 at 8:24

from run-jetty-run.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 28, 2024
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 [email protected] on 4 May 2009 at 12:26

  • Changed state: Fixed

from run-jetty-run.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 28, 2024
Issue 15 has been merged into this issue.

Original comment by [email protected] on 4 May 2009 at 12:55

from run-jetty-run.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 28, 2024
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 [email protected] on 13 Oct 2010 at 2:22

from run-jetty-run.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 28, 2024

I tested jumperchen's modification and it seems to work perfectly! This feature 
should definitively be added to the official version.

Original comment by [email protected] on 5 Nov 2010 at 6:56

from run-jetty-run.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 28, 2024
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

  • Added labels: 1.1.1

from run-jetty-run.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 28, 2024
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

  • Added labels: 1.2
  • Removed labels: 1.1.1

from run-jetty-run.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.