You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Alan Findly <af...@ronan.net> on 2013/01/14 03:52:55 UTC

Question about config and correct start-up

Dear Tomcat user's group:
    I'm having a problem getting cgi to work.  I have Tomcat 
installed--used the installer from download page.  It's working fine for 
java, but I need the web server for my cgi project & running & testing 
perl from html locally on my PC...yea Windows env...ah, well...anyway my 
goal is to develop Perl stuff locally before uploading to regular server.
   I've followed all the config instructions for setting it up, 
including editing the conf\web.xml file to make the cgi servlet 
functional, which just involves removing comment signs from around the 
servlet.
   Done.  So, what should happen is that when I call a perl script from 
html it should fire up & go.
   But .... still no workey .... so digging further I noticed the config 
document which is a README.xml .... makes a vague reference to having 
the correct "context" for cgi, but seemingly no other data....I'm 
missing something??
   Now, folks, I have no more clues what this refers to ... can someone 
shed some light for me??
   I've made an assumption that since I'm the only user on my PC that I 
do not have to register "me" in the "Tomcat-users.xml" .... since the 
role of manager-gui does not seem to apply to cgi.
   But I've been wrong before!

Thanks,
Alan

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


Re: Question about config and correct start-up

Posted by Mark Thomas <ma...@apache.org>.
On 16/01/2013 23:22, Alan Findly wrote:
> That context statement is not correct syntax....
> should be: <privileged="true"/>

Wrong. See my previous message.

Mark


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


Re: Question about config and correct start-up

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Alan,

On 1/16/13 11:43 PM, Alan Findly wrote:
> The recommended context "ELEMENT" caused the following warning:
> 
> Jan 16, 2013 9:10:37 AM org.apache.tomcat.util.digester.Digester
> endElement WARNING:   No rules found matching 'Context/Context'.

That error suggests that you have something like:

<Context>
  <Context>
  ...
  </Context>
</Context>

If you are modifying your configuration trying to get something to
work, don't just say "I did it and it still doesn't work". Re-post
your current configuration. *sigh*

> So I changed the "ELEMENT" to this --as below-- and voila ..... the
> warning went away.

Below ... where?

> My thread seems out of context(no pun intended) because I made the 
> unwarranted assumption that the original thread would be included
> in every reply & comment.....as it should be....otherwise I have
> to re-iterate the problem, ie. thread...every time.

Or you could use a threaded mail-reader. Anyhow, top-posting is
discouraged. You can feel free to ignore that advice but you will
irritate many of the folks on this list (myself included) who may see
your refusal to help us help you as annoying enough to ignore your
questions. YMMV.

> The problem I'm trying to solve is making tomcat do cgi, and the 
> Apache.tomcat documentation says to do basically 3 tasks: (1)
> Uncomment the cgi servlet in the conf/web.xm file.

Right. It seems you have done that.

> (2) In same file uncomment the cgi servlet mapping.

That, too.

> (3)  Add the context "ELEMENT" to the context.xml file.

No, it says that your context needs to be marked as "privileged". The
way to do that is to add privileged="true" to your <Context> element
which should have already been in your WEB-INF/context.xml file. If
you didn't have such a file, you'll need to create one that looks like
this:

<?xml version="1.0" ?>
<Context privileged="true" />

You may wish to have other configuration in there as well -- only you
know your own webapp's requirements. Please exercise due diligence
when merging the above configuration into your own: don't simply
copy/paste that onto the end of whatever you had there already.

> So, now, as already covered in the previous parts of this
> problem's thread, the cgi functionality is still not working--at
> least not for perl--cgi files, which are all I've tested since this
> is my focus.

As per the documentation[1], "perl" is the default. If you expect that
the URL always contains the full script name and the scripts are
directly executable (not likely on WinXP), you can change that. Also
note that if perl.exe isn't in the PATH for the Tomcat user, you may
have to set the full path in the "executable" init-param of the CGI
servlet.

> Question; do I need a Tomcat/lib/servlet-cgi.jar file?

No, you do not.

> Previous versions did -- well, version 5.  I am working with
> version 7.0.34 and there is no such jar file in the downloaded tar.
> Now the servlet in conf/web.xml could be "it" instead of a jar
> file.

It sounds like you have no idea what you are talking about. Rest
assured, Tomcat includes the CGI servlet and you don't need to
mess-around with any JAR files. You are only configuring it in
conf/web.xml.

> However, what has me questioning -- there is also an api servlet in
> conf/web.xml--as well as a lib/servlet-api.jar file.

