A couple of web application deployment questions.
Hi,
1. Is there a way to deploy a web application artifact to a Tomcat server after the server has been started?
2. Is there a way to control the order in which web application artifacts deployed to a Tomcat server are started? I have two web applications, A and B, and A needs to communicate with B. When Tomcat starts up, A is deployed before B, causing it to hang.
Thanks,
Emerson
Please sign in to leave a comment.
Hi, Emerson.
1) this is strange for me. i always try to avoid start tomcat externally because it's more convenient to start it from within idea.
2) you can't control startup order with deployment order, because for every artifact startup time is different.
Regarding the cause of the question (hanging application b) - i think its'a bad design. I hope you're not doing nuclear station software. In your case it's better to have a dedicated tomcat instance for each artifact and start/deploy them separately with indpendent run configurations.
regards, Alex
Hi Alex,
Regarding
I didn't say I was starting Tomcat externally. My question was how to hot deploy artifacts (of projects open in IDEA) to a running Tomcat instance started within IDEA. In Eclipse, IIRC, you can deploy any web application in your workspace. In IntelliJ, the only way I've found to deploy an artifact to Tomcat is to specify it in the "Artifacts to deploy at startup" pane in a Tomcat Run Configuration. That's not a hot deploy.
Regarding
Tomcat deploys web application sequentially, not in parallel, so their startup time is irrelevant. My question was whether I can control the sequence in which the web applications are deployed because of my dependency.
As for the dependency between the WARs, that dependency will exist irrespective of whether I'm using one Tomcat instance or two, and the real solution there is to break the dependency. But for the time being, I'm trying to find out if IntelliJ is capable of doing proper hot deployment on a single Tomcat instance.
Thanks,
Emerson
Hi, Emerson
You have following options since idea 9:
for web content/jsp - Ctrl+Shift+P to package file, either cycled arrow to in the Run console.
for classes - start tomcat in debug mode, then invoke compile - idea should offer to reload changed classes
Sorry, can't help here. I think it's a tomcat related problem. i found http://tomcat.apache.org/tomcat-5.5-doc/deployer-howto.html - Exploded web applicationswill be deployed first, then war. you could try this. Also, you could check the order of deployment and check is it depends on the order they are declared in xml or appear in ui. when just to reporder them.
regards, Alex
Thanks for the responses Alex. I'll check if there are any reordering options in context.xml files, but I didn't see a way to do it from the Run Configuration pane.
It seems to me like proper hot deployment support is simply incomplete in IntelliJ, which is a bit surprising considering how well IntelliJ compares to other IDEs in so many common tasks. I think the Run view should have a button that allows you to deploy any (new) project to a running Tomcat instance. I'll post that as a feature request on the forums.
Regards,
Emerson
if you crated runconfiguration and check "Share config" checkbox, you should be able to find corresponding decriptor in .idea/runConfigurations/%config name%.xml. There will be reference to deployable artifacts:
Intellij utilizes standart HotSwap api provided by jdk (jvm should be started in debug mode), so inherits jdk constraints. You can try a newer jdk version, or one with better implemented hotswap. As i know, Eclipse also has constraints - you can't change number of method parameters, etc. That's why JRebel tool was developed.
it will be nice, but for me it's a very rare case which has a lot of workarounds.
regards, Alex