how to make eclipse + tomcat instant deploy for webapps - eclipse

I build a maven project and deploy this war into tomcat webapps folder then started tomcat, so that my app available in browser as localhost:8080/myApp
I can see myApp folder which was extracted from myApp.war under tomcat/webapps.
I can modify this app's UI by editing files undertomcat/webapps/myApp/.. using Notepad++.
I send this project to my co-worker, he also import this project in his eclipse and run this app.
He changed the jsp and js files from eclipse and the result will be reflected in browser, he never used separate editor to this modification.
If I change the files in eclipse then it is not reflected in browser.
What I need to do for the same to be working to me?

If you just want Hot deploy in Eclipse, please try to take following steps:
Double clicks on the Tomcat plugin, refer to publishing tab, make sure Automatically publish when resources change is selected. This should be the default option, to support “hot deploy” resources, for example : JSP, XML and properties files.
In the Tomcat Plugin page, clicks on the Module view, make sure Auto Reload is Disabled. Default is enabled.
Note:
This is an important step, failed to set the auto reload to disabled, the Tomcat server will be restarted every time you modified something!
Start Project in DEBUG mode. Hot Deploy is supported in DEBUG mode only.
Limitation
Hot deploy has supported the code changes in the method implementation only. If you add a new class or a new method, restart is still required.
To simulate it, try to add a new method, following pop up screen will be displayed, saying the code changes cannot be hot swapped in the JVM.

Related

Reflecting changes from jsp, css, js, html onto browser without reloading the page

I have a Dynamic Web Project on eclipse and Tomcat 7 as the server (using within eclipse). After doing 'Run on Server' on the project, it gets deployed and runs on the browser. However, any changes made to the css/js/html/jsp files do get published automatically on save, however doesn't get reflected on the browser without reload.
Is there any way to make changes visible on the browser without any reload?
For me the problem appears to be fixed by removing the "antiResourceLocking=true" attribute from the Tomcat "context.xml" element.
This is consistent with this post
I'm still trying to determine why Eclipse WTP decides to put this attribute in there in some situations and not others. I have other webapps that are run in Eclipse in the same way and they don't have that attribute set.

Eclipse with Tomcat does not automatically republish my WAR file

I've got Windows 8.1 with a 1.6 JDK manually installed.
I'm using Eclipse (Kepler, Java EE IDE for Web Developers).
I imported a project that builds a WAR file using an Ant build script; that shows up as a Project.
I created a Tomcat6 Server (downloading the available Eclipse package); that shows up as a second Project.
On the Modules tab for the Server, I clicked "Add External Web Module...", browsed to the folder holding my WAR file and clicked OK. I then added the name of my WAR file (directory name "...\SpiffyApp" to file name "...\SpiffyApp\spiffyapp.war"). I confirmed that the name of the path is "/"; I clicked to have "Auto reloading enabled" checked, and clicked OK.
I admit - I peeked inside the Server configuration. I clicked on "Open launch configuration"; in dialog "Edit launch configuration properties", on the Arguments tab, I discovered the following property setting:
-Dcatalina.base= "....metadata.plugins\org.eclipse.wst.server.core\tmp0"
Then in my mischief I observed that the "tmp0" directory had a "webapps" subdirectory. Aha!
I notice that, under some circumstances, the "SpiffyApp" is republished under "webapps" - problem is, I can't figure out when!
Specifically, I'm disappointed that Eclipse doesn't republish my app to "webapps" when I tell the server to "Clean"/"Publish". What I'd really like is for it to republish automatically when I rebuild the WAR.
I can get the WAR redeployed when I do all of this:
stopped my Tomcat Server
delete all folders under "tmp0/webapps"
delete all folders under "tmp0/work" (tip I got from Chris Lercher, here)
rebuilt my WAR file
Started my Server
Surely I'm doing something wrong.
What are the rules here? Am I really left to remove the Web Module, delete the folder in "tmp0" and re-add the Web Module?
What you're doing wrong is expecting it to watch for changes on an archive file, which generally isn't expected to change. Import the WAR as a project and then Eclipse can deploy it properly when something actually changes within the app.
Otherwise you might try forcibly Cleaning the server area from the context menu of the Tomcat server instance in the Servers View.

In eclipse, republish doesn't work

