tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marco de Booij <marco.develo...@debooy.eu>
Subject Re: Application name
Date Mon, 06 Aug 2012 09:42:16 GMT
Op 05-08-12 23:54, Mark Eggers schreef:
> On 8/5/2012 2:09 PM, Konstantin Kolinko wrote:
>> 2012/8/6 Marco de Booij <marco.developer@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 /myapp worker1
>>>      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.
>>
I read it but it was not really clear to me. Must be because I am not 
really familiar with the way that Tomcat is configured. I just switched 
from Glassfish to Tomee and I just tried to find the way to define in my 
war file the name that I want the user to use in the URL. Glassfish let 
you enter this at deployment time and WebLogic has a context-root tag in 
the weblogic.xml or application.xml file.
It is true that the path value is incorrect. Somehow the // was inserted 
after copy paste and I did not see it :-( same goes for the 2 last 
JkMount lines. They should be similar to the first 2 :-( I changed it in 
this mail.
>>
>>> 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/
>
Thanks for the explanation. It looks very complicated to me. If someone 
wants to deploy your application he/she needs to do the same. I think 
that I will go for the rename of the war file. I will try to use the 
##version in the name to keep track of the version number.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


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


Mime
View raw message