Débora
Débora

Reputation: 5952

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.

Upvotes: 0

Views: 4051

Answers (2)

Dev
Dev

Reputation: 11

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.

Upvotes: 1

Mukul Goel
Mukul Goel

Reputation: 8467

Is there any good justification of replacing the jsp in deployments folder manually?

Anyway follow these steps and you should be good

  1. 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.

Upvotes: 1

Related Questions