• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

when configure tomcat new Context tomcat creates me 2 web apps

 
Ranch Hand
Posts: 620
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
in my tomcat i need to create url to access that is different from my web app name so according to the web info i found , in server.xml in tomcat i added :



where MyAppGW is the directory of my web app then in MyAppGW web.xml i added :


so when i give to external client the url http://xx.xx.xx.xx:8888/console/ws/WsEndpoint it connects to my web app. every thing is working fine and great except that when i look in my tomcat webapps i see 2 directors is this normal ?:
MyAppGW
console

the console is the same as the MyAppGW. i suspect this give me problems with other frameworks in my web app like log4j not Rolling and creating duplication of log files .
 
Saloon Keeper
Posts: 27808
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think what you mean is that you have a console.war file and a console directory in TOMCAT_HOME/webapps. This is normal.

Under Tomcat's default settings, if you deploy a war file into TOMCAT_HOME/webapps, Tomcat will unpack (explode) it, creating a directory with the same basename as the war file.

The actual executing copy of the app will be the exploded WAR.

It's important to know this, because Tomcat will not automatically update the exploded WAR if you update the war file. Instead, it will continue to use the old, out-of-date code in the exploded WAR.

So when deploying a war file, you should delete the old exploded copy.
 
ben josh
Ranch Hand
Posts: 620
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Thanks for the replay , but no . my war is MyAppGW.war .
it creates me and i dont know why another directory called "console"
i dont have any console.war .
and i dont know why could be because i configured in the server.xml
 
Tim Holloway
Saloon Keeper
Posts: 27808
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't put webapp Contexts in server.xml. That's been considered bad practice since Tomcat V4 or earlier. Put them as individual XML files in TOMCAT_HOME/catalina/localhost or in the WAR in META-INF/context.xml.

However, the process I described still applies. Tomcat is simply exploding the WAR under its context pathname instead of using the WAR basename.
 
ben josh
Ranch Hand
Posts: 620
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you please tell me how should this configuration look like , in for example i want to create file under : META-INF/context.xml?
just simple create context.xml file and put this: init :
<Context docBase="MyAppGW" path="/console" reloadable="true" /> ?
 
ben josh
Ranch Hand
Posts: 620
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
i did what you say and created the file under META-INF/context.xml
looks like this :

when tomcat starts it creates me the dirctory under conf\Catalina\localhost\
called : MyAppGW.xml with the context.xml content.
the problem is when i try to invoke the method to the old url , it failed and gives me :

 
Tim Holloway
Saloon Keeper
Posts: 27808
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tomcat doesn't do exactly what I want/expect as far as context names go when using a context xml file.

In fact, it ignores the name given in the context xml file when that file is placed in the TOMCAT_HOME/conf/Catalina/localhost/ directory and deploys using the name of the context file itself.
 
ben josh
Ranch Hand
Posts: 620
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
in simple words if i like to serve in this url : http://xx.xx.xx.xx:8888/console/ws/WsEndpoint
and my webapp called MyAppGW what shell i do ?
 
Tim Holloway
Saloon Keeper
Posts: 27808
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Meir Yan wrote:in simple words if i like to serve in this url : http://xx.xx.xx.xx:8888/console/ws/WsEndpoint
and my webapp called MyAppGW what shell i do ?



If you're using a META-INF/context.xml, rename the WAR to console.war. If you use your own Context xml file in TOMCAT_HOME/conf/Catalina/localhost, name it console.xml.
 
ben josh
Ranch Hand
Posts: 620
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for the fast reply
so if i can't rename the main war file, i just need to rename the context.xml to console.xml
great i will try it
 
That which doesn't kill us makes us stronger. I think a piece of pie wouldn't kill me. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic