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 Fri, 09 Dec 2011 13:23:44 GMT
On 08/12/2011 10:51, Blaxton wrote:

>> <snip>
>>
>> On 6 Dec 2011, at 15:52, Blaxton <blaxxton@yahoo.com> wrote:
>>>
>>> I have added the host directive to
>> server.xml and moved appexmp1 contents 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#context.xml_-_approach__1
>>>
>>> I have created /Catalina_BASE/appexmp1/ROOT/META-INF/context.xml
>>
>> Ok, please remove the comments from your server.xml and post it inline, here.
>>
>>
>>> I have placed a HelloWorld.class file in /Catalina_BASE/appname/ROOT/WEB-INF/classes/com/mydomain
>>> but can't access the class through mydomain.com/app1/HelloWorld
>>
>> How have you defined the Servlet in
>> ROOT/WEB-INF/web.xml?
>>
>>
>>> tried following context file variations but didn't work:
>>>
>>> <Context path="/app1" docBase="." debug="0" reloadable="true" crossContext="true">
>>> </Context>
>>
>> Never do the above.
>>
>>
>>> <Context path="/app1" docBase="ROOT" debug="0" reloadable="true" crossContext="true">
>>> </Context>
>>
>> Or that.
>>
>> The 'path' attribute is not applicable here - in any case it's wrong.
>>
>> Remove the path and docBase attributes from the ROOT.xml file.
>>
>>
>> p
>>
>>> 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 that it is
in
>>> /Catalina_BASE/appexmp1/ROOT/META-INF/context.xml
>>>
>>> thanks for help
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>> 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.
>>
>> Also removed path and docbase from context.xml
>> so we can't have default application in ROOT and path in context file ?
>>
>> haven't tried it , but I think we could achieve the same thing with JkAutoAlias
>> which one is recommended ? JkAutoAlias or adding host directive in server.xml ?
>>
>> Thank you very much for help
>> I achieved what i was looking for.
>>
>>
>>
>> --------------------------------------------------------------------------------------------------------------------------------
>>
>> Sorry but there is one more problem.
>>
>> now that I have JkMount /* in vhost1_httpd.conf
>> every thing will be forwarded to tomcat other than *.html because there is
>> a JkUnMount /*.html line in vhost1_httpd.conf but still when I browse
>> mydomain.com/ I get the tomcat error
>> "The requested resource() is not available".
>> why is that ?
> 
> Some mod_jk config voodoo is bubbling up into my memory.
> 
> I can't see it in the docs, but try:
> 
> JKMount /|* worker
> 
> Which version of mod_jk are you using?
> 
> 
>> I have added welcome directive to web.xml as follow:
>> <welcome-file-list>
>> <welcome-file>index.html</welcome-file>
>> </welcome-file-list>
> 
> This tells Tomcat to look for index.html in its own resource location.
> Is it there or are you expecting HTTPD to do that for you?
> 
> I think you probably want to put index.jsp instead.
> 
> 
>> and following is DirectoryIndex in vhost1_httpd.conf file:
>> DirectoryIndex index.jsp index.html index.php
> 
> 
> 
>> I can access mydomain.com/index.html
>> but getting error when accessing mydomain.com/
> 
> Check the access logs to see which server is sending the file.
> 
> 
> p
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> Ok, thanks
> 
> I have added 
> JkUnMount /  appexmp1worker

Eh?

> and with following directive:
> DirectoryIndex  index.html 
> 
> I can access mydomain.com/ and the default index.html will be displayed.

Yes, I'd expect that.


> however, with 
> DirectoryIndex  index.jsp
> 
> because of JkMount  /* 
> 
> all requests , including .jsp files would be forwarded to tomcat and
> I should place index.jsp file where we defined the appbase.

Is that a question?


NB  Do not put any files straight in appBase.  Only put files inside a
appBase/ROOT or whatever applications directories are there.


If you want Tomcat to find & serve index.jsp for a '/' request, then you
need:

 <welcome-file-list>
   <welcome-file>index.jsp</welcome-file>
 </welcome-file-list>

If you have index.html and Servlets, either Tomcat can serve the HTML,
or HTTPD.  In the latter case you'll need to ensure that requests for /
and /index.html are not forwarded to Tomcat.


Can we revisit what you are trying to achieve here?


p



-- 

[key:62590808]


Mime
View raw message