Eclipse IDE remote rebug and remote edit a legacy webapp - eclipse

I am in a bind here, what's happening is I have a legacy webapp which uses an in-memory database. The app requires 64GB of RAM just to launch and it takes at least 30 minutes to start.
I have to make updates/fixes to this application. Obviously it is impossible to launch it on my PC so everything has to be done on the server. I have considered setting up an Eclipse IDE on the Linux server where this app runs, but that introduces a set of new issues. I really would like to continue using my PC's Eclipse IDE and make edits to the app.
I am able to use the remote debugging capabilities of Eclipse IDE and launch this app from the linux server no problem. However this is not enough. After I make an edit, I need to be able to save/compile the file, and load this change into the server relatively quickly. I can't wait 30 minutes every time I make some updates to the app.
Can anyone recommend ideas on what to do in this scenario? Ideally I would love to be able to launch the app in DEBUG mode inside the Linux Eclipse IDE on the server and connect to this instance using remote debugging from my local/Windows IDE. I would like to make changes in my Windows Eclipse IDE and then quickly copy the files over to the linux server, pick them up in the Linux Eclipse IDE, compile them in the Eclipse IDE instance running in debug mode, and effectively "hot swapping" the changes, thereby avoiding the need to wait 30 minutes for the app to start back up... However when I try to do this, there is a caveat... I can't seem to be able to launch the webapp in Linux Eclipse IDE in both DEBUG mode and also remote-debug-connect to it, the error I am getting in Eclipse is:
"Cannot load this JVM TI agent twice"
I get what is going on: the local debugger is launching tomcat with the -agentlib:jdwp parameter and on top of it, I am trying to force it to also start up with the same arguments and so it complains, but is there some way to trick it into allowing me to remote connect into this debug session from my Windows server?

I managed to solve this issue by updating Tomcat's context.xml to support reloadable mode:
<Context reloadable="true">
And in the app to set it to reloadable in WEB-INF/web.xml:
<web-app reloadable="true">
Now I am able to make edits in my local windows Eclipse IDE, Save them, and they automatically get updated on the server side.

Related

Restart Eclipse application

How can I restart an application in Eclipse through a socket call?
I built an error diagnosis app which can checks what code should be changed to handle the error, but after the change I have to restart the app again. I already have developed a plugin for Eclipse which would take care of this, but I am not sure on how to restart the app.
1.) Is there an internal Eclipse command to restart the app?
2.) Do I have to use a command shell (which I wouldn't prefer)?
Hope someone can help me or give me some guidance. Also I know that there is a possibility to restart an app for debugging, but I want to run the app without debugging.
If you mean you have an Eclipse 3.x style RCP application and you want to restart the RCP from an Eclipse plug-in then you just do:
PlatformUI.getWorkbench().restart(true);
which restarts the RCP using the current workspace.
For an e4 RCP you do:
#Inject
IWorkbench workbench;
workbench.restart();
#greg-449: Thanks for your respond, but what I am trying to achieve is a bit more complex. Consider the following, I have a service that runs on another machine in my company network. It turned out something wrong is going with this service. So you can connect with with a remote debugger to the server and can check with the source code, that you have on your local machine, what is going on. I would say the classic Remote Debugging in Java.
But when you have fixed the error in the code you also have to restart the service on this other machine somewhere in the network. The question is how to do this? By a shell command which gives you the instances on this machine where the service is running or is there some other possibility?
Hope this helps more to understand the problem.

Debugging a GWT application in a remote environment

I have deployed my GWT application to its target environment (i.e. compiled and copied the war directory contents to the target device's /var/www) and some parts of it are not working. I understand that I can debug my local instance of the GWT app as if it were running in the target environment, by opening the deployed GWT App URL and adding gwt.codesvr URL parameter to it, like this:
http://deployment_host/gwtapp.html?gwt.codesvr=localhost:9997
I get
Plugin failed to connect to Development Mode server at localhost:9997
Follow the underlying troubleshooting instructions
My Chrome browser is running on the same machine as Eclipse, so localhost above should be ok. Just to make sure, I've added -bindAddress 0.0.0.0 in the Run/Debug configuration in Eclipse and tried with my external IP/hostname, with no change, except that the error message is updated accordingly. What am I doing wrong?
If I replace deployment_host with localhost above everything works fine, but it's of no use to me to debug locally. (There is some Proxy and ReverseProxy-ing going on in the local Apache, so I do not need the 8888 port when running locally, but this should be unrelated)
Questions Debugging GWT applications outside of dev mode? and Debug GWT application in a remote browser are related but do not help.
If you are using chrome, look in the address bar at the right for a grey GWT icon. In any other browser, you would see a popup message confirming that you want to debug, but in Chrome this apparently isn't possible.
Click the icon, and it will ask you to whitelist this site as allowed to run Java locally on your computer. After you whitelist it, it should run correctly.
Along the same lines as the answer above Ive just had some success restarting the extension helped (but restarting browser hadnt)
Just enable and disable it in :
chrome://chrome/extensions/
Good luck! It's the only thing wrong with GWT imho...

Speeding up code changes in Eclipse Web Browser?

I'm developing an application using the Vaadin framework in Eclipse. I'm using the Tomcat v6.0 servlet and run the application in the Eclipse Web Browser. A problem I've been having though is to have recent changes show in the browser when I test the application.
No matter how many times I restart Tomcat, clean all published resources and restart the Eclipse Web Browser the changes still won't take effect. The changes seem to take effect randomly where time is the biggest factor, which is of great frustration when developing...
So my question is if anyone else has noticed this problem and have any ideas of how to solve it, if there is a configuration I can do or if I'm missing a step in the restart which blocks the changes from taking effect..?
Any help would be greatly appreciated!
In Vaadin most of the code runs in the server and is contained in normal Java files. There are three levels of resource/class changes:
The runtime "hot code replacement". If running Tomcat in debug mode some Java class changes can be published without redeploying the web application. However, if the Tomcat is configured to "auto publish" (check your server settings in Eclipse), the redeployment is automatically done whenever classes change and this causes full context reload and sessions serialization (see #2) . Hot code replacement can be enhanced using tools like JRebel.
Web application deployment. This is essentially deploying a new war file to the server. Causes the previous version to be undeployed and deploys the new version of all classes and resources. Sometimes there are some resources left in the servers work directory or classes are not reloaded, in which case the server restart (#3) is needed.
Server restart. This makes the whole JVM to reload and all the classes and web applications are also reloaded. Still cleaning the work directory separately is needed to make sure everything is reloaded.
In addition to this there is the client-side part of Vaadin (essentially a JavaScript compiled with GWT), which is treated as a static resource by Tomcat. If you modify the client-side Java code the GWT is used to recompile the JavaScript. Deployment should be simply file copying. The browsers cache the generated HTML/JS files, but GWT includes mechanism to avoid this.
You should first try to change the server settings for automatic publishing and see if that helps. Also, I've noticed that different Tomcat version behave differently. This is unfortunate, but the only thing you can do is to try to find the versions/set-up that works for you.
Just to make sure: you have been adding ?restartApplication in the URL to force application to restart on page reload, haven't you?

Netbeans not keeping added server after restart

When I add a new server (glassfish) or another, it works just fine. I can startup the server and deploy apps on it.
But, every time I restart netbeans the added servers are not there. It means I must add servers every time I open netbeans.
I'm using netbeans7.
Thanks.
Well, it is not happening any more on netbeans 7.2. If it was a bug, it has been fixed.

Launching from Eclipses causes errors in browser

I've got a strange situation; when I run a Flex app from Eclipse (i.e. click run as web app), my remote calls always hang.
In Firefox, they return as failed.
But when I open up a browser and browse to my .html file in the bin-debug folder, the remote calls work.
Why is that?
Thanks for any helpful tips!
p.s. I'm accessing a websphere server and authentication is required but a Java developer hardcoded his ID in.
One thing to check:
Do you have a breakpoint set in your code somewhere? Eclipse may be waiting for you to interact with it so the program execution can continue. On my Win7 machine, when the debugger takes over, eclipse often does not take over focus; so I have to manually minimize IE.
My problem was solved today and the issue was getting through to the IBM websphere server; the authentication was still in place and the java developers had to create a cloned environment where authentication was not required. Thank you everyone for their helpful answers.