JSP Pages are not updated for any change in eclipse - 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.

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.

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.

Eclipse modifies server.xml each time run the project (Run-->Run on Server)

I'm using Tomcat 7 on Eclipse Juno. I use workspace metadata as server location (Please see my tomcat configurations below).
Also I got a Server project in eclipse [please see the image below] with separate server.xml and other configuration files.
Normally it works fine. The issue came across after I changed the server.xml (in eclipse project) for SSL configurations.
Configurations are working fine. But each time I run the project (Run-->Run on Server) server.xml get modified to the default version. My customized SSL changes are missing.
Also I tried to change server.xml in tomcat installation location (C:\apache-tomcat-7.0.35\conf), but it didn't pick from eclipse.
Can anyone please help me on this?
Thanks
In {workspace}/Servers you will find a folder for every Tomcat configuration, containing several configuration files, including the server.xml. There you then can edit the file directly.
To get changes taken into account restart Eclipse. That is imho better than removing and adding the configuration back all the time. Tested using Eclipse Mars and Tomcat 7.
(the solution is from: Eclipse with tomcat - eclipse modifies server.xml)
I found an applicable solution but not a perfect one.
What I have done is;
1.Changed server.xml file in installation location (In my case C:\apache-tomcat-7.0.35\conf)
2.Remove tomcat server from eclipse server panel (please see the image below)
3.Create a new server in eclipse server panel.
4.Then Server project will be generated new server.xml with my customized changes.
5.The trick is, initially eclipse picks server.xml from installation location when create a new server in panel.
Thanks
Make sure you are editing the files right beneath the tomcat server folder, not the ones beneath the config folder. Check the attached screenshot for the files I'm referring to.
I had this problem too, and the solution worked (I don't have enough reputation points to vote up the answer).
On a similar note, I had to make configuration changes to a port number and that also required me to delete and re-add my tomcat instance from STS (spring tool suite).
On Eclipse, double click on Server to view properties.
check "publish module contexts to separate XML files", and save it.
Run Tomcat server.
Eclipse will be create conf/[enginename]/[hostname]/[appname].xml without touching server.xml
Make sure that the path in the server.xml is same as in the Web project Settings.
To see the Web Project Settings: Right click on the project >> Properties >> Web Project Settings.
Always give the project path over here. The path in server.xml will automatically updated.
Clean Tomcat Work Directory & Republish the project.

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

Connecting Tomcat server to Eclipse

I am trying to use Tomcat 6.0 as a web development server within SpringSource Tool Suite 2.7.1. I create a runtime, download tomcat, create a server, etc as per these instructions http://www.ibm.com/developerworks/opensource/library/os-eclipse-tomcat/index.html#N10148
When I try to run a web app on the server though I get the following error:
The archive: /Servers/Tomcat/bin/bootstrap.jar which is referenced
by the classpath, does not exist.
I know this bootstrap.jar file does exist in the exact place it says it should be yet it still causes an error. Any ideas?
You might want to check/manually edit your path by going into server properities:
In Servers view,
1) double-click on Tomcat server.
2) Then click on Overview of Tomcat settings appears.
3) "Open launch configuration" then Classpath
4) Edit User Entries here
The trick here was that the location of the jar was inside the Eclipse/STS project directory. STS stores its server configurations inside the /Servers folder and I had decided to store the tomcat runtimes here as well for neatness. Placing the runtimes elsewhere and trying again solves this issue.
None of the above answers provide proper concrete solution.
I faced exactly same issue and i figured out a very simple solution.
Open Eclipse and remove all entries of Apache server
Delete Servers from explorer tab, delete Tomcat from server explorer window, delete server from Window > Preferences > Server > Apache tomcat, delete it, also delete servers folder inside EclipseProjects.
Place Apache tomcat folder outside the project folder anywhere you wish to, you can place in Eclipse_Projects folder but not inside EclipseProjects/projectxyz/.
Now add server in eclipse the usual way and give path of this new location.
This should work!
I had similar issue. This is what worked for me:
When the path begins with slash like: "/Servers/Tomcat/bin/bootstrap.jar" it means that the local project is refered. In the picture - I had 'pivotal-tc-server-developer-3.2.8.RELEASE' as the name of the project.
Open the project ('Servers' in your case or 'pivotal-tc-server-developer-3.2.8.RELEASE') so it is accessible to Eclipse.
The jar should be now visible.
Alternatively go into Run Configurations; delete jars, and add it as an external jar.
Or you may delete the servers configuration, and configure the server again. This works when you may have changed the directory of the server.
I googled my way here on the search terms, "the specified tomcat directory does not exist". (I had moved it from one directory to another.)
For others here for that reason, my solution was to go into Window -> Preferences -> Server -> Runtime Environments and update it there. Then to update the JARs, as in Marcin Wasiluk's answer.
I was also facing same issue and solved it as follows :
My conclusions :
1) In my case issue was coming as I shifted the location of the Tomcat.
Solution :
2) double clicked on the server configured in the eclipse.
3) Click on Open Launch configuration.
4) Change the classpath under classpath tab to the new location.
Hope this would help.
I have faced the same problem.
Solution: In Project Explorer--> Servers(right click) --> Run As --> Run Configurations(click) --> (Select "Tomcat v7.0 Server at localhost") --> Arguments(tab) --> Working directory(bottom of window) --> others : (click workspace) --> select the "boostraps.jar" from -->Server.
Eg., My workspace.MY path is:
Project Explorer --> Servers(right click) --> Run As --> Run Configurations(click) --> (Select "Tomcat v7.0 Server at localhost") --> Arguments(tab) --> Working directory(bottom of window) --> others : (click workspace) --> /home/ciprus//Servers --> click apply.
this could happen if you probably used previous tomcat server in eclipse, so deleting server and its configuration and creating another one will make it work .
You can try as below steps:
Open Window -> Preferences -> Server -> Runtime Environments
Click add button, choose the what's kind of server you use.
Click next button, give a name to your runtime server and the path of tomcat.
New a new server with the new created runtime server
same problem in my case also i solved::
just remove your older tomacat server and add tomcat 8.0 version only
If you have unzipped downloaded Tomcat archive into Eclipse Servers folder, User Entries in classpath have relative path (e.g. /Servers/....) of bootstrap.jar and tomcat-juli.jar which path I guess is not accessible as a relative path.
Once I removed Tomcat installation directory (with files) outside Eclipse's Servers folder, delete the old configuration and re-add Tomcat, everything worked as expected.
I hope this helps narrow down the cause.