No, there isn't an "api servlet" in conf/web.xml. The letters "api" do
not appear in conf/web.xml. The servlet-api.jar file exists to provide
... the servlet API classes to the whole container.

> I'm thinking now that the REAL problem is Windows XP.....always
> been a dog....I think it has something missing to purposely lock
> out cgi. I'm thinking i should just throw it away & migrate to a
> Linux box.

While that may be good advice in general, WinXP is not intentionally
thwarting your attempts to get CGIs running. Everything you are doing
here will need to be done on Linux, too (except that there you can
actually have executable scripts which simplifies one small part of
the configuration).

If things still aren't working, please re-post all current, relevant
parts of your configuration: don't expect anyone to go back through
the list of messages applying verbal diffs to things to guess at what
your files look like. Also, be specific. If you say "it doesn't work"
say what you expected and what actually happened. Also look for
anything relevant in log files: they can tell you a lot and we're
going to ask, anyway, so just save us all some time and check them
first. If they are empty, say they are empty (and say which files you
looked at).

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlD4OxEACgkQ9CaO5/Lv0PAxMACgiw/1MXcTRMf7NfTBXM8sdy1I
XlYAoKd6UN8hJ9pD8NDE4bAb+gP5zTRe
=b6F7
-----END PGP SIGNATURE-----

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


Re: Question about config and correct start-up

Posted by Alan Findly <af...@ronan.net>.
The recommended context "ELEMENT" caused the following warning:

Jan 16, 2013 9:10:37 AM org.apache.tomcat.util.digester.Digester endElement
WARNING:   No rules found matching 'Context/Context'.

So I changed the "ELEMENT" to this --as below--
and voila ..... the warning went away.

My thread seems out of context(no pun intended) because I made the 
unwarranted assumption that the original thread would be included in 
every reply & comment.....as it should be....otherwise I have to 
re-iterate the problem, ie. thread...every time.

The problem I'm trying to solve is making tomcat do cgi, and the 
Apache.tomcat documentation says to do basically 3 tasks: (1) Uncomment 
the cgi servlet in the conf/web.xm file.  (2) In same file uncomment the 
cgi servlet mappingl.  (3)  Add the context "ELEMENT" to the context.xml 
file.

So, now, as already covered in the previous parts of this problem's 
thread, the cgi functionality is still not working--at least not for 
perl--cgi files, which are all I've tested since this is my focus.

Question; do I need a Tomcat/lib/servlet-cgi.jar file?  Previous 
versions did -- well, version 5.  I am working with version 7.0.34 and 
there is no such jar file in the downloaded tar.  Now the servlet in 
conf/web.xml could be "it" instead of a jar file. However, what has me 
questioning -- there is also an api servlet in conf/web.xml--as well as 
a lib/servlet-api.jar file.

I'm thinking now that the REAL problem is Windows XP.....always been a 
dog....I think it has something missing to purposely lock out cgi. I'm 
thinking i should just throw it away & migrate to a Linux box.

Thanks Mark and Chuck for your help, and I'm still listening if someone 
has a current Tomcat-for-WindowsXP solution.

Peace,
Alan

......

