Re: [Newbie] Failed access to servlet via URL mapping (context setting problem?)

2005-01-16 Thread Parsons Technical Services
I notice you are using 1.4.2  Does the compat install mean you set it up to 
use 1.4 in place of the 1.5 per RUNNING.txt?

Doug
- Original Message - 
From: "Geoffrey Charters" <[EMAIL PROTECTED]>
To: 
Sent: Saturday, January 15, 2005 11:47 PM
Subject: [Newbie] Failed access to servlet via URL mapping (context setting 
problem?)


Mac OSX 10.3.7; Tomcat 5.5.4; JDK 1.4.2; compat installed
I have installed Tomcat 5.5.4 with a view to using it to implement a 
web-based interface to a MySQL database.

I began by following the guidelines here: 
http://developer.apple.com/internet/java/tomcat1.html, but as these 
related to V4 of tomcat, this has served to trip me up a little.  I could 
not get any of the example servlets to function by following the 
directions given.

I subsequently found further guidelines here: 
http://www.coreservlets.com/Apache-Tomcat-Tutorial/, I have got to the 
point where I can run all of the sample servlets described there.  These 
involve directly copying resources into the 
$CATALINA_HOME/webapps/ROOT/WEB-INF(/classes) directories.

I could now develop my application and copy it to the ROOT directory and 
access it through a URL like localhost:8080/hi, but this seems like poor 
structure to me.  I could also place the app in a subdirectory and access 
it with localhost:8080/hi/servlet/hi, but that is not too tidy.

What I would like to do, and what I think is possible, is somehow to 
advise tomcat of the location of my webapp in its own directory (not under 
ROOT) and access it with localhost:8080/hi.

