GAE - Development server in Eclipse doesn't update? - java

I'm using the Google AppEngine development server on Eclipse. My local webpage just doesn't seem to update until I do a number of restarts on the Development Server (using the Run or Debug buttons from Eclipse).
What am I doing wrong ?
The basic flow is:
Make change to .java file...
Save file
Run application (development server loading log shows in console)
Refresh web page in browser
P.S: The only way I can get it to work is to change the server port... and if I do that all the previous servers still show at their respective ports. They never stop.

You do need to restart the server to see most code changes you'll make. The easiest way to do this is with the yellow reload button that appears on the GAE pane - not the console, but the one that has the fancy "click here to launch" addresses.
If you do use the debug / run commands in eclipse, you will need to explicitly stop the previous run. You can do this from the debug menu (the stop button) or from the GAE pane or from the console pane.
You won't need to change the ports after this - the reason you have to do it now is that the first instance is still running, hogging the port. Once you stop it you'll be able to run it again on the same port... WITH your code changes! :)

Related

Attempting to change server after selecting "Remember permanently" when running project on netbeans

Currently, I am building a Vaadin Web Application Project on Netbeans. When looking up how to run the project, I followed the steps on this site:
https://vaadin.com/docs/v8/framework/getting-started/getting-started-netbeans.html
However, I suppose I rashly selected "Remember permanently" after selecting my (Glassfish) server; now, I want to use a different server that I've added (since I realized that the old server was using an occupied HTTP port). However, when I select Run Project in Netbeans, I don't even get the option to select the deployment server anymore (which makes sense due to me selecting Remember permanently). How do I regain access to the "Change Deployment Server" menu (shown at the bottom)?
Link to image because I don't have enough reputation
Also, as for what I've tried, I've tried removing the old server from the Netbeans menu (Tools->Servers) and also removing the local domain that the project was deploying to, but neither of those worked and the program STILL goes to the old port.
To change the server you want to run your application on:
Select the project in the Projects panel.
Right-click and select Properties from the popup menu.
Select Run in the Categories list.
Pick the server you want to use from the Server drop list and click OK.
The next time you run the application it will use your new server.
If the only problem is a port clash you could change the configuration of one of your application servers to use a different port, but the approach described above is simpler.

Eclipse: The selection did not contain any resources that may run on a server

I am currently pursuing a course on Advanced Java. While learning to create JSP Files, I am using Tomcat server and Eclipse IDE. The two connected perfectly well. However, while running the file 'helloworld.jsp' the option 'Run on Server' is available only for one time. After which the option disappears and also the error is detected "The selection did not contain any resources that may run on a server".
How should I proceed with this? I even have tried with several troubleshooting like addition and deletion of the server. But nothing seems to work well.
Did you add server from Window >> Show View >> Server >> Servers?
I think it maybe cause for appearing only once "Run on Server".

Is it possible for Eclipse to only open one JFrame?

When run the project second time, can the previous JFrame closed before open the new one ?
So I no need to close the JFrame when trying to run the project second time.
Is it possible to open only one JFrame?
Eclipse has the possibility of terminating the launched program before starting the new one:
It is called Terminate and Relaunch (see the Documentation).
You can bind this to any shortcut you like (Window -> Preferences -> General -> Keys).
Apparently, eclipse offers some special options to get what you want.
For other people who might be using a different editor: it's possible, but you'd need some kind of communication between the processes.
What you can do is this, make a server application that runs independently and have it open before you start your regular application. When you run your regular application, connect to the server. This server now messages the other application that was running to close down.
If running a server application is too much trouble, you can run both the server and the client in the same application. When you start the application, check if the designated port is busy, if not, create a server. If it is busy, connect to the server and tell it to shut down. After that, open the server socket in the new application.
Select the Terminate and Relaunch command [ Terminate and Relaunch ] to first terminate the selected debug target and secondly, relaunch it.
Once a launch is terminated it can be automatically removed from the Debug View. To change this setting use the Opens the Launching preference page Run/Debug > Launching preference page.
you may find relaunch-plugin for eclipse useful for your case.
I don't know about eclipse but i usually run two or more JFrame applications in (IntelliJ idea) belonging to different classes at a time. The previous one will not be closed. One more thing i would like to suggest you to use IntelliJ Idea from Jetbrains company as the UI,shortcuts and all other stuff are same as in Android Developer kit(studio) which is also sponsored and developed by Jetbrains!..
You can check the JFrame applications running simultaneously in this image.
Hope this answer is somewhat informative.......
!>...

IntelliJ productivity tips running tomcat

