Intellij 10.5 restarting Tomcat whenever I compile jsp file

Hi there,

Ever since I upgraded Intellij from version 9 to 10.5, The Tomcat server keeps restarting itself whenever I Compile (package) a jsp file, this didn't happen before in version 9 as Intellij would just refresh the jsp file without the need to restart Tomcat.
Any help sorting this out would be much appreciated as it's quite annoying.

Many thanks,
Tamer

0

check your context. xml definition in tomcat, probably it has reloadable=true, so tomcat reload app on any detected change regardless whether it's a war or an exploded deployment.

regards, Alex

0

If the WAR is not deployed why Tomcat notices that it is changed? Perhaps you specified /webapps as the output directory for the WAR so
the WAR is deployed.

I've created an issue about Maven resource filtering in our tracker: http://youtrack.jetbrains.net/issue/IDEA-71999.


    It should not affect your running app.
  a) It does affect our running app; Tomcat redeploys the webapp if the WAR is changed
  b) Even if I delete the WAR, when I package a resource the WAR is recreated with only the packaged resources in it.
  c) Furthermore, I don't want it to change the WAR because I want Jrebel to manage  changes to the webapp

  So, just to reiterate (because you don't seem to understand) the WAR is being updated when it shouldn't be, which causes us problems even when
running in war-exploded mode, as Tomcat redeploys the app.

  Also, surely packaging should incorporate any maven resource filtering otherwise it would package files with non-interpolated placeholders?


--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0

If the WAR is not deployed why Tomcat notices that it is changed? Perhaps you specified /webapps as the output directory for the WAR so
the WAR is deployed.


Indeed it doesn't notice that it changes if you delete it first.

However, as I mentioned, if you package a resource, in IDEA X (not 9) the WAR is then created. Next time I start Tomcat, it watches the newly created WAR.

Perhaps you specified /webapps as the output directory for the WAR so the WAR is deployed.


Nothing has changed in our configuration - this a problem that has arisen purely having upgraded from IDEA 9 to X.
Alvaro sent you our configuration a lot earlier on in this post.

I've created an issue about Maven resource filtering in our tracker: http://youtrack.jetbrains.net/issue/IDEA-71999.

Thanks for that.

Can you also create an issue for the problem of update / creation of the WAR when a resource is packaged?

0

Why do you think that Tomcat watches the newly created WAR? If the WAR isn't deployed by IDEA, isn't placed under /webapps directory and isn't
deployed by some external tool Tomcat will not be able to find it at all.

Also as I've already said behaviour of 'Package file' was the same in IDEA 9: it will also create the WAR if it was deleted.

Indeed it doesn't notice that it changes if you delete it first.
  However, as I mentioned, if you package a resource, in IDEA X (not 9) the WAR is then created. Next time I start Tomcat, it watches the newly
created WAR.

  Nothing has changed in our configuration - this a problem that has arisen purely having upgraded from IDEA 9 to X.
  Alvaro sent you our configuration a lot earlier on in this post.


--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0

Why do you think that Tomcat watches the newly created WAR? If the WAR isn't deployed by IDEA, isn't placed under /webapps directory and isn't
deployed by some external tool Tomcat will not be able to find it at all.


Well, it's running with the Tomcat Server configuration within Intellij, deploying the war exploded. I don't know how this works internally, but running via this, Tomcat IS monitoring the WAR in the target dir.
If, running Tomcat within Intellij,  you touch an existing WAR in your target dir, does Tomcat (6) not reload the webapp for you?

Also as I've already said behaviour of 'Package file' was the same in IDEA 9: it will also create the WAR if it was deleted.


Not true for us. In IDEA9 the WAR was not created or updated when files were packaged. This has changed in IDEA X for us, without any other changes to our code.

0

Yes, if the WAR isn't deployed it doesn't affect Tomcat for me.
You can enabled additional logging in Tomcat to see which file triggers reloading. Uncomment the following lines in /conf/logging.properties:
org.apache.catalina.startup.ContextConfig.level = FINE
org.apache.catalina.startup.HostConfig.level = FINE

After that Tomcat should periodically print lines like "Checking context[] redeploy resource..." to the output so you will be able to see which files
are watched for changes.


  Well, it's running with the Tomcat Server configuration within Intellij, deploying the war exploded. I don't know how this works internally, but
running via this, Tomcat IS monitoring the WAR in the target dir.
  If, running Tomcat within Intellij,  you touch an existing WAR in your target dir, does Tomcat (6) not reload the webapp for you?

--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0

We have a standard tomcat instalation, I've checked contect.xml and the only watched resources are web.xml, which is the default. We do have reloadable=true set on the host in server.xml too, we haven't modified this configuration since upgrading from version 9 to 10?


server.xml

<!-- Define the default virtual host
           Note: XML Schema validation will not work with Xerces 2.2.
       -->
      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">

context.xml

   <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>

0

You have to investigate server.xml and context.xml under the directory listed at tomcat startup time(in bold):

cmd /c C:\java-3rdparty\apache-tomcat-6.0.29\bin\catalina.bat run
Using CATALINA_BASE:   "C:\usr\JetBrains\IDEA System B\tomcat\Unnamed_untitled1"
Using CATALINA_HOME:   "C:\java-3rdparty\apache-tomcat-6.0.29"
Using CATALINA_TMPDIR: "C:\java-3rdparty\apache-tomcat-6.0.29\temp"
Using JRE_HOME:        "C:\usr\jdk1.6.0"
Using CLASSPATH:       "C:\java-3rdparty\apache-tomcat-6.0.29\bin\bootstrap.jar"
15.07.2011 14:58:29 org.apache.catalina.core.AprLifecycleListener init
INFO: Initializing Coyote HTTP/1.1 on http-8180


try to just clean artifact.

regards, Alex

0

We don't use CATALINA_BASE - so it is the same as CATALINA_HOME for us.
I don't run catalina.sh directly, I run the webapp through Intellji.

All the Tomcat config appears to be copied to the .IntelliJIdea10/system/tomcat/ dir each time (why??)
This includes a server.xml (which seems to override the original one in CATALINA_HOME).
Also, the the file in .IntelliJIdea10/system/tomcat/xxx/Catalina/localhost/intl.xml (our context file) seems to have the Context docBase dynamically inserted.

I have to reiterate that all this is exactly the same as what happend under IDEA 9. It worked then. It doesn't now. Something in IDEA X has changed.

0
Yes, if the WAR isn't deployed it doesn't affect Tomcat for me.


What about if the WAR exists, does it affect you then?

You can enabled additional logging in Tomcat to see which file triggers reloading. Uncomment the following lines in /conf/logging.properties:
org.apache.catalina.startup.ContextConfig.level = FINE
org.apache.catalina.startup.HostConfig.level = FINE


Thanks, good tip. This is the FINE logging I get, with ignored.war being the name of the WAR file I do NOT want to be watched:

FINE: Processing context [/intl] configuration file /home/jcavell/.IntelliJIdea10/system/tomcat/runConfig conf/context.xml
FINE: Successfully processed context [/intl] configuration file /home/jcavell/.IntelliJIdea10/system/tomcat/runConfig conf/context.xml
FINE: Processing context [/intl] configuration file /home/jcavell/.IntelliJIdea10/system/tomcat/runConfig/conf Catalina/localhost/context.xml.default
FINE: Processing context [/intl] configuration file /home/jcavell/.IntelliJIdea10/system/tomcat/runConfig/conf/Catalina/localhost/intl.xml null
FINE: Successfully processed context [/intl] configuration file /home/jcavell/.IntelliJIdea10/system/tomcat/runConfig/conf/Catalina/localhost/intl.xml null
FINE: Processing context [/intl] web configuration resource file:///home/jcavell/.IntelliJIdea10/system/tomcat/runConfig/conf/web.xml
FINE: Parsing application web.xml file at jndi:/localhost/intl/WEB-INF/web.xml

FINE: Watching WatchedResource '/home/jcavell/.IntelliJIdea10/system/tomcat/runConfig/conf/context.xml'
FINE: Watching WatchedResource '/home/jcavell/.IntelliJIdea10/system/tomcat/runConfig/conf/Catalina/localhost/intl.xml'
FINE: Watching WatchedResource '/home/jcavell/.IntelliJIdea10/system/tomcat/runConfig/conf/web.xml'

FINE: Checking context[/intl] redeploy resource /home/jcavell/.IntelliJIdea10/system/tomcat/runConfig/conf/Catalina/localhost/intl.xml
FINE: Checking context[/intl] redeploy resource /home/jcavell/work/webapp/target/ignored
FINE: Checking context[/intl] redeploy resource /home/jcavell/work/webapp/target/ignored.war
FINE: Checking context[/intl] reload resource /home/jcavell/.IntelliJIdea10/system/tomcat/runConfig/conf/web.xml
FINE: Checking context[/intl] reload resource /home/jcavell/.IntelliJIdea10/system/tomcat/runConfig/conf/context.xml
FINE: Checking context[/intl] reload resource /home/jcavell/.IntelliJIdea10/system/tomcat/runConfig/conf/Catalina/localhost/intl.xml

Again, I'd like to say that the problems we're seeing did not occur in IDEA 9.
How do I stop this stuff being watched?

0

We don't use CATALINA_BASE

Don't you? Take a look a the IDEA console when you start tomcat from within idea.
For me the problem is mutiple context defintions. Some cached at the moment of creation Tomcat server and one generated dinamically by idea. You can see it in the logs . Insistently suggest you to investigate content of CATALINA_BASE taken from idea console to see the problem. Can bet, once you setup new clean tomcat without any modifications the problem will disappear.

regards, Alex

0
CATALINA_BASE taken from idea console


I'm not sure what you mean by this - but if you mean look in the server tab when I run Tomcat within IDEA, then there is no mention of CATALINA_BASE.

What changes are you proposing I make? I've already deleted all Tomcat server configurations and configured new ones and have the same problem.

0
What changes are you proposing I make?

You  have to download tomcat from apache, unzip it any dir you like. Create  new server definition within idea, then try to deploy your artifact to  this server.

To check is it tomcat related issue -  open shell, set catalina_base to the same value as then started from within idea, and start tomcat. try to modify jsp and most probably you'll get the same behavior.

I used to see usual tomcat output within idea, can't imagine how it could another:
Безымянный.png

0

deleted - duplicated message

0

For us, In IDEA 9, the webapp:war configuration points to a different WAR than in IDEA X. This setting is imported from Maven (it changes whenever a different Maven profile is chosen). Maybe this was a latent bug that has been fixed in IDEA X.
In IDEA 10, our WAR is called 'ignored.war'. The webapp:war exploded configuration (the same for both 9 and X) has the output directory set to /webapp/target/ignored

Packaging in IDEA 9 updates the different WAR file - one that isn't watched by Tomcat - and so does not result in the webapp being redeployed.

Packaging in IDEA X updates ignored.war, watched by Tomcat, and results in the webapp being redeployed.
If I edit Artifacts -> webapp:war and change the name of the war file, or delete the artifact completely, then run webapp:war exploded, packaging a file does not update the WAR file.
This is an IDEA bug. Changing the configuration of webapp:war should not influence the running of webapp:war exploded. The WAR should not be updated when a resource is packaged in war exploded mode.

Please let me know when you plan to fix this.

Thanks.

PS There seems to be very little I can do about all this. The server.xml configuration that IDEA copies over whenever a Tomcat Server config is run clobbers my setting of autoDeploy="false"
PPS Because changing a Maven profile results in the reloading of the Artifacts config, this clobbers any changes I might make here too.

0

maven synch is bit pain in the ass, there are some workarounds, see:
http://youtrack.jetbrains.net/issue/IDEA-58474
http://youtrack.jetbrains.net/issue/IDEA-58965

0

I have a work around for this problem.

If you follow the steps below, Hot Deploy will work exactly as it did  with IDEA 9.

   * Go to Project Settings (click on your Project and press F4)
   * Click on Artifacts
   * Click the + button to create a new Artifact
   * Choose "Web Application Exploded" -> choose "From Modules" ->  choose "webapp"
   * Name it e.g. "war:exploded"
   * Click the + button to create a new Artifact
   * Choose "Web Application Archive" -> choose "For war:exploded"
   * Change the Output directory for "war:exploded" to  the existing value for your exploded war)

Then simply create a new Tomcat Server configuration (or replace the old  ones):

   * Click on Edit Run Configurations
   * Choose "Tomcat Server" -> right click for "Add new configuration"
   * In the Deployment tab Click the + button and choose "war:exploded"
   * Remember to put in the Application Context,
   * Untick "Build war:exploded artifact" if this is checked

0

Hi Jonny,

my warkaround is somewhat similar (as described in one of the issues I mentioned)

1. create new artifact (of type "Other")
2. change output directory *and* add exisiting expoloded artifact (war) to it.

This is the step I always do (at least when using maven)..

0

I think the actual problem is that ignored.war is watched by Tomcat despite it isn't deployed. If we change 'Package File' action to update only
deployed artifacts it may leads to problems for other users. E.g. someone may use 'Package File' to update some archive deployed by an external app
not by IDEA.

So I think the right way to handle the problem is fixing Tomcat configuration to avoid watching ignored.war file. Which version of Tomcat do you use?
Could you please try to install a fresh copy of Tomcat, setup the run configuration in IDEA to use it and clear
/home/jcavell/.IntelliJIdea10/system/tomcat directory to see if it helps?


This is an IDEA bug*. Changing the configuration of webapp:war should not influence the running of webapp:war exploded. The WAR should not be updated
when a resource is packaged in war exploded mode.*

Please let me know when you plan to fix this.


--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0

metrixon wrote:

I have seen this behaviour when you deploy the artifact of the packaged WAR file rather than the artifact for the exploded WAR.



That was it for me.

Thanks Christian!

~ Mike
0

请先登录再写评论。