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
Avatar
Permanently deleted user

What do you mean by 'keeps restartings'? Do you mean that the Tomcat java process is stopped and started again or that Tomcat prints 'restarting
context' message in the console and restarts the app?

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

0
Avatar
Permanently deleted user

Hi Nikolay,

Thanks for your response, I meant that the Tomcat server actually stops and then starts again, which obviously is time consuming but also loses all existing sessions, etc

Thanks,
Tamer

0
Avatar
Permanently deleted user

It's very strange. Do you have any third-party plugins installed?

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

0
Avatar
Permanently deleted user

No I don't believe I do, it's a fresh intellij 10.5 installation

0
Avatar
Permanently deleted user

How do you invoke 'Package file' action? Do you invoke by clicking on the item in the popup menu or by using keyboard shortcut?
Could you please also attach your project files (*.iml files and .idea directory)?

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

0
Avatar
Permanently deleted user

Hi Nikolay,

I use the keyboard shortcut for Compile, strangely though the Compile button is greyed out on the Build Menu!
Please find the project files attached.

Thanks,
Tamer



Attachment(s):
.idea.zip
webapp.iml.zip
0
Avatar
Permanently deleted user

Which run configuration do you use to start Tomcat? Is it Tomcat run configuration or Maven run configuration?

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

0
Avatar
Permanently deleted user

It's a Tomcat Server configuration

0

Could you please replace your <IDEA_HOME>/bin/log.xml file by the attached one to enable additional logging, reproduce the problem and post here <USER_HOME>/.IntelliJIdea10/system/log/idea.log file?



Attachment(s):
log.xml
0
Avatar
Permanently deleted user

Hi Nikolay,

I've done as you said, please find the file attached.

Cheers,
Tamer



Attachment(s):
idea.log.zip
0
Avatar
Permanently deleted user

Hello,

thank you for the logs. I've found that you switched off 'Make' and 'Build artifact' options in 'Before launch' section of the Tomcat run
configuration. Do you have any specific reason for that? If not please enable these options to see if it helps.

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

0
Avatar
Permanently deleted user

Hi Nikolay,

Yes indeed that was intentional as I build the war file using a Maven configuration before running the Tomcat Server.

Thanks,
Tamer

0
Avatar
Permanently deleted user

May be Tomcat is restarted by some external process. Could you please obtain the process tree before and after 'package file' action using the
following command
ps -eHo pid,ppid,comm | grep "idea\|java\|catalina"
and post its result here?

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

0
Avatar
Permanently deleted user

Hi Nikolay,

The results are:
Before:

10751  8792       idea.sh
10773 10751         java
2192 10773           java



After:

10751  8792       idea.sh
10773 10751         java
2192 10773           java



Thanks,
Tamer
0
Avatar
Permanently deleted user

Hmm, it seems that pid of Tomcat process wasn't changed after 'package file' action. Why do you think that Tomcat process is restarted?

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

0
Avatar
Permanently deleted user

I see what you mean, perhaps it's the Spring application context that gets reloaded, but strangely all the sessions get lost.
Do you see any indication of this in the logs?

0
Avatar
Permanently deleted user

Hi,

I'm not sure if this applies in your case but I have seen this behaviour when you deploy the artifact of the packaged WAR file rather than the artifact for the exploded WAR.
IDEA creates two artifacts for the "Web"-Facet, one for the packaged WAR and one for the exploded WAR.

In case of the exploded WAR, all the files including the JSPs are directly accessible since they are just files in a folder structure - therefore IDEA can replace/update single files.
But if you deploy the packaged WAR, the file can only be replaced as one big file containing all other things. In that case, the web.xml file is updated as well which will trigger an automatic redeployment of your application in the tomcat.

Could you check which artifact is configured for deployment in your "Run"/"Debug"-Configuration ?

-Christian

0
Avatar
Permanently deleted user

Hi Christian,

Thanks for the info, I've just checked and the artifact deployed in the Tomcat configuration is 'webapp:war exploded'
So that should be fine right?

Cheers,
Tamer

0
Avatar
Permanently deleted user

That sounds right to me, but you said before

Yes indeed that was intentional as I build the war file using a Maven configuration before running the Tomcat Server.


Where does this WAR file go ? And why can't you use IDEA to perform the Maven goal before deployment ?

I'm pretty sure that the tomcat is actually not restarting (the PID is the same afterall), but that your  webapp is automatically re-deployed after each change.
The only reason for this that I can think of, is a change to the web.xml file. Is there anything else that might interfere with the exploded data ?
Maybe some external tool that triggers a maven rebuilt once a change is detected ?

- Christian

0
Avatar
Permanently deleted user

I work at the same company as Tamer, and we are all seeing the same problems.

Our app is a standard Maven, multi-module, Spring MVC web application.

When ever anything under src/main/java/resources is packaged (i.e. SHIFT-CTRL-F9 is pressed), this causes the Spring Application Context to be reloaded.
This is irrespective of whether it is run as war-exploded or war.
It is making development quite hopeless.

