Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why is it deploying in two contexts? I'm stumped

 
Claude Forkner
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all. I've been racking my brain on this for a good day and wanted to get some help. I have a tomcat 5.0.28 installation. I used the manager app to install my application. My application has a context.xml file. Here is what the context tag looks like inside of that:

<Context path="/software/data/myportal" docbase="portal">

It installed correctly through the manager app.

I then shutdown tomcat and restarted it. Now when I open the manager app, I see that there are two context entries listed: one for "/software/data/myportal" AND one for "portal".

Let me give some other useful info: the war file I uploaded is named portal.war. When it gets unpacked by tomcat, it creates a directory called webapps/portal

In server.xml I have autoloading off. Here is what that looks like:
<Host name="localhost" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="false" xmlValidation="false" xmlNamespaceAware="false"/>

Can someone help me figure out how to get it so it doesn't deploy two context's for the same app? I'd really appreciate it!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64843
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suspect Tomcat is creating one instance of the app triggered by your context definition, and another by default because of the presence of the war file in webapps.

But Ben is the expert on these matters...
 
Claude Forkner
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. I also want to mention that for a test I deleted portal.jar from the webapps folder, thereby just leaving the unpacked portal folder inside of webapps. I then stopped and started tomcat and it still deployed two context's.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear's got it.
If you shut off autoDeploy in the host entry in server.xml It won't do this.
http://tomcat.apache.org/tomcat-5.0-doc/config/host.html
 
Claude Forkner
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my first post I showed the entry I'm using for host. It looks like I have autodeploy shutoff, yet it is still doing this.... There's got to be something crazy I'm missing....
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, didn't notice that.

Have you tried without the docBase attribute in your Context file?
 
Claude Forkner
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. When I take out the docbase, it actually has a problem starting up the "/software/data/myportal" context, but starts the /portal context ok. When I change the docBase back to docBase="portal", it works again.
 
Claude Forkner
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I may have an uneducated guess here. When tomcat starts up it probably first checks to see what's in the webapps folder. It probably sees the "portal" folder unpacked there and deploys that under the context "/portal". THEN it probably sees that there is a portal.xml file in the conf/catalina/localhost folder and it does what that says - deploy into context "/software/data/myportal" with the docbase in /webapps/portal. So it effectively deploys the same app twice into two different contexts'. This is just what appears to be happening.

I bet if the app in the webapps folder was named "/software/data/myportal" (which obviously isn't a valid name for a folder), that it maybe would only deploy one time? Another thing that might help this is to completely move the portal app out of the webapps directory. Maybe that would work.

I still want to know if it's possible to configure this the way I have it without two context being created.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic