You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Robert Seeger <rs...@hvc.rr.com> on 2003/06/03 12:08:56 UTC
Issues with web.xml
I'm having issues with the web.xml file in my webapps/root/web-inf
directory. What I want to do is be able to specify each individual
servlet that can be run, by using <servlet> and <servlet-mapping> tags.
Unfortunately, the best I have been able to do is use a generic servlet
invoker to allow every servlet to be accessed. When I try to set things
up so that only one servlet can be accessed, there are errors showing up
in the dos box when I start Tomcat... which proceed to scroll of the
screen faster than I can look at them. They do not show up in any of the
logfiles in the logs directory. I was hoping someone could take a look
at the web.xml file I'm using and tell me if my error is an obvious one,
and how to fix it. I tried everything I could think of to make it work,
and checked all the documentation I could find.
I'm running Tomcat 4.1.24 on Windows 98.
Thank you in advance,
Robert Seeger
---------- Working web.xml, that allows all servlets in the directory to
be accessed ----------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Tomcat Examples</display-name>
<description>
Tomcat Example servlets and JSP pages.
</description>
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
</web-app>
--------------------
---------- Non-working web.xml that causes errors ----------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Tomcat Examples</display-name>
<description>
Tomcat Example servlets and JSP pages.
</description>
<servlet>
<servlet-name>HelloWorld</servlet-name>
<servlet-class>HelloWorld</servlet-class>
<description>
My test servlet
</description>
</servlet>
<servlet-mapping>
<servlet-name>HelloWorld</servlet-name>
<url-pattern>/HelloWorld</url-pattern>
</servlet-mapping>
</web-app>
--------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Issues with web.xml
Posted by Dominic Parry <do...@rucus.ru.ac.za>.
Hi Robert
I think I may know what your problem is. I remember reading that you web.xml has to be in a specific order:
in your
<servlet>
<servlet-name>HelloWorld</servlet-name>
<servlet-class>HelloWorld</servlet-class>
<description>
My test servlet
</description>
</servlet>
you need to swap the <description> and the <servlet-class> items around:
<servlet>
<servlet-name>HelloWorld</servlet-name>
<description>
My test servlet
</description>
<servlet-class>HelloWorld</servlet-class>
</servlet>
Here is the part I was talking about. It's from the application developers guide in the tomcat docs : tomcat-docs\appdev\deployment.html
NOTE - The Servlet Specification includes a Document Type Descriptor (DTD) for the web application deployment descriptor, and Tomcat 4 enforces the rules defined here when processing your application's /WEB-INF/web.xml file. In particular, you must enter your descriptor elements (such as <filter>, <servlet>, and <servlet-mapping> in the order defined by the DTD (see Section 13.3).
hope this helps.
Cheers
Dom
----- Original Message -----
From: Robert Seeger
To: tomcat-user@jakarta.apache.org
Sent: Tuesday, June 03, 2003 12:08 PM
Subject: Issues with web.xml
I'm having issues with the web.xml file in my webapps/root/web-inf
directory. What I want to do is be able to specify each individual
servlet that can be run, by using <servlet> and <servlet-mapping> tags.
Unfortunately, the best I have been able to do is use a generic servlet
invoker to allow every servlet to be accessed. When I try to set things
up so that only one servlet can be accessed, there are errors showing up
in the dos box when I start Tomcat... which proceed to scroll of the
screen faster than I can look at them. They do not show up in any of the
logfiles in the logs directory. I was hoping someone could take a look
at the web.xml file I'm using and tell me if my error is an obvious one,
and how to fix it. I tried everything I could think of to make it work,
and checked all the documentation I could find.
I'm running Tomcat 4.1.24 on Windows 98.
Thank you in advance,
Robert Seeger
---------- Working web.xml, that allows all servlets in the directory to
be accessed ----------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Tomcat Examples</display-name>
<description>
Tomcat Example servlets and JSP pages.
</description>
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
</web-app>
--------------------
---------- Non-working web.xml that causes errors ----------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Tomcat Examples</display-name>
<description>
Tomcat Example servlets and JSP pages.
</description>
<servlet>
<servlet-name>HelloWorld</servlet-name>
<servlet-class>HelloWorld</servlet-class>
<description>
My test servlet
</description>
</servlet>
<servlet-mapping>
<servlet-name>HelloWorld</servlet-name>
<url-pattern>/HelloWorld</url-pattern>
</servlet-mapping>
</web-app>
--------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Issues with web.xml
Posted by Dominic Parry <do...@rucus.ru.ac.za>.
Hi Robert
How are you running Tomcat? With Apache, or with PWS? or standalone?
----- Original Message -----
From: Robert Seeger
To: tomcat-user@jakarta.apache.org
Sent: Tuesday, June 03, 2003 12:08 PM
Subject: Issues with web.xml
I'm having issues with the web.xml file in my webapps/root/web-inf
directory. What I want to do is be able to specify each individual
servlet that can be run, by using <servlet> and <servlet-mapping> tags.
Unfortunately, the best I have been able to do is use a generic servlet
invoker to allow every servlet to be accessed. When I try to set things
up so that only one servlet can be accessed, there are errors showing up
in the dos box when I start Tomcat... which proceed to scroll of the
screen faster than I can look at them. They do not show up in any of the
logfiles in the logs directory. I was hoping someone could take a look
at the web.xml file I'm using and tell me if my error is an obvious one,
and how to fix it. I tried everything I could think of to make it work,
and checked all the documentation I could find.
I'm running Tomcat 4.1.24 on Windows 98.
Thank you in advance,
Robert Seeger
---------- Working web.xml, that allows all servlets in the directory to
be accessed ----------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Tomcat Examples</display-name>
<description>
Tomcat Example servlets and JSP pages.
</description>
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
</web-app>
--------------------
---------- Non-working web.xml that causes errors ----------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Tomcat Examples</display-name>
<description>
Tomcat Example servlets and JSP pages.
</description>
<servlet>
<servlet-name>HelloWorld</servlet-name>
<servlet-class>HelloWorld</servlet-class>
<description>
My test servlet
</description>
</servlet>
<servlet-mapping>
<servlet-name>HelloWorld</servlet-name>
<url-pattern>/HelloWorld</url-pattern>
</servlet-mapping>
</web-app>
--------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
RE: Issues with web.xml
Posted by Andy Eastham <an...@gliant.com>.
Robert,
I'm not sure what the problem is, but you can redirect the output in dos,
just like in unix. Eg, if you're running startup.bat, type
startup.bat > myfile.log
and inspect the output written to the log file. This should help you solve
the problem yourself, or at least you'll be able to give us more detail to
help you.
All the best,
Andy
> -----Original Message-----
> From: Robert Seeger [mailto:rseeger@hvc.rr.com]
> Sent: 03 June 2003 11:09
> To: tomcat-user@jakarta.apache.org
> Subject: Issues with web.xml
>
>
> I'm having issues with the web.xml file in my webapps/root/web-inf
> directory. What I want to do is be able to specify each individual
> servlet that can be run, by using <servlet> and <servlet-mapping> tags.
> Unfortunately, the best I have been able to do is use a generic servlet
> invoker to allow every servlet to be accessed. When I try to set things
> up so that only one servlet can be accessed, there are errors showing up
> in the dos box when I start Tomcat... which proceed to scroll of the
> screen faster than I can look at them. They do not show up in any of the
> logfiles in the logs directory. I was hoping someone could take a look
> at the web.xml file I'm using and tell me if my error is an obvious one,
> and how to fix it. I tried everything I could think of to make it work,
> and checked all the documentation I could find.
>
> I'm running Tomcat 4.1.24 on Windows 98.
>
> Thank you in advance,
> Robert Seeger
>
> ---------- Working web.xml, that allows all servlets in the directory to
> be accessed ----------
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> <!DOCTYPE web-app
> PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
> "http://java.sun.com/dtd/web-app_2_3.dtd">
>
> <web-app>
>
> <display-name>Tomcat Examples</display-name>
> <description>
> Tomcat Example servlets and JSP pages.
> </description>
>
> <servlet-mapping>
> <servlet-name>invoker</servlet-name>
> <url-pattern>/servlet/*</url-pattern>
> </servlet-mapping>
>
> </web-app>
> --------------------
>
> ---------- Non-working web.xml that causes errors ----------
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> <!DOCTYPE web-app
> PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
> "http://java.sun.com/dtd/web-app_2_3.dtd">
>
> <web-app>
>
> <display-name>Tomcat Examples</display-name>
> <description>
> Tomcat Example servlets and JSP pages.
> </description>
>
> <servlet>
> <servlet-name>HelloWorld</servlet-name>
> <servlet-class>HelloWorld</servlet-class>
> <description>
> My test servlet
> </description>
> </servlet>
>
> <servlet-mapping>
> <servlet-name>HelloWorld</servlet-name>
> <url-pattern>/HelloWorld</url-pattern>
> </servlet-mapping>
>
> </web-app>
> --------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Is it safe to use Runtime.exec() from within a JSP
Posted by Jason Bainbridge <ja...@jblinux.org>.
On Tue, 3 Jun 2003 21:11, Adam Lipscombe wrote:
> > You could launch a chess engine that took commands through sysin and
>
> gave results back in sysout, then interface that within a JSP page
> somehow
>
> Any recommended URLs that describe this technique?
The one I followed was:
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
It doesn't deal with JSP's specifically but the concept is the same, what is
it you actually plan on doing?
Regards,
--
Jason Bainbridge
KDE Web Team - http://kde.org
webmaster@kde.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
RE: Is it safe to use Runtime.exec() from within a JSP
Posted by Adam Lipscombe <ad...@cobar.fsbusiness.co.uk>.
Thanks for the info - I'll investigate.
> You could launch a chess engine that took commands through sysin and
gave results back in sysout, then interface that within a JSP page
somehow
Any recommended URLs that describe this technique?
TIA - Adam
-----Original Message-----
From: Jason Bainbridge [mailto:jason@jblinux.org]
Sent: 03 June 2003 13:37
To: Tomcat Users List
Subject: Re: Is it safe to use Runtime.exec() from within a JSP
On Tue, 3 Jun 2003 20:23, Adam Lipscombe wrote:
> Jason,
>
> Thanks for the input...
>
> I am worried about what happens to the rest of Tomcat if one thread
> blocks for (potentially) a long time while a user is playing an
external
> game. Will this have an adverse affect?
What do you mean by an 'external game'? You can't (as far as I am aware)
do
something like use runtime.exec to run something like a chess game on
the
server and then let the user play it as if it were on their own PC.
You could launch a chess engine that took commands through sysin and
gave
results back in sysout, then interface that within a JSP page somehow
however. There are precautions you can take to make Runtime.exec()
thread
safe and there are quite a few tutorials and example code on this on the
web
you might want to check out as well.
Regards,
--
Jason Bainbridge
KDE Web Team - http://kde.org
webmaster@kde.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.487 / Virus Database: 286 - Release Date: 01/06/2003
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Is it safe to use Runtime.exec() from within a JSP
Posted by Jason Bainbridge <ja...@jblinux.org>.
On Tue, 3 Jun 2003 20:23, Adam Lipscombe wrote:
> Jason,
>
> Thanks for the input...
>
> I am worried about what happens to the rest of Tomcat if one thread
> blocks for (potentially) a long time while a user is playing an external
> game. Will this have an adverse affect?
What do you mean by an 'external game'? You can't (as far as I am aware) do
something like use runtime.exec to run something like a chess game on the
server and then let the user play it as if it were on their own PC.
You could launch a chess engine that took commands through sysin and gave
results back in sysout, then interface that within a JSP page somehow
however. There are precautions you can take to make Runtime.exec() thread
safe and there are quite a few tutorials and example code on this on the web
you might want to check out as well.
Regards,
--
Jason Bainbridge
KDE Web Team - http://kde.org
webmaster@kde.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
RE: Is it safe to use Runtime.exec() from within a JSP
Posted by Adam Lipscombe <ad...@cobar.fsbusiness.co.uk>.
Jason,
Thanks for the input...
I am worried about what happens to the rest of Tomcat if one thread
blocks for (potentially) a long time while a user is playing an external
game. Will this have an adverse affect?
Cheers - Adam
-----Original Message-----
From: Jason Bainbridge [mailto:jason@jblinux.org]
Sent: 03 June 2003 12:13
To: Tomcat Users List
Subject: Re: Is it safe to use Runtime.exec() from within a JSP
On Tue, 3 Jun 2003 19:06, Adam Lipscombe wrote:
> I need to launch a Win32 game from a JSP.
> Can I use safely Runtime.exec() from within Tomcat?
I'm not sure about 'safely' I'm not a security expert, but atleast
functionally it works quite well.
I do it with ASpell to implement spell checking in some html forms and
it
works like a charm.
Regards,
--
Jason Bainbridge
KDE Web Team - http://kde.org
webmaster@kde.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.487 / Virus Database: 286 - Release Date: 01/06/2003
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Is it safe to use Runtime.exec() from within a JSP
Posted by Jason Bainbridge <ja...@jblinux.org>.
On Tue, 3 Jun 2003 19:06, Adam Lipscombe wrote:
> I need to launch a Win32 game from a JSP.
> Can I use safely Runtime.exec() from within Tomcat?
I'm not sure about 'safely' I'm not a security expert, but atleast
functionally it works quite well.
I do it with ASpell to implement spell checking in some html forms and it
works like a charm.
Regards,
--
Jason Bainbridge
KDE Web Team - http://kde.org
webmaster@kde.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Is it safe to use Runtime.exec() from within a JSP
Posted by Adam Lipscombe <ad...@cobar.fsbusiness.co.uk>.
Folks,
I need to launch a Win32 game from a JSP.
Can I use safely Runtime.exec() from within Tomcat?
TIA - Adam
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.487 / Virus Database: 286 - Release Date: 01/06/2003
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org