Run app in Tomcat - includes two copies of JAR file?

I recently purchased the "ultimate edition" of Intellij and have been trying to use the "Tomcat Server" option to deploy and run my Java project in my local installation of Tomcat 6.0.32.  My IntelliJ project looks like this:

--->MyAppDomain (builds a JAR)
--->MyAppWAR (builds a WAR incorporating the above JAR)

The problem I am running into is this.  When I build my WAR using Maven, and drop it into the /webapps directory manually, it works.   When I deploy with Intellij, I get this (stack trace abbreviated for brevity):

Conflicting persistence unit definitions for name 'caPersistenceUnit':

The build process is including TWO COPIES of the MyAppDomain.JAR file, the one built from Maven (wanted) and another one that it's building on its own (unwanted).    I don't even know where to begin to look to fix this.   Anyone familiar with the "Run Tomcat" run task, can you chime in on this?

Comment actions Permalink

Go to your run/debug config -> tomcat server -> whatever your tomcat task is called -> deployment tab (on the right)

What does it say for deploy at the server startup? I can imagine it might have both artifacts listed here.

Also what does it say under Before Launch : Another Configuration (same page, lower down on the right)?

Comment actions Permalink

On the "Deployment" tab, I only have the one artifact listed under "Deploy at the server startup."    I did previously have more than one, but I removed the others.

Under "Before Launch" I did have two items:

  1. Make
  2. Build Artifact: MyAppWar:war

I tried removing this and replaced it with a call to my Maven build:  "Myapp [clean, install]"  which builds the correct WAR.

The job now works!   I'm still puzzled as to why "Make" didn't work correctly, but I'll take the win and move forward as I need to move forward.

Thank you for pointing me in the right direction!

Please sign in to leave a comment.