I'm developing using IntelliJ 11u on a spring mvc application using tomcat.
I tried the maven jetty plugin, but after a few builds I keep getting java permGen issues and then it just hangs. I was told this was because spring uses log4j and it has some sort of leaks?
Anyhow, I'm asking for tips to help fire up a server, tomcat, with my updated code so I can make quick updates and have tomcat reloaded.
Here are my current annoyances with tomcat:
Only code changes seem to get auto-reloaded, if I make changes to my view pages things don't get updated unless I redeploy. The maven jetty plugin seems to map to my view pages directly and I saw updates to my view pages instantly w/o it even redeploying.
if I have more than 1 thing running in intelliJ, like say I have a main program that I run, or a unit test, IntelliJ seems to re-order what gets run in the run drop down menu and also the shortcut keys get changed to the last thing I ran.
I use google chrome, for some reason when I start tomcat it brings firefox to the forefront and opens a new tab each and every time.
If someone can address any or all of the above issues that would be great as I hate this dance I have to go through just to update/redeploy my application. I wish it could just be a consitant method, using shortcuts or automatically without me having to close the tab created in firefox, and then minimizie it, or redploy for a simple view change etc.
You should configure IDEA to update classes and resources and enable a checkbox in the Run configuration to do it automatically on frame deactivation.
Browser can be changed in IDEA settings and you can disable opening browser at all in Tomcat Run/Debug configuration.
As for the Run panel tabs order, you can pin tabs using the tab right click menu, in this case they will remain in the Run or Debug panel in the order they were created.
Look at JRebel if you want an even more productive environment (It costs, but I find it is worth it). As you can see here, http://zeroturnaround.com/jrebel/features/, it increases the types of changes you can hot-swap (no waiting for a build). I am currently evaluating it myself and will probably pick up a full license.
BTW, if you develop in scala (it looks like you're not, but just in case) the plugin is free.

How do I restart the Google App Engine Java Server in Eclipse?

OK, maybe I'm dumb/blind, but in the docs it says "rebuild and restart the server." But I don't see a button to do this anywhere. Or from any contextual menu. And I can't find anything in their docs explaining how to do it. If I just try to start the app again, it gets angry because I already have App Engine running on the needed port.
Only solution I've found is to restart Eclipse... any other ideas? A screenshot of a button would help if possible. :)
In eclipse, there is a view that contains your Console. If you click on that, you will see the STDOUT and STDERR output of your running application. In the upper right, there should be a red box that will terminate the currently running program.
I have a different and possibly more productive solution for you. Like with most web development environments you probably want to change your source code and have Google Appengine server reload the new code for you.
You need some version of the traditional "touch" unix command (if you work on windows you can download a version from here).
Then go to you project properties, Builders and add a new build step as a "Program". Under "Location" enter the path to your "touch" command ("D:\bin\UnxUtils\usr\local\wbin\touch.exe" for example - on Posix systems just "touch" should be enough since it's already in your PATH) and in "Arguments" put something like "${project_loc}/war/WEB-INF/appengine-web.xml".
Also go to the "Build Options" tab and check "During auto builds".
"touch" will update the timestamp in you appengine-web.xml. When the App Engine server detects changes to you appengine-web.xml it will reload the app automatically. The load process is very fast so it can be done whenever you change any file in your project (which normally triggers the auto-build in Eclipse) - you can tweak the builder to only run when you change certain types of files.
I might add that the "little red box" is not always visible. It drove me crazy reading that same instruction but not seeing the terminate button until I discovered that the Console windows has "layers" that you can select from using the drop-down button on the far right of the controls for the Console view. You just need to go "back" to the console screen that says the server is running and you will see the little red terminate button.
The previous answer wasn't cutting the cheese for me. Upon first starting App Engine, the red square would be available above the text entry area. If I then clicked the run button again, then red square would go away and the console for the previous launch would be replaced by the console for the new launch. To manually stop the App Engine server, you can kill it from the terminal:
http://geekbrigade.wordpress.com/2009/02/26/how-to-find-and-kill-a-process-that-is-using-a-particular-port-in-ubuntu/
In short, "sudo netstat -lpn |grep :8888" and kill the service by process ID.
Strangely, adding Google Web Toolkit to the project made my App Engine launch show up in the Development Mode pane, where it could be easily be killed or restarted.
Just Click on Debug perspective (should be on upper right panel), select the instance of web application on Debug panel (if you don't show it, you could enable by menu Window->show view->Debug) and click on red box of view menu.
The best I've found is to setup the keyboard shortcuts for the console's terminate button, and the run/debug start/restart command. By default, you can enable Command-F2 to terminate, and Command-F11 to restart, its fairly painless. Make sure to enable the full debug menu group (click on main toolbar -> customize, etc)
If you include the gwt SDK in your project, the gwt development mode box contains a reload server button that will work just fine.

Categories

Resources