- This topic has 7 replies, 3 voices, and was last updated 19 years, 2 months ago by Scott Anderson.
-
AuthorPosts
-
lowhmMemberHi,
I’m having a problem with restarting server whenever I add a method to the current class during step debugging.
My problem is as follows
1) Step debug into a current method
2) add a method
public static testHotSwap() { System.out.println(“Testing hot swap”); }
3) Immediately when you save, you will hit the Hot Swap fail error
4) The debug window will now show the thread (may be out of sync)
5) I have check that MyEclipse sync-on-demand actually did update the class onto the server (Tomcat in my case)
6) But if I am to step through the code again, the new method will not be step into being which I believe, the trace info is still the old debug info without the new method added.
7) To resolve this problem, I write a ant script to touch the web.xml of Tomcat to force the context to reload, after which the new method will be called.
8) However, the error will keep on appearing if I am to change code on the class again and require a touch on web.xml everytime I change code on the class
(Note changing on other class are alright so long I don’t add new method)
9) To fully resolve the prompting of message, the only way I know of right now is to restart the serverI understand that this is a limitation of the java debuggin architecture rather than a problem in MyEclipse.
My question is
1) Is there a way that I can solve the (may be out of sync) problem without restarting the server.
(I have tried to Redeploy, but it fails to cleanly remove all the files on the server and redeploy stops)I’m using MyEclipse 4.0GA on Eclipse 3.1.
Sorry for the long mail.
Thanks in advance for any advice.
Cheers.
Han Ming
Scott AndersonParticipantHan,
3) Immediately when you save, you will hit the Hot Swap fail error
4) The debug window will now show the thread (may be out of sync)That’s because your change was outside the list of changes supported by the JPDA specification which is supported by the debugger and JVM.
To resolve this problem, I write a ant script to touch the web.xml of Tomcat to force the context to reload, after which the new method will be called.
Actually, you don’t need an ant script. Just leave the web.xml open in an editor and add/remove a space from it and resave. Touching it will cause the file to be hot syn’d into the deployment area and will cause Tomcat to reload it, just as touching it with the ant script did.
1) Is there a way that I can solve the (may be out of sync) problem without restarting the server.
(I have tried to Redeploy, but it fails to cleanly remove all the files on the server and redeploy stops)Touching the web.xml is the fastest. The deployment is already in sync, so it doesn’t need to be redeployed. You just need to force the server to reload the application, which this does.
lowhmMemberHi Scott,
Thanks for the quick response.
I understand that changing the web.xml and touching it has the same effect.
The only thing is that I configure it to run as External Tools so that I can do it with 1 click.However, the problem is not actually resolved.
Because by simply reloading the context, the new method will be called. But if I add more code to it, I have to reload the context again.
Or should I say, it’s not 100% auto at this point.In the case of Tomcat, the reload is pretty quick, so the issue might not be that much. But reloading a Weblogic web app takes horribly long time compare to Tomcat 😀
I do understand that this is a java debugging architecture problem rather than MyEclipse, I just like to find out if there is any way to remove the (may be out of sync) message shown in the debugger.
Cheers.
Han Ming
Riyad KallaMemberHan,
First I’d like to suggest that you simpy set your Tomcat context to: reloadable=”true”, that will reload changes every 10 or 15 seconds.I just like to find out if there is any way to remove the (may be out of sync) message shown in the debugger.
Sure, there is a checkbox on it that says “Don’t show this message again”. I would like to add that I turn this message off, because between hotswapping and context reloading, I almost *never* have to restart my app server, but eventually you start noticing weirdness, when that happens I Just restart it to make sure.
lowhmMemberHi rkalla,
Thanks for the reply.
Works great for me 😀
Sorry, just another question.
Any idea if there is a similar setting for Weblogic?Thanks and have a great long weekend.
Cheers.
Han Ming
Riyad KallaMemberHan,
I really don’t know what WL has and ask 2 other devs and they weren’t farmiliar with it either. Sorry.
lowhmMemberHi rkalla,
Thanks for the reply.
Not a problem, the support provided has been great enough to give 2 thumbs up!!!
I will just use REDEPLOY for weblogic, just that the reloading of webapp takes longer but serve roughly the same purpose.
Cheers.
Han Ming
Scott AndersonParticipantHan,
To force WebLogic to reload an application, you can create a file at /META-INF/REDEPLOY in your application. When you “touch” the file, WebLogic will redeploy the application. The file can be empty, or contain anything you want since it isn’t actually read. It’s just looked at for an edit time.
-
AuthorPosts