tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pid <...@pidster.com>
Subject Re: MVC or Model2 with Tomcat
Date Tue, 06 Dec 2011 20:21:40 GMT
On 06/12/2011 17:49, Blaxton wrote:
>=20
>=20
>=20
>=20
> ________________________________
>  From: Pid * <pid@pidster.com>
> To: Tomcat Users List <users@tomcat.apache.org>=20
> Sent: Tuesday, December 6, 2011 8:12:40 PM
> Subject: Re: MVC or Model2 with Tomcat
> =20
> <snip>
>=20
> On 6 Dec 2011, at 15:52, Blaxton <blaxxton@yahoo.com> wrote:
>>
>> I have added the host directive to server.xml and moved appexmp1 conte=
nts to ROOT directory
>> and now I can access www.mydomain.com/index.jsp with no problem,
>> however now the servlets are not working.
>> I can access jsp files, but no servlets, I get "The requested resource=
 is not available" message.
>>
>> as with following direction:
>> http://tomcat.apache.org/tomcat-6.0-doc/virtual-hosting-howto.html#con=
text.xml_-_approach__1
>>
>> I have created /Catalina_BASE/appexmp1/ROOT/META-INF/context.xml
>=20
> Ok, please remove the comments from your server.xml and post it inline,=
 here.
>=20
>=20
>> I have placed a HelloWorld.class file in /Catalina_BASE/appname/ROOT/W=
EB-INF/classes/com/mydomain
>> but can't access the class through mydomain.com/app1/HelloWorld
>=20
> How have you defined the Servlet in ROOT/WEB-INF/web.xml?
>=20
>=20
>> tried following context file variations but didn't work:
>>
>> <Context path=3D"/app1" docBase=3D"." debug=3D"0" reloadable=3D"true" =
crossContext=3D"true">
>> </Context>
>=20
> Never do the above.
>=20
>=20
>> <Context path=3D"/app1" docBase=3D"ROOT" debug=3D"0" reloadable=3D"tru=
e" crossContext=3D"true">
>> </Context>
>=20
> Or that.
>=20
> The 'path' attribute is not applicable here - in any case it's wrong.
>=20
> Remove the path and docBase attributes from the ROOT.xml file.
>=20
>=20
> p
>=20
>> it seems to me , context file is not being read after adding the host =
directive to server.xml
>> either when it is in /Catalina_BASE/conf/Catalina/local host or now th=
at it is in
>> /Catalina_BASE/appexmp1/ROOT/META-INF/context.xml
>>
>> thanks for help
>=20
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>=20
>=20
> OK, my mistake, I had JkMount /*.jsp and /app1/* rather than JkMount /*=
 in httpd-vhost.com
> changed it as you mentioned to JkMount /* and servlets works now.
>=20
> Also removed path and docbase from context.xml
> so we can't have default application in ROOT and path in context file ?=


The path attribute isn't valid, except if the Context is defined inline
in server.xml which is *strongly discouraged*.

Using the special name 'ROOT' is required, because normally the .war
file name, the context file in conf/Catalina/hostname/<name>.xml or
exploded directory name is used to provide the path exposed in the HTTP U=
RL.

The default application would therefore have an empty filename, which
isn't such a good thing - so 'ROOT' is used instead.


> haven't tried it , but I think we could achieve the same thing with JkA=
utoAlias
> which one is recommended ? JkAutoAlias or adding host directive in serv=
er.xml ?

I don't think that they're comparable.


p


> Thank you very much for help
> I achieved what i was looking for.


--=20

[key:62590808]


Mime
View raw message