In eclipse, republish doesn't work - eclipse

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

Related

how to make eclipse + tomcat instant deploy for webapps

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.

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/Tomcat configuration for updating resources on page refresh

I am working on a website written in java spring with maven.
I would like to use Notepad++ or some other external program other then eclipse to edit my js/html files. but i also need my server to be running, and always redeploying my resources when i refresh the browser.
right now if i work and edit the files from within eclipse, when ever i save a file the website is being redeployed and the refresh gives back the modified files. but if i use Notepad++ to edit the files, the server does not refresh them.
is there a way to make eclipse/tomcat always fetch the files from the server (like a no caching kind of configuration).
Thanks
There's an option in Eclipse to poll files on the filesystem, making it aware of changes made to files by external editors.
The setting is located in the Eclipse preferences
Preferences > General > Workspaces > Refresh using native hooks or
polling
It takes a second or 2 for Eclipse to pick up changes, and there most likely will be a performance penalty as it needs to poll your entire workspace on a regular basis but it should do the job.
It also works well with Servers configured in Eclipse that need to be republished when files are changed (cfr Tomcat Server)

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"