Deploying and running multiple WARs on the same instance of Tomcat

Answered

I want to deploy and run multiple WARs on the same instance of Tomcat so that they communicate to each other. It seems that I can select only 1 facet to deploy with 1 run configuration.
Is there a way around? I am on Intellij 8.X and my project is Maven based.
Please enlighten.
Vlad

27 comments
Comment actions Permalink

The above solution appears more like a workaround than anything else...

 

This feature was quite easy in Eclipse... For all its benefits IntelliJ seems to lack in this area...

 

In Eclipse, I can add two Web Apps (or any combination of apps web or ear etc) to be deployed to different or same servers locally and debug them comfortably...

 

In IntelliJ I am NOT able to do this... Also, IntelliJ seems not to connect to an existing running Jboss or Tomcat for that matter... It says could not connect to port 1099...

 

Can't believe IntelliJ misses this VERY IMPORTANT feature...

 

Or correct me if this is doable...

1
Comment actions Permalink

I have the same issue. I simply want to switch to another project and run (deploy) it which currently fails due to Intellij is unable to deploy to the currently running instance of Tomcat, like Netbeans and Eclipse can easily do.
My temporary solution for this issue is: I set different ports for each run configuration, but i buy this now for other issues with some port forwarding rules which i use for testing with external devices...

I can't belive that this issue is not solved somehow in 10 years...

1
Comment actions Permalink

Try starting Tomcat VM with the following options:

  -Dcom.sun.management.jmxremote.ssl=false
  -Dcom.sun.management.jmxremote.authenticate=false
1
Comment actions Permalink

What is the problem to select several facets at "Deployment" tab of Tomcat run configuration?

I want to deploy and run multiple WARs on the same instance of Tomcat so that they communicate to each other. It seems that I can select only 1 facet to deploy with 1 run configuration.
Is there a way around? I am on Intellij 8.X and my project is Maven based.
Please enlighten.
Vlad

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



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

0
Comment actions Permalink

The Applications are not in the same project

0
Comment actions Permalink

Why it is not possible to connect to already running server in intellij to make a deploy? 

There is solution for Glassfish > Remote configuration biut for some reason it is not working sucessfully and always ends up with error. However deployments run by command line and by configuration console always work correct.

0
Comment actions Permalink

There is Application Servers tool window which you can use to manage the servers (start/stop/restart) and existing artifacts in project (deploy/un-deploy/update).

0
Comment actions Permalink

Yes, but I need to deploy artifacts which are not in current project or in other words deploy few different microserives from different projects to one server. And I want one server to avoid multiple server instances which would only waste resources when running simultanously on developer machines. So it is not solving the problem in any way.

0
Comment actions Permalink

You can combine those projects under the same IDE project and deploy all applications(artifacts) to one server.

0
Comment actions Permalink

Thats still only a workaround not a solution. Why do I need x-ty open projects, if I just need to deploy some of them? First it will cause many false positives when looking for files, usages, classes and many many other problems not to mention much longer build times and analysis efforts.

0
Comment actions Permalink

You can create Scopes for each project with it's own color to more easily distinguish files. Scopes can be used when searching for usages and in code analysis as well. Also each module (or several selected modules) can be built independently.

0
Comment actions Permalink

But it is still only workaround for lack of basic functionality, is it? Why do I need check them out at all if I can possibly just need an artifact from e.g. nexus?

0
Comment actions Permalink

In deployment tab you can select any external source as an artifact to deploy to an application server, no need to specifically add a module. If however this is an artifact produced by IDE you should add the corresponding module where you are developing this application.

0
Comment actions Permalink

@Michael Fritzsche there is no issue: it is possible to deploy multiply application on the same Tomcat instance from one IntelliJ IDEA project. If you deploy from a separate project (separate window) - you then use different Run/Debug Configuration. It is expected that it will fain if you use the same ports - since in this case IDE launches new Tomcat instance - and it will fail when tries to bind to the ports that are already occupied by Tomcat instance you started in another project. So in this case you should change the ports.

Again if however you deploy it from the same project using the same run configuration - IDE deploys multiply application under the same Tomcat instance.

0
Comment actions Permalink

I completely agree with the complaints here and disagree with @Andrey. On a regular Tomcat one can deploy multiple war's with ease, not sure why IDEA can't do it even without the debugger etc.

0
Comment actions Permalink

You can do the same in IntelliJ IDEA using Tomcat Remote configuration when the server is already started externally. That is how you do it on a regular Tomcat.

When Tomcat is started from IntelliJ IDEA, you can also deploy multiple wars within the same project. One project can contain multiple modules producing different war files.

0
Comment actions Permalink

@Serge can you expound on that? I tried that but it wasn't successful. IDEA throws an exception that it needs credentials. But I can't find where to supply credentials in IDEA.

0
Comment actions Permalink

You are using Local Tomcat configuration and IntelliJ IDEA tries to run Tomcat again which is not possible.

Note that multiple wars can be added in the single run/debug configuration. Once you start it, IntelliJ IDEA will run Tomcat and deploy all the configured wars.

If you plan to deploy on the already running Tomcat instance, only Remote Tomcat configuration will work.

0
Comment actions Permalink

@Serge Here's exactly what I did:

I clicked Remote. Then the following pops up and here's what I configured it with:

If this is still Local Tomcat, what am I missing?

0
Comment actions Permalink

Double check you run this exact configuration and not the local one.

0
Comment actions Permalink

@Serge the screenshot was from my double check. I went through all steps again while a coworker was watching me do it.

0
Comment actions Permalink

The screenshot doesn't show how you start it. The drop-down on the left of the Run button may have a different configuration selected or you may have another Local configuration specified in the Before launch section.

0
Comment actions Permalink

Even the error confirms that's what I ran.

0
Comment actions Permalink

@Serge that's it! Lol why didn't you start off with that? :P Thank you so much, it's working now.

0
Comment actions Permalink

> why didn't you start off with that?

I was confused by the first screenshot which said "already running" while it was the name of your run/debug configuration.

0
Comment actions Permalink

Ah gotcha, yeah it was the first time configuring that so I wasn't sure what to name it, sorry about the confusion. I appreciate the help very much though!

0
Comment actions Permalink

Just in case this helps anybody else with this problem:

If you are using Ultimate, you can create a "Local Tomcat" run configuration in Project1,  and go to the "Deployment" tab and drop in the WAR file for your Project1.   Then drop in the WAR file from your other project (call it Project2) as an External Source.   You would then have both WARs in one run configuration.

-1

Please sign in to leave a comment.