Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Eclipse WTP with Jetty and m2eclipse - auto republish not picking up changes.(When changes are made in webapp, Jetty server in WTP goes through Republish... Synchronized - but changes still won't show until server restart.)
icon5.gif  Eclipse WTP with Jetty and m2eclipse - auto republish not picking up changes. [message #649147] Mon, 17 January 2011 17:01 Go to next message
BNRob is currently offline BNRob
Messages: 3
Registered: January 2011
Location: NY
Junior Member
Hey all,

I'm not sure if this is the right forum for this, but the issue seems to be mostly WTP in nature to me.

The issue comes down to changes in a webapp not being picked up by my Jetty server until a restart is issued.

To test this I have a Jetty server configured in WTP, running the most basic webapp I could put together. Whenever I make changes to the servlet in the webapp, the Jetty server will change it's status from [Started, Synchronized] to [Started, Republish] for a brief moment, then back to [Started, Synchronized].

After waiting for this cycle, and reloading the page served by the servlet, the changes made do not appear. I have to restart the server in order for the changes to pick up.

I'm using Jetty WTP Adaptor version 1.0.0.201012221052

I created the webapp with the m2eclipse plugin, using the 'webapp-javaee6' archetype from 'org.codehaus.mojo.archetypes'.

The contents of the webapp are one servlet:

public class Test extends HttpServlet {
	private static final long serialVersionUID = 1L;

    public Test() {
        super();
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		PrintWriter out = response.getWriter();
		out.print("hello sometimes!: " + (new Date()));
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}


mapped to /*

I test this by just changing the contents of the out.print() statement.


I've been searching google for information/leads on this for the entire day now, and am at a loss. Any help would be greatly appreciated.

Thank you,
- Rob
Re: Eclipse WTP with Jetty and m2eclipse - auto republish not picking up changes. [message #649297 is a reply to message #649147] Tue, 18 January 2011 11:22 Go to previous messageGo to next message
BNRob is currently offline BNRob
Messages: 3
Registered: January 2011
Location: NY
Junior Member
Forgot to mention, I'm using Jetty 7.2.2 and Eclipse version 3.6.1
Re: Eclipse WTP with Jetty and m2eclipse - auto republish not picking up changes. [message #650065 is a reply to message #649147] Fri, 21 January 2011 10:30 Go to previous messageGo to next message
BNRob is currently offline BNRob
Messages: 3
Registered: January 2011
Location: NY
Junior Member
I'm bumping this because I have not been able to solve this problem. If anyone could please give a hand or make a suggestion, I'd really appreciate it.

Thanks!
- Rob
Re: Eclipse WTP with Jetty and m2eclipse - auto republish not picking up changes. [message #650076 is a reply to message #650065] Fri, 21 January 2011 10:57 Go to previous message
Larry Isaacs is currently offline Larry Isaacs
Messages: 1305
Registered: July 2009
Senior Member
On 1/21/2011 10:30 AM, BNRob wrote:
> I'm bumping this because I have not been able to solve this problem. If
> anyone could please give a hand or make a suggestion, I'd really
> appreciate it.
>
> Thanks!
> - Rob

After a classloader loads a class, changes to the original class file
have no impact on the already loaded class. I don't know what Jetty
supports, but Tomcat does have some support for detecting that a servlet
class file changed. If this is detected, the webapp is shut down,
throwing away the old classloader with the out of date class. A new
instance of the webapp is then started so a new classloader can load the
new version of the class. Jetty may have something similar that can be
enabled. WTP, not knowing whether the server will or won't reload the
webapp, indicates the server needs to Restart, which is the brute force
way to throw away the old classloader with the out of date class. If
the server is serving only one webapp, reloading the webapp may not save
much time over restarting the server.

If you are running the server in a debug session, the debugger may be
able to apply certain changes to the running class. Usually just
changing code can be applied. Adding fields or changing method
signatures will require restarting the webapp or server.

Cheers,
Larry
Previous Topic:Problem configuring websphere 6 on eclipse Helios
Next Topic:Failed to install Web Tools plugin
Goto Forum:
  


Current Time: Sun Aug 31 02:27:03 EDT 2014

Powered by FUDForum. Page generated in 0.06872 seconds