Jonathan Jonathan - 4 months ago 34
Java Question

JSP changes not reflecting when server is run. (JBoss, Maven, Eclipse)

I don't think the issue is isolated solely to my JSPs. However, the current files I'm trying to edit are JSPs.

Whenever I make changes to my JSP, I save the file (in Eclipse), clean/republish my JBoss server, start the server, and access the application (localhost), yet the changes I made are not reflected on the page at all.

I go to the JBoss temp directory to see exactly what version of the file (that I'm editing) the server is currently using. I always see that it's using the original version that I pulled down from the original repo. I have no idea why it's not changing.

I tried re-cloning and re-importing everything just out of desperation, and I'm getting the same results.

In addition, strangely, when I run the command

mvn -U clean package -DskipTests=true
to do a command-line build using Maven, my file reverts back to the original/unchanged version. (New to Maven, so it's strange to me at least).

So, essentially any changes I am making to files for my project aren't being reflected on my local test server. I'm totally stumped as to why it's behaving like this.

EJK EJK
Answer

You can put JBoss in development mode. This is a mode in which JSPs are always re-compiled. Thus when you deploy a JSP change, you can immediately see it.

For JBoss 7, edit the file: /jboss/{server_name}/configuration/standalone.xml. Locate the "jsp-configuration" element and set the "development" attribute to true.

        <configuration>
            <jsp-configuration development="true" x-powered-by="false"/>
        </configuration>

Note:

  • This file is in a different location in different versions of JBoss.

  • {server_name} in the path above will be specific to your JBoss install. If you have not created a server, then this value is likely "default" for you. You can easily find this value by looking at where your web app is deployed.

  • It is a good idea to deploy your web application in "exploded" format. That is, rather than deploying it as a WAR file (which takes time to build), explode (i.e. unzip) the contents of the web app right in the JBoss deployment area. That way when you need to make a JSP change, you simply copy the one JSP file.