Also, I would like to disable hot deploy (we are moving to Jrebel) but cannot find a way of doing this. Whenever I choose a different Maven profile (or force a Maven reimport) it re-populates Facet 'Web' Web Resource Directories and Source Roots, interfering with Jrebel.

So, in summary, these are the problems we are having with Intellij 10.5:

  • It reloads Spring Application Context whenever a resource is packaged, when running a Tomcat Server configuration (pointing to apache-tomcat-6.0.18) as both war and war-exploded
    • I can't seem to disable hot deploy irrespective of whether I'm running war or war-exploded
    • The Web Facet Resource Directories etc. keep getting automatically reconfigured from Maven, and I can't seem to disable this.


    Thanks in advance for your help.

    Jonny

    0
    Avatar
    Permanently deleted user

    According to the log provided by Tamer IDEA doesn't perform any additional actions when 'package file' action is invoked. It just copies jsp file to
    the exploded directory and puts it into war archive. So I think that context reloading are triggered by some external application or by some setting
    in Tomcat or Spring configuration.

    What do you mean by 'hot deploy'? If you mean HotSwap in Debug mode after compilation it is controlled by Settings -> Debugger -> HotSwap -> 'Reload
    classes after compilation' option.

    Why do you need to remove Web resource directories? IDEA won't provide most of code insight features (like completion and error highlighting) in JSP
    files if Web resource directories aren't configured properly.

    I work at the same company as Tamer, and we are all seeing the same problems.

    >

    Our app is a standard Maven, multi-module, Spring MVC web application.

    >

    When ever anything under src/main/java/resources is packaged (i.e. SHIFT-CTRL-F9 is pressed), this causes the Spring Application Context to be reloaded.
    This is irrespective of whether it is run as war-exploded or war.
    It is making development quite hopeless.

    >

    Also, I would like to disable hot deploy (we are moving to Jrebel) but cannot find a way of doing this. Whenever I choose a different Maven profile (or force a Maven reimport) it re-populates Facet 'Web' Web Resource Directories and Source Roots, interfering with Jrebel.

    >

    So, in summary, these are the problems we are having with Intellij 10.5:

    >

    • It reloads Spring Application Context whenever a resource is packaged, when running a Tomcat Server configuration (pointing to apache-tomcat-6.0.18) as both war and war-exploded

    >

    • I can't seem to disable hot deploy irrespective of whether I'm running war or war-exploded

    • The Web Facet Resource Directories etc. keep getting automatically reconfigured from Maven, and I can't seem to disable this.

    >

    Thanks in advance for your help.

    >

    Jonny

    >

    ---
    Original message URL: http://devnet.jetbrains.net/message/5307781#5307781



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

    0
    Avatar
    Permanently deleted user

    Thanks for the reply.

    I was trying to avoid Intellij copying files when they are packaged, because I wanted Jrebel to handle this.
    However, I do need Maven resource filtering, so I've fallen back to allowing Intellij to continue to use the Web Resources directories.

    I am running the WAR from the Tomcat Configuration in non-exploded mode. I am finding the following happens whenever I simply package a resource:

    * It copies the file to the exploded WAR and the packaged WAR. I don't know why it copies it to the packaged WAR - I don't want it to; can I stop it doing this?
    * Sometimes it bypasses Maven resource filtering, resulting in placeholders erroneously making their way into the WAR
    * It restarts the Spring application context every time (not Tomcat, this has never been a problem).

    So, if I e.g. save a resource bundle called messages.properties, the following are the only files modified within my project, but results in the application context being reloaded:

    ./xxx.build-all.iws
    ./webapp/target/ignored/WEB-INF/messages/default/messages.properties
    ./webapp/target/ignored.war
    ./webapp/src/main/messages/myApp/default/messages.properties

    The only thing changes in the WAR is the change to the properties file.


    Exactly the same Intellij and webapp configurations work without these issues in Intellij 9. Something about upgrading to version 10 results in this behaviour for everybody where I work.

    0
    Avatar
    Permanently deleted user

    Hi, do you have an update on this? There is very little documentation on hot swap/depoy within Intellij, surely ths is a bug in version 10.5.x ?

    0
    Avatar
    Permanently deleted user

    What do you mean by 'avoid IntelliJ copying files when they are packaged'? The only purpose of 'Package File' action is to copy file to output
    directories/archives.

    When 'Package File' action is invoked it copies the selected file to output directories/archives for all configured artifacts containing this file.
    There are now way to specify which artifacts will be updated and I doubt that we need such an option. Why do you need to bypass updating for the war
    archive?

    Let's clarify which kind of deployment you use: the exploded directory or the war archive. If you deploy the war archive to Tomcat and call 'Package
    File' action the whole war archive will be changed so Tomcat will restart your application (and Spring context will be restarted too, of course).

    Thanks for the reply.

    >

    I was trying to avoid Intellij copying files when they are packaged, because I wanted Jrebel to handle this.
    However, I do need Maven resource filtering, so I've fallen back to allowing Intellij to continue to use the Web Resources directories.

    >

    I am running the WAR in debug / non-exploded mode. I am finding the following happens if I package a resource or JSP file:

    >

    • It copies the file to the exploded WAR and the packaged WAR. I don't know why it copies it to the packaged WAR - I don't want it to; can I stop it doing this?

    • Sometimes it bypasses Maven resource filtering, resulting in placeholders erroneously making their way into the WAR

    • It restarts the Spring application context every time (not Tomcat, this has never been a problem).

    >

    Exactly the same Intellij and webapp configurations work without these issues in Intellij 9. Something about upgrading to version 10 results in this behaviour for everybody where I work.

    >

    ---
    Original message URL: http://devnet.jetbrains.net/message/5308059#5308059



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

    0
    Avatar
    Permanently deleted user

    Thanks for that reply. So, to clarify something from our point of view too - this all worked in Intellij 9, and it's only since we upgraded to 10.5.x that we've had these problems.

    You said:

    If you deploy the war archive to Tomcat and call 'Package File' action the whole war archive will be changed so Tomcat will restart your application (and Spring context will be restarted too, of course).


    But this is the point, I don't want the WAR archive to be changed. Upon packaging I want e.g. a Spring Application Context file to go through e.g. the maven filter resource phase and then be copied to the output dir (monitored by Jrebel), but not then to the WAR.

    And herein lies the bug with 10.5.x - packaging a file results it being copied to the WAR, irrespective of whether the webapp is being run as war or war-exploded (FYI this change in the WAR occurs even if a file hasn't changed and it is not copied to the output dir). In IDEA 9 it wasn't copying to the WAR when being run either as war or war-exploded. This is how 10.5.x should behave.

    Can you fix this as a matter of urgency please?

    Thanks

    Jonny

    0
    Avatar
    Permanently deleted user

    Hi

    Are you looking into this problem? There are quite a few people where I work who are making a case for us switching to Eclipse, and this issue gives them some good ammunition. Having paid up for dozens of IDEA X licenses I feel Intellij should be helping us to resolve this ASAP. Please let me know if there is any further information I can give you that will be of use.

    Thanks.

    0
    Avatar
    Permanently deleted user

    Hmm, the behaviour of 'Package File' action wasn't changed in IDEA 10. I've just checked it in IDEA 9.0.4: if you have both exploded and war artifacts
    configured 'Package File' action copies file to the both artifacts.

    Do I understand correctly that you deploy the war file to Tomcat? If so why don't you deploy the exploded directory instead?

    Regarding other issues: 'Package file' action indeed doesn't check whether the file was changed or not. Also it doesn't perform the maven resource
    filtering because it's simple file copying.

    Thanks for that reply. So, to clarify something from our point of view too - this all worked in Intellij 9, and it's only since we upgraded to 10.5.x that we've had these problems.

    >

    But this is the point, I don't want the WAR archive to be changed. Upon packaging I want e.g. a Spring Application Context file to go through e.g. the maven filter resource phase and then be copied to the output dir (monitored by Jrebel), but not then to the WAR.

    >

    And herein lies the bug with 10.5.x - packaging a file results it being copied to the WAR, irrespective of whether the webapp is being run as war or war-exploded (FYI this change in the WAR occurs even if a file hasn't changed and it is not copied to the output dir). In IDEA 9 it wasn't copying to the WAR when being run either as war or war-exploded. This is how 10.5.x should behave.

    >

    Can you fix this as a matter of urgency please?

    >

    Thanks

    >

    Jonny

    >

    ---
    Original message URL: http://devnet.jetbrains.net/message/5308574#5308574



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

    0
    Avatar
    Permanently deleted user

    Hmm, the behaviour of 'Package File' action wasn't changed in IDEA 10. I've just checked it in IDEA 9.0.4: if you have both exploded and war artifacts
    configured 'Package File' action copies file to the both artifacts.

    Do I understand correctly that you deploy the war file to Tomcat? If so why don't you deploy the exploded directory instead?



    It copies it to the WAR even if we've only deployed the exploded directory. This is the problem.

    We have been deploying the exploded directory to Tomcat (but I have been playing around with changing that because we are looking at using JRebel which doesn't require this).

    WRT the Maven Filtering, if it isn't packaging that does this, what process is causing this to occur if you edit a file in a maven configured resources dir?

    0
    Avatar
    Permanently deleted user

    If you deploy the exploded directory why worry about changes in the WAR? It should not affect your running app.

    The Maven filtering can be performed when you run the full project compilation (Build | Make/Compile actions) or the corresponding Maven goal.


      It copies it to the WAR even if we've only deployed the exploded directory. This is the problem.

      We have been deploying the exploded directory to Tomcat (but I have been playing around with changing that because we are looking at using JRebel
    which doesn't require this).

      WRT the Maven Filtering, if it isn't packaging that does this, what process is causing this to occur if you edit a file in a maven configured
    resources dir?


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

    0
    Avatar
    Permanently deleted user

    If you deploy the exploded directory why worry about changes in the WAR? 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?

    Jonny

    0

    请先登录再写评论。