Reputation: 36799
I am editing JSP files which are residing directly inside tomcat/webapps/myapp/WEB-INF
, but to see the changes, I have to restart the server. As far as I know, JSP changes don't require you to restart the server. The only configuration I found which is related to automatic reloading is reloadable = "true"
Set to true if you want Catalina to monitor classes in /WEB-INF/classes/ and /WEB-INF/lib for changes, and automatically reload the web application if a change is detected.
I used this attribute in the context.xml
, but still the problem persists. What could be the other possible reason of not detecting changes in JSP files without restarting?
@Bozho:
This is the excerpt from web.xml
. Do I need to change something?
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>fork</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>xpoweredBy</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
Upvotes: 33
Views: 98287
Reputation: 7
Go to your web.xml find your jsp servlet, add this parameter after the other ones:
<init-param>
<param-name>developer</param-name>
<param-value>true</param-value>
</init-param>
Upvotes: 0
Reputation: 1
Actually jsp engine check whether jsp page is older than its servlet page or not and on the basis of this it it's decide whether changes are needed or not.
Upvotes: -2
Reputation: 1376
I too faced this problem while doing jsp changes in myeclipse, those are not reflecting in the application while running. I hope these checks will help you.
I hope this will help you.
Upvotes: 0
Reputation: 1443
(Tomcat 7.0.62) I had to go to CATALINA_HOME/temp/xx-mysite/, find my jsp file in that directory tree and edit it.
xx is a random(?) prefix number, in my case 11, but every site had one.
Upvotes: 0
Reputation: 51
I am using TomEE 1.7.2 on Windows 7 with Eclipse. The solution that worked for me was simply changing the web.xml file for the TomEE server at localhost-config (in my IDE) so that the development init param is true:
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>fork</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>xpoweredBy</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>development</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
Upvotes: 0
Reputation: 518
Open your context.xml
file in your META-INF folder and set antiJARLocking
to false.
Your directory tree should be as follows:
Web > META-INF > context.xml
Upvotes: 0
Reputation: 129
I had the same problem and fixed the issue.
Make sure that in conf/context.xml
you do not have following configuration
<Context antiJARLocking="true" antiResourceLocking="true">
If you have that one, remove both antiJARLocking="true" antiResourceLocking="true"
, just write
<Context>
Upvotes: 6
Reputation: 848
An even more late answer ...
Setting "antiResourceLocking" to "true" in the context file may prevent JSP to be reloaded by the Tomcat (Bugzilla 37668).
This is documented on the Tomcat doc, at the "antiResourceLocking" parameter explanation
Upvotes: 11
Reputation: 2101
Simple to figure out though it may be, here's what "setting development to true" means (more for a quick reference):
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>fork</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>xpoweredBy</param-name>
<param-value>false</param-value>
</init-param>
<!-- Add the following init-param -->
<init-param>
<param-name>development</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
And then restart.
Upvotes: 7
Reputation: 494
Synchronize server & client time
you can check your server time and client system time. For me a few days ago after changing the server time correctly worked. It reflected the changes of the .jsp files.
Upvotes: 2
Reputation: 9054
A late answer, anyone else might find this useful though.
Check the permissions on the Tomcat folder, I have tried a lot of other solutions and it did not work out.
Finally I gave my 'user account' 'Full control' permission to the Tomcat folder and Tomcat picked up the changes whenever I made a change in JSP. I am assuming you are using Windows.
The rationale behind this was: whenever you make a change in JSP, it has to be compiled and deployed (written) to the webapps folder. If there is no 'write' permission on that folder, it will silently fail. This was happening in my case. So if reloadable = true
and development = true
in the context.xml do not work, try this permission fix.
I am using Tomcat 7 on Windows 7.
Upvotes: 3
Reputation: 1
You will need to go to the server project in Eclipse and edit the web.xml file and set 'development' to true.
Upvotes: 0
Reputation: 597362
In the tomcat docs, see the development
setting. It must be set to true in order to have jsps reloaded.
development - Is Jasper used in development mode? If true, the frequency at which JSPs are checked for modification may be specified via the modificationTestInterval parameter.true or false, default true.
This is in your CATALINA_HOME/conf/web.xml
Additionally, if you need to refresh a jsp in a production environment without restart, you can go to CATALINA_HOME/work/Catalina/localhost/contentName/org/apache/jsp
and delete the your_jsp.java
and your_jsp.class
files. They will be recreated the next time they are accessed.
Edit: after providing your configuration, and comment about not refreshing the content, I have another though: clear your browser cache, or open the page from another browser.
Upvotes: 32