No amount of tweaking servlet mappings and URL patterns has worked, and I 
suspect that somewhere I need to have a  element.  (I admit to 
confusion over the apparent need to specify the path both in the context 
and the servlet mapping, so I've missed a big point somewhere). The 
nearest I have got is to obtain an empty  "Directory listing for /" page 
in response to my http://localhost:8080/hi request.  I enabled request 
logging and obtained the following:
Created MBeanServer with ID: c3e82b:10179d228c6:-8000:XarqiMac.local:1
Jan 16, 2005 5:40:16 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Jan 16, 2005 5:40:16 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 4706 ms
Jan 16, 2005 5:40:17 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jan 16, 2005 5:40:17 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.4
Jan 16, 2005 5:40:17 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Jan 16, 2005 5:40:22 PM org.apache.catalina.core.ApplicationContext log
INFO: org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: 
[org.apache.webapp.balancer.RuleChain: 
[org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News 
/ Redirect URL: http://www.cnn.com], 
[org.apache.webapp.balancer.rules.RequestParameterRule: Target param 
name: paramName / Target param value: paramValue / Redirect URL: 
http://www.yahoo.com], 
[org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: 
http://jakarta.apache.org]]
Jan 16, 2005 5:40:23 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Jan 16, 2005 5:40:23 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Jan 16, 2005 5:40:24 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Jan 16, 2005 5:40:24 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Jan 16, 2005 5:40:25 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Jan 16, 2005 5:40:27 PM org.apache.jk.common.ChannelSocket init
INFO: JK2: ajp13 listening on /0.0.0.0:8009
Jan 16, 2005 5:40:27 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/77  config=null
Jan 16, 2005 5:40:27 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 10702 ms
Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve 
invoke
INFO: REQUEST URI   =/hi/
Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve 
invoke
INFO:   authType=null
Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve 
invoke
INFO:  characterEncoding=null
Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve 
invoke
INFO:  contentLength=-1
Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve 
invoke
INFO:contentType=null
Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve 
invoke
INFO:contextPath=/hi
Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve 
invoke
INFO: cookie=JSESSIONID=A1159716478A6F61B9760CCB58402392
Jan 16, 2005 5:40:28 PM org.apache.catalina.valves.RequestDumperValve 
invoke
INFO: header=host=localhost:8080
J

Re: [Newbie] Failed access to servlet via URL mapping (context setting problem?)

2005-01-16 Thread Geoffrey Charters
Doug wrote:
I notice you are using 1.4.2 Does the compat install mean you set it 
up to use 1.4 in place of the 1.5 per RUNNING.txt?
I didn't do any setting up, other than to install the compatibility 
patch as directed.  It is my understanding that this acts as a bridge 
between the "new" V5.5 tomcat architecture, and the old 1.4 JDK.  From 
the success of the trial servlets, the installation seems to be 
working, and I just suspect that I have failed to configure something 
properly.

Thanks for responding.
(BTW, I didn't actually receive your response via email, but discovered 
it in an archive.  I'm getting notification of other postings to the 
list, but not this one.  Weird.


Re: [Newbie] Failed access to servlet via URL mapping (context setting problem?)

2005-01-16 Thread Parsons Technical Services

I didn't do any setting up, other than to install the compatibility
patch as directed.  It is my understanding that this acts as a bridge
between the "new" V5.5 tomcat architecture, and the old 1.4 JDK.  From
the success of the trial servlets, the installation seems to be
working, and I just suspect that I have failed to configure something
properly.

Ok. Just wanted to be sure as this has been the issue on several posts 
lately.

Now for your problem. There are two (or more) ways that you can deploy an 
application. One is by manual file and folder creation and the other is by 
WAR files. Either way there is a directory structure that needs to be 
followed.

From a recent post:
Quote"
Hi,
I think it would be good practice to require your developers to create
war file for you.
http://java.sun.com/blueprints/guidelines/designing_enterprise_applications_2e/technologies/technologies3.html#1043856
Anyway, there is some links that might be useful
http://java.sun.com/j2se/1.4.2/docs/tooldocs/tools.html#basic
look jar-tool, war file is same format that war file.
I think you should read also servlet spefication specks
http://jcp.org/aboutJava/communityprocess/final/jsr154/index.html
And maybe it would be worth of use tools like ant
http://ant.apache.org/
- Jukka -
" Unquote
This should get you the information on the structure you need to set up. 
From there you need to create a context.xml file that will solve your 
problem. In 5.5 you do not use the path field unless you put the context in 
the server.xml.

http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/context.html
gives you several locations to place the context files. If you are not using 
WAR files, then use the "appname".xml

per the above page place it in the 
$CATALINA_HOME/conf/[enginename]/[hostname]/ directory
The path is then taken from the name of the xml file.
OR
context.xml and place it in /META-INF/context.xml inside the application 
files  and the path will be based on the docBase.

If you look there now you will find some files for the built in apps (I 
think) I do not run 5.5 but 5.0 and there are some changes as to what was 
included.

Unless you want it to be the default app, that's in last weeks archives.
Doug 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: [Newbie] Failed access to servlet via URL mapping (context setting problem?)

2005-01-17 Thread Geoffrey Charters
Still no success.
This is what I have:
$CATALINA_HOME/webapps/hi/WEB-INF/classes/hi.class
$CATALINA_HOME/webapps/hi/WEB-INF/web.xml

http://java.sun.com/xml/ns/j2ee";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee  
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";
version="2.4">

Hello, World Application

This is a simple web application with a source code organization
based on the recommendations of the Application Developer's  
Guide.



HelloServlet
hi


HelloServlet
/h*


$CATALINA_HOME/webapps/hi/META-INF/context.xml



I've also tried it with the context.xml file renamed as hi.xml and  
placed in $CATALINA_HOME/conf/Catalina/localhost.

When I use http://localhost:8080/hi, I get a tomcat generated page with  
a blank directory for "/".

On Jan 17, 2005, at 6:35 PM, Parsons Technical Services wrote:

I didn't do any setting up, other than to install the compatibility
patch as directed.  It is my understanding that this acts as a bridge
between the "new" V5.5 tomcat architecture, and the old 1.4 JDK.  From
the success of the trial servlets, the installation seems to be
working, and I just suspect that I have failed to configure something
properly.

Ok. Just wanted to be sure as this has been the issue on several posts  
lately.

Now for your problem. There are two (or more) ways that you can deploy  
an application. One is by manual file and folder creation and the  
other is by WAR files. Either way there is a directory structure that  
needs to be followed.

From a recent post:
Quote"
Hi,
I think it would be good practice to require your developers to create
war file for you.
http://java.sun.com/blueprints/guidelines/ 
designing_enterprise_applications_2e/technologies/ 
technologies3.html#1043856

Anyway, there is some links that might be useful
http://java.sun.com/j2se/1.4.2/docs/tooldocs/tools.html#basic
look jar-tool, war file is same format that war file.
I think you should read also servlet spefication specks
http://jcp.org/aboutJava/communityprocess/final/jsr154/index.html
And maybe it would be worth of use tools like ant
http://ant.apache.org/
- Jukka -
" Unquote
This should get you the information on the structure you need to set  
up. From there you need to create a context.xml file that will solve  
your problem. In 5.5 you do not use the path field unless you put the  
context in the server.xml.

http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/context.html
gives you several locations to place the context files. If you are not  
using WAR files, then use the "appname".xml

per the above page place it in the  
$CATALINA_HOME/conf/[enginename]/[hostname]/ directory
The path is then taken from the name of the xml file.
OR
context.xml and place it in /META-INF/context.xml inside the  
application files  and the path will be based on the docBase.

If you look there now you will find some files for the built in apps  
(I think) I do not run 5.5 but 5.0 and there are some changes as to  
what was included.

Unless you want it to be the default app, that's in last weeks  
archives.

Doug
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]