[OpenLayers-Users] CGI and Tomcat
Juan Arévalo
arevaco90 at yahoo.es
Tue Sep 15 05:22:17 EDT 2009
Hi Josh,
Sorry for the late response, I was out of the office for a few days. I have
noticed that there was a little mistake when I copied the code:
<init-param>
<param-name>executable</param-name>
<param-value>c:\python25\python.exe</param-value>
</init-param>
instead of:
<param-name>executable</param-name>
<param-value>c:\python25\python.exe</param-value>
</init-param>
You most probably realised about this problem because you were able to set
up CGI in Tomcat! I am not sure where your problem could be, I used Tomcat
5.5.23 and I also test it with 5.5.27 but I wonder if the same steps work
for Tomcat 6. can you not try with a different version of Tomcat?
Juan
Josh Oman wrote:
>
> Hello,
> Are you sure this is all you did to get the proxy.cgi script working with
> Tomcat? I followed these steps for Tomcat 6 (didn't have to rename the
> .jar) without success. I was able to use the proxy.cgi without trouble in
> Apache Server 2.0, but I get the following error after switching to
> Tomcat:
>
> "Some unexpected error occurred. Error text was: <urlopen error (11001,
> 'getaddrinfo failed')>"
>
> I created a test.cgi to print "Hello World" and placed it in the same
> directory as proxy.cgi, "<TOMCAT HOME>\webapps\OlApp\WEB-INF\cgi\". The
> url "http://localhost:8081/OlApp/cgi-bin/test.cgi" printed "Hello World"
> as expected, so I believe the CGI is set up correctly in Tomcat. I then
> added urlopen() to make the test.cgi script look like:
>
> #!c:/Program Files/Python25/python.exe -u
>
> import urllib2
> import cgi
> import sys, os
>
> fs = cgi.FieldStorage()
> url = fs.getvalue('url', "http://www.openlayers.org")
> try:
> y = urllib2.urlopen(url)
> y.close()
>
> print "test"
> print "Content-Type: text/plain"
> print
> print "Hello World"
> except Exception, E:
> print "Status: 500 Unexpected Error"
> print "Content-Type: text/plain"
> print
> print "Some unexpected error occurred. Error text was:", E
>
> I get the same "<urlopen error (11001, 'getaddrinfo failed')>" message.
> My environment is Tomcat 6, Apache 2, Win XP, Python 2.5, and Geoserver is
> running on another server on the intranet. I have my local firewall
> turned off. Proxy support is enabled, and working, in Apache 2.0. I've
> learned quite about proxys while researching this issue, but still have
> not solved it. Any direction or solution is greatly appreciated.
>
> -Josh
>
>
>
>
>
> -----Original Message-----
> From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org]
> On Behalf Of Juan Arévalo
> Sent: Sunday, August 16, 2009 4:13 PM
> To: users at openlayers.org
> Subject: Re: [OpenLayers-Users] CGI and Tomcat
>
>
> Hi!
>
> I have finally managed to display my WFS example in the map! It is not so
> obvious to set up the proxy host in Tomcat! I would like to share with you
> all the steps I followed, in case that someone need it:
>
> 1.- I modified the file: "web.xml" C:\Archivos de programa\Apache Software
> Foundation\Tomcat 5.5\conf\web.xml. I uncomented the following lines of
> code:
>
> <servlet>
> <servlet-name>cgi</servlet-name>
>
> <servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
> <init-param>
> <param-name>debug</param-name>
> <param-value>0</param-value>
> </init-param>
> <init-param>
> <param-name>cgiPathPrefix</param-name>
> <param-value>WEB-INF/cgi</param-value>
> </init-param>
> <load-on-startup>5</load-on-startup>
> </servlet>
>
> <servlet-mapping>
> <servlet-name>cgi</servlet-name>
> <url-pattern>/cgi-bin/*</url-pattern>
> </servlet-mapping>
>
> You have also to add this piece of code:
>
> <param-name>executable</param-name>
> <param-value>c:\python25\python.exe</param-value>
> </init-param>
>
> <init-param>
> <param-name>passShellEnvironment</param-name>
> <param-value>true</param-value>
> </init-param>
>
>
> 2.- I renamed the file servlets-cgi.renametojar to servlets-cgi.jar under
> the folder: C:\Archivos de programa\Apache Software Foundation\Tomcat
> 5.5\server\lib
>
> 3.- I downloaded the "proxy.cgi" file from Openlayers:
> http://trac.openlayers.org/browser/trunk/openlayers/examples/proxy.cgi and
> copy the file in a folder called "cgi-bin" that I created under my
> directory: "C:\Archivos de programa\Apache Software Foundation\Tomcat
> 5.5\webapps\client\WEB-INF\cgi\proxy.cgi"
>
> 4.- In the proxy.cgi file I included my machine in the allowed hosts:
>
> allowedHosts = ['demo.mapfish.org', 'localhost:5000', 'localhost',
> '127.0.0.1']
>
> 5.- I included this piece of code in my map:
>
> OpenLayers.ProxyHost = "/client/cgi-bin/proxy.cgi?url=";
> 6.- I also included in our client folder the context.xml file:
>
> C:\Archivos de programa\Apache Software Foundation\Tomcat
> 5.5\webapps\client\META-INF\context.xml
>
> Make sure that the privileged is set to: "true":
>
> <Context privileged="true" antiResourceLocking="false"
> antiJARLocking="false" />
>
> 7.- Restart Tomcat.
>
> Juan
>
>
>
>
> Juan Arévalo wrote:
>>
>> Hi list,
>>
>> I am still having some difficulties to set up the proxy host in Tomcat.
>> Here are the steps I followed:
>>
>> 1.- I modified the file: "web.xml" C:\Archivos de programa\Apache
>> Software
>> Foundation\Tomcat 5.5\conf\web.xml. I uncomented the following lines of
>> code:
>>
>> <servlet>
>> <servlet-name>cgi</servlet-name>
>>
>> <servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
>> <init-param>
>> <param-name>debug</param-name>
>> <param-value>0</param-value>
>> </init-param>
>> <init-param>
>> <param-name>cgiPathPrefix</param-name>
>> <param-value>WEB-INF/cgi</param-value>
>> </init-param>
>> <load-on-startup>5</load-on-startup>
>> </servlet>
>>
>> <servlet-mapping>
>> <servlet-name>cgi</servlet-name>
>> <url-pattern>/cgi-bin/*</url-pattern>
>> </servlet-mapping>
>>
>> 2.- I renamed the file servlets-cgi.renametojar to servlets-cgi.jar under
>> the folder: C:\Archivos de programa\Apache Software Foundation\Tomcat
>> 5.5\server\lib
>>
>> 3.- I downloaded the "proxy.cgi" file from Openlayers:
>> http://trac.openlayers.org/browser/trunk/openlayers/examples/proxy.cgi
>> and
>> copy the file in a folder called "cgi-bin" that I created under my
>> directory: "Tomcat 5.5\webapps\MapFish-1.1\client\cgi-bin\proxy.cgi"
>>
>> 4.- In the proxy.cgi file I included my machine in the allowed hosts:
>>
>> allowedHosts = ['demo.mapfish.org', 'localhost:5000', 'localhost',
>> '127.0.0.1'] and I also added this line:
>>
>> #!c:/python25/python.exe -u (I already had installed python in my PC)
>>
>> 5.- I included this piece of code in my map:
>>
>> OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url=";
>>
>>
>> 6.- I restarted my Tomcat.
>>
>> I do not see the openlayers.org website when I typed:
>> http://127.0.0.1:8080/MapFish-1.1/client/cgi-bin/proxy.cgi, I got the 404
>> error.
>>
>> Does anyone knows what I missing?
>>
>>
>> Thanks again Eric and Michogar!
>>
>> Juan
>>
>>
>>
>> Eric Lemoine-2-2 wrote:
>>>
>>> On Thursday, August 6, 2009, Juan Arévalo <arevaco90 at yahoo.es> wrote:
>>>>
>>>> Hi all,
>>>>
>>>> I am making some progress setting up a WFS-T, it seems that my code
>>>> works
>>>> since I don´t get any error, but the layer doesn't display in the map.
>>>> I
>>>> have read that this problem can be solved by setting the Proxy Host,
>>>> however
>>>> I was not able to set it up. I am using: Tomcat 5.5, Geoserver 1.5.3
>>>> and
>>>> OpenLayers 2.8 and MapFish 1.1.(I couldn´t only find the steps for
>>>> Apache
>>>> but not for Tomcat)
>>>>
>>>> Does anyone have any ideas on how to solve it?
>>>
>>> Hi. If your Tomcat instance serves both the HTML page and the WFS then
>>> you don't need a proxy.
>>>
>>>
>>> --
>>> Eric Lemoine
>>>
>>> Camptocamp France SAS
>>> Savoie Technolac, BP 352
>>> 73377 Le Bourget du Lac, Cedex
>>>
>>> Tel : 00 33 4 79 44 44 96
>>> Mail : eric.lemoine at camptocamp.com
>>> http://www.camptocamp.com
>>> _______________________________________________
>>> Users mailing list
>>> Users at openlayers.org
>>> http://openlayers.org/mailman/listinfo/users
>>>
>>>
>>
>>
>
> --
> View this message in context:
> http://n2.nabble.com/CGI-and-Tomcat-tp3400100p3454948.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>
--
View this message in context: http://n2.nabble.com/CGI-and-Tomcat-tp3400100p3647822.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list