On 8/5/2012 2:09 PM, Konstantin Kolinko wrote:
2012/8/6 Marco de Booij <marco.develo...@debooy.eu>:
Hello,

I have tried to find the answer but I could not find a (to me) clear answer.

I build my applications with Maven and as a result my war file is like
myapp-web-1.2.3.war. The static content is delivered by the Apache Web
Server so I use this server to access the application deployed in Tomcat
7.0.27:
/    JkMount /myapp-web-0.1.0-SNAPSHOT     worker1
     JkMount /myapp-web-0.1.0-SNAPSHOT/* worker1
     JkMount /myappworker1
     JkMount /myapp///* worker1/

I want to use the myapp since this will remain the same even if the version
changes.  In the war file I have a context.xml file in the META-INF at
'root' level (not in the one in the classes directory) with the content:
/<?xml version="1.0" encoding="UTF-8"?>
<Context path="/myapp//" />/

The path attribute is invalid in a context.xml file.

Read the "Context" chapter in the Configuration Reference in Tomcat
7.0 documentation.


The application works fine if I use
http://localhost/myapp-web-0.1.0-SNAPSHOT but when I use
http://localhost/myapp I only get the welcome page and when I try to get
another page then I get an error message:
/javax.naming.NameNotFoundException: Name [app/AppName] is not bound in this
Context. Unable to find [app]./

In the manager application of Tomcat I see both names in the application
list.

I was able to use this in Glassfish. There I could define a application name
in the console when I deployed the application. Is it also possible with
Tomcat or do I need to rename the war file to myapp.war before I deploy the
application?

The recommended way is to rename the war.

Note, I've not tried this but from the documentation it should work.

1. Create another directory at the same level as webapps - call it apps
2. Copy your appname-1.2.3-SNAPSHOT.war there
3. Create an appname.xml file and place it in conf/Catalina/[hostname]

<Context docBase="${catalina.base}/apps/appname-1.2.3-SNAPSHOT.war"/>

(At least I think ${catalina.base} will be interpolated)

It is important to note that the war file (and docBase) CANNOT be inside the enclosing host's appBase (as defined in server.xml). Thus, you cannot point this inside of $CATALINA_BASE/webapps - the default location of appBase.

See the following for more detail:

http://tomcat.apache.org/tomcat-7.0-doc/config/context.html

On second thought, just rename the war file.

. . . . just my two cents.
/mde/


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to