I do most of my web development in XSL/JS. Up til now, I was able to change any .xsl file, the server would republish the resources and next time I refreshed that page on my browser, I'd be able to see the changes. Now I have to restart the server every time I want to see a change after modifying an xsl file.
Things I've tried:
Build Automatically is ON
Automatically republish when resources change is selected
Clearing my browser cache
Manually clicking "republish" on my server.
Cleaning Tomcat
Cleaning the work directory
Removing and adding the project on the server
Using tomcat 6.0 in Eclipse Juno

JSP Pages are not updated for any change in eclipse

I m new to JBOSS and eclipse. I installed jboss-as-7.1.0.Final and eclipse Indigo version. When I create a new JSP page and then run it, the page can be seen in the browser when JBoss has started & running. But when I change some thing in JSP page and copy the page and past it into the deployment path (for me: /home/aash/App/jboss/jboss-as-7.1.0.Final/standalone/deployments/TestingJBoss.war), the change can't be seen.Even if I delete the jsp file from that location (and clean the browser), still the browser shows the page. But when the JBoss stops, and when it is restarted again, server gives 404 error as expected. When I again copy the relavant JSP page into above mentioned location, then the page can be seen.
I run & stop the JBoss from the Eclipse IDE. Can any one let me know where the problem exists or any source where I can find a solution.
Is there any good justification of replacing the jsp in deployments folder manually?
Anyway follow these steps and you should be good
Replace the jsp wirh the new one at correct location. (make sure the path is correct).
Is your project structure like , during build , jsps are copied from some projects to war webcontent ? Just be sure that your new jsp is updated everywhere.
After that , in eclipse , right click server and select publish. Then try access the jsp.
By default, when you develop for JBoss 7 using Eclipse, changes to Java class and JSP don’t get automatically published. You have to right click the web module in the Servers view and select Full Publish for the changes to take effect. This can be really painful after a while. I found these steps to fix the problems.
Publish Java Class Changes
In Eclipse, double click JBoss server in the Servers view. Under Publishing select Automatically publish when resource changes. Under Application reload behavior, select Customize application reload behavior. Enter the following regular expression pattern.
\.jar$|\.class$ //this pattern is for trigger of redeployment.
Your session will be lost if application is redeployed. so ignore to put JSP or classs file patterns
Save changes and restart the server. Now, when you save a Java file, system will automatically restart the application so that the changes take effect.
Publish JSP Changes
This one takes a little more work. Essentially, JBoss 7.1.1 has a defect where changes to JSP file are not picked up by the server even in development mode.
First, we need to enable JSP debug mode. Open the server’s standalone.xml. Locate the line:
<subsystem xmlns="urn:jboss:domain:web:1.1" ...>
Below that add these lines:
<configuration>
<jsp-configuration development="true"/>
</configuration>
Save and close the file.
Download the fixed jboss-as-web-7.1.1.Final-RECOMPILE.jar file from Datafilehost.com. Save the file in jboss-as-7.1.1.Final/modules/org/jboss/as/web/main folder.
In the same folder there is a module.xml file. Open it. Comment out the buggy file and use the new file as shown below.
<!--
<resource-root path="jboss-as-web-7.1.1.Final.jar"/>
-->
<resource-root path="jboss-as-web-7.1.1.Final-RECOMPILE.jar"/>
Save and close the file.
Information taken from this Mobiarch blog article.

Stop Eclipse restarting my web app on file save

I'm creating a JSF/Facelets web app in Eclipse. I've configured my project to use a Tomcat (6.0) server that is started/stopped by Eclipse.
Whenever I save a file (eg .xhtml) Eclipse restarts the app, trashing my HTTP session. This is annoying, because I'm frequently updating my .xhtml files, and the app doesn't need restarting to detect the changes.
Is there a way to stop Eclipse restarting the app? Specifically, can I configure Eclipse to only restart the app when I save files of a certain type?
In the server View, double click on your Tomcat instance.
This will open the properties of your Tomcat server.
As I am not sure of which parameter will help you to solve your problem, check the following options in the latter view:
Automatic Publishing, option "Override default settings" selected, 1 second for the publishing interval.
In server options, uncheck options "Server modules without publishing" and "publish module contexts to separate XML files".
In the modules tab, for each modules deployed, check that Auto Reload is enabled.
Hope this will help you.
I have always used this and it works fine for me. The context is reloaded only when you change classes or the web descriptor.
In your project structure where you keep .xhtml files which makes eclipse reload the context on changing?
This can happen if you have a builder in Eclipse set to deploy on save. Right click on your project -> properties -> builders
Turn off "Build Automatically"