On 1/16/2013 4:27 PM, Caldarale, Charles R wrote:
>> From: Alan Findly [mailto:afindly@ronan.net]
>> Subject: Re: Question about config and correct start-up
>> That context statement is not correct syntax....
>> should be: <privileged="true"/>
> Thank you for providing a clear example of why top-posting is evil: no one has any idea which of the several <Context> elements (they're not statements) in the message you are referring to.
>
> In any event, the angle brackets should not be present in <Context> attributes; this is standard XML syntax.  The <Context> element should look like this:
>
> <Context privileged="true">
>    ...
> </Context>
>
>   - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
>
>
> ---------------------------------------------------------------------
> 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


RE: Question about config and correct start-up

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Alan Findly [mailto:afindly@ronan.net] 
> Subject: Re: Question about config and correct start-up

> That context statement is not correct syntax....
> should be: <privileged="true"/>

Thank you for providing a clear example of why top-posting is evil: no one has any idea which of the several <Context> elements (they're not statements) in the message you are referring to.

In any event, the angle brackets should not be present in <Context> attributes; this is standard XML syntax.  The <Context> element should look like this:

<Context privileged="true">
  ...
</Context>

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


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


Re: Question about config and correct start-up

Posted by Alan Findly <af...@ronan.net>.
That context statement is not correct syntax....
should be: <privileged="true"/>

...
On 1/14/2013 1:29 PM, Alan Findly wrote:
> Mark:
>   Thanks for your quick response.  Here are the items & issues:
>
> OK....got the servlet mapping uncommented.
>
> About the context.... the priviledged attribute must be added to the 
> context.xml file, as the documentation says, and, yes, I am reading 
> the instructions in
>
> http://tomcat.apache.org/tomcat-7.0-doc/cgi-howto.html
>
> but the instructions are vague--non-specific for individual attributes.
> Should it be stated this way, in the context file:
>
> <privileged>true</privileged>:
>
> It could be thus:
>
> <privileged="true"></privileged>
>
> or, should it be this way:
>
> <privileged="true">
>
> I'll wait for your reply, but I believe it's the latter.
>
> My testing is with tried & proven code, using the post 
> method....scripts that have already worked on other servers.
> .......
>
> On 1/14/2013 12:30 AM, Mark Thomas wrote:
>> On 14/01/2013 03:52, Alan Findly wrote:
>>> Forgot to mention version of tomcat .....7.0.34 ..... on WindowsXP
>>>
>>>
>>> -------- Original Message --------
>>> Subject:     Question about config and correct start-up
>>> Date:     Sun, 13 Jan 2013 19:52:55 -0700
>>> From:     Alan Findly <af...@ronan.net>
>>> To:     users@tomcat.apache.org
>>>
>>>
>>>
>>> Dear Tomcat user's group:
>>>     I'm having a problem getting cgi to work.
>> <snip/>
>>>    I've followed all the config instructions for setting it up,
>>> including editing the conf\web.xml file to make the cgi servlet
>>> functional, which just involves removing comment signs from around the
>>> servlet.
>> You need to remove the comments around the servlet mapping as well.
>>
>>>    Done.  So, what should happen is that when I call a perl script from
>>> html it should fire up & go.
>> That depends on how you are "calling a perl script from html".
>>
>>>    But .... still no workey .... so digging further I noticed the 
>>> config
>>> document which is a README.xml ....
>> I don't recall any file of that name. What is its exact path on your 
>> system?
>>
>>> makes a vague reference to having
>>> the correct "context" for cgi, but seemingly no other data....I'm
>>> missing something??
>> Have you read the docs?
>> http://tomcat.apache.org/tomcat-7.0-doc/cgi-howto.html
>>
>> You need to mark your context as privileged.
>>
>>>    I've made an assumption that since I'm the only user on my PC that I
>>> do not have to register "me" in the "Tomcat-users.xml" .... since the
>>> role of manager-gui does not seem to apply to cgi.
>> Correct, assuming the resources are not protected by security 
>> constraints.
>>
>> Mark
>>
>>
>> ---------------------------------------------------------------------
>> 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


Re: Question about config and correct start-up

Posted by Mark Thomas <ma...@apache.org>.
On 14/01/2013 20:29, Alan Findly wrote:
> Mark:
>   Thanks for your quick response.  Here are the items & issues:
> 
> OK....got the servlet mapping uncommented.
> 
> About the context.... the priviledged attribute must be added to the
> context.xml file, as the documentation says, and, yes, I am reading the
> instructions in
> 
> http://tomcat.apache.org/tomcat-7.0-doc/cgi-howto.html
> 
> but the instructions are vague--non-specific for individual attributes.
> Should it be stated this way, in the context file:
> 
> <privileged>true</privileged>:
> 
> It could be thus:
> 
> <privileged="true"></privileged>
> 
> or, should it be this way:
> 
> <privileged="true">

<Context privileged="true" />

Like any other attribute on any other configuration element.

Mark


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


Re: Question about config and correct start-up

Posted by Alan Findly <af...@ronan.net>.
Mark:
   Thanks for your quick response.  Here are the items & issues:

OK....got the servlet mapping uncommented.

About the context.... the priviledged attribute must be added to the 
context.xml file, as the documentation says, and, yes, I am reading the 
instructions in

http://tomcat.apache.org/tomcat-7.0-doc/cgi-howto.html

but the instructions are vague--non-specific for individual attributes.
Should it be stated this way, in the context file:

<privileged>true</privileged>:

It could be thus:

<privileged="true"></privileged>

or, should it be this way:

<privileged="true">

I'll wait for your reply, but I believe it's the latter.

My testing is with tried & proven code, using the post method....scripts 
that have already worked on other servers.
.......

On 1/14/2013 12:30 AM, Mark Thomas wrote:
> On 14/01/2013 03:52, Alan Findly wrote:
>> Forgot to mention version of tomcat .....7.0.34 ..... on WindowsXP
>>
>>
>> -------- Original Message --------
>> Subject:     Question about config and correct start-up
>> Date:     Sun, 13 Jan 2013 19:52:55 -0700
>> From:     Alan Findly <af...@ronan.net>
>> To:     users@tomcat.apache.org
>>
>>
>>
>> Dear Tomcat user's group:
>>     I'm having a problem getting cgi to work.
> <snip/>
>>    I've followed all the config instructions for setting it up,
>> including editing the conf\web.xml file to make the cgi servlet
>> functional, which just involves removing comment signs from around the
>> servlet.
> You need to remove the comments around the servlet mapping as well.
>
>>    Done.  So, what should happen is that when I call a perl script from
>> html it should fire up & go.
> That depends on how you are "calling a perl script from html".
>
>>    But .... still no workey .... so digging further I noticed the config
>> document which is a README.xml ....
> I don't recall any file of that name. What is its exact path on your system?
>
>> makes a vague reference to having
>> the correct "context" for cgi, but seemingly no other data....I'm
>> missing something??
> Have you read the docs?
> http://tomcat.apache.org/tomcat-7.0-doc/cgi-howto.html
>
> You need to mark your context as privileged.
>
>>    I've made an assumption that since I'm the only user on my PC that I
>> do not have to register "me" in the "Tomcat-users.xml" .... since the
>> role of manager-gui does not seem to apply to cgi.
> Correct, assuming the resources are not protected by security constraints.
>
> Mark
>
>
> ---------------------------------------------------------------------
> 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


Re: Question about config and correct start-up

Posted by Mark Thomas <ma...@apache.org>.
On 14/01/2013 03:52, Alan Findly wrote:
> Forgot to mention version of tomcat .....7.0.34 ..... on WindowsXP
> 
> 
> -------- Original Message --------
> Subject:     Question about config and correct start-up
> Date:     Sun, 13 Jan 2013 19:52:55 -0700
> From:     Alan Findly <af...@ronan.net>
> To:     users@tomcat.apache.org
> 
> 
> 
> Dear Tomcat user's group:
>    I'm having a problem getting cgi to work.

<snip/>
>   I've followed all the config instructions for setting it up,
> including editing the conf\web.xml file to make the cgi servlet
> functional, which just involves removing comment signs from around the
> servlet.

You need to remove the comments around the servlet mapping as well.

>   Done.  So, what should happen is that when I call a perl script from
> html it should fire up & go.

That depends on how you are "calling a perl script from html".

>   But .... still no workey .... so digging further I noticed the config
> document which is a README.xml ....

I don't recall any file of that name. What is its exact path on your system?

> makes a vague reference to having
> the correct "context" for cgi, but seemingly no other data....I'm
> missing something??

Have you read the docs?
http://tomcat.apache.org/tomcat-7.0-doc/cgi-howto.html

You need to mark your context as privileged.

>   I've made an assumption that since I'm the only user on my PC that I
> do not have to register "me" in the "Tomcat-users.xml" .... since the
> role of manager-gui does not seem to apply to cgi.

Correct, assuming the resources are not protected by security constraints.

Mark


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


Re: Question about config and correct start-up

Posted by Alan Findly <af...@ronan.net>.
Forgot to mention version of tomcat .....7.0.34 ..... on WindowsXP


-------- Original Message --------
Subject: 	Question about config and correct start-up
Date: 	Sun, 13 Jan 2013 19:52:55 -0700
From: 	Alan Findly <af...@ronan.net>
To: 	users@tomcat.apache.org



Dear Tomcat user's group:
    I'm having a problem getting cgi to work.  I have Tomcat
installed--used the installer from download page.  It's working fine for
java, but I need the web server for my cgi project & running & testing
perl from html locally on my PC...yea Windows env...ah, well...anyway my
goal is to develop Perl stuff locally before uploading to regular server.
   I've followed all the config instructions for setting it up,
including editing the conf\web.xml file to make the cgi servlet
functional, which just involves removing comment signs from around the
servlet.
   Done.  So, what should happen is that when I call a perl script from
html it should fire up & go.
   But .... still no workey .... so digging further I noticed the config
document which is a README.xml .... makes a vague reference to having
the correct "context" for cgi, but seemingly no other data....I'm
missing something??
   Now, folks, I have no more clues what this refers to ... can someone
shed some light for me??
   I've made an assumption that since I'm the only user on my PC that I
do not have to register "me" in the "Tomcat-users.xml" .... since the
role of manager-gui does not seem to apply to cgi.
   But I've been wrong before!

Thanks,
Alan