issues deploying geoserver to tomacat

947 views
Skip to first unread message

Paolo Corti

unread,
Mar 22, 2013, 6:02:38โ€ฏAM3/22/13
to geono...@opengeo.org
Hi devs

I have been discussing this with Ian on IRC and I think he is
investigating on this, I think I will post it here so maybe some of
you can have an idea of what is going.
I need to deploy a geoserver instance for geonode in tomcat.
I did the following two tests, but unfortunately both of them are not working

* deploy a vanilla geoserver 2.2.4 to Tomcat, replaced the security
directory included with the war with the security geoserver directory
built with paver. Edited the url in
security/auth/geonodeAuthProvider/config.xml to point to the Geonode
Django instance. In this case geoserver starts but as soon as I try to
authenticate with geonode user geoserver doesn't recognize it (Invalid
username/password combination). Trying the administrative
admin/geoserver user, I get the following error:

HTTP Status 500 - Cannot find alias: ug:default:key in
/opt/tomcat7/dev/tomcat/apache-tomcat-7.0.34/webapps/geoserver/data/security/geoserver.jceks

* deploy the latest geoserver built with paver to Tomcat, and edited
the url in security/auth/geonodeAuthProvider/config.xml to point to
the Geonode Django instance. In this case geoserver won't start and I
get the following the error:

....
INFO: Cleaned up javabean caches
Mar 20, 2013 8:13:47 AM org.apache.catalina.loader.WebappClassLoader
clearReferencesJdbc
SEVERE: The web application [/geoserver] registered the JDBC driver
[org.hsqldb.jdbcDriver] but failed to unregister it when the web
application was stopped. To prevent a memory leak, the JDBC Driver has
been forcibly unregistered.
Mar 20, 2013 8:13:47 AM org.apache.catalina.loader.WebappClassLoader
clearReferencesThreads
SEVERE: The web application [/geoserver] appears to have started a
thread named [Timer-9] but has failed to stop it. This is very likely
to create a memory leak.
Mar 20, 2013 8:13:47 AM org.apache.catalina.loader.WebappClassLoader
clearReferencesThreads
SEVERE: The web application [/geoserver] appears to have started a
thread named [Thread-50] but has failed to stop it. This is very
likely to create a memory leak.
Mar 20, 2013 8:13:47 AM org.apache.catalina.loader.WebappClassLoader
clearReferencesThreads
SEVERE: The web application [/geoserver] appears to have started a
thread named [Thread-51] but has failed to stop it. This is very
likely to create a memory leak.
Mar 20, 2013 8:13:47 AM org.apache.catalina.loader.WebappClassLoader
checkThreadLocalMapForLeaks
SEVERE: The web application [/geoserver] created a ThreadLocal with
key of type [org.eclipse.emf.ecore.xml.type.util.XMLTypeUtil.CharArrayThreadLocal]
(value [org.eclipse.emf.ecore.xml.type.util.XMLTypeUtil$CharArrayThreadLocal@21efa83c])
and a value of type [char[]] (value [[C@7d0e0c8b]) but failed to
remove it when the web application was stopped. Threads are going to
be renewed over time to try and avoid a probable memory leak.
Mar 20, 2013 8:13:47 AM org.apache.catalina.loader.WebappClassLoader
checkThreadLocalMapForLeaks
SEVERE: The web application [/geoserver] created a ThreadLocal with
key of type [org.eclipse.emf.ecore.impl.EClassImpl$1] (value
[org.eclipse.emf.ecore.impl.EClassImpl$1@2559b9d1]) and a value of
type [java.util.HashSet] (value [[]]) but failed to remove it when the
web application was stopped. Threads are going to be renewed over time
to try and avoid a probable memory leak.

* Deploy an "old" geoserver built with paver about one month ago: this
seems working properly...

any ideas?
thanks
p

Paolo Corti
Geospatial software developer
web: http://www.paolocorti.net
twitter: @capooti
skype: capooti

Ariel Nunez

unread,
Mar 22, 2013, 8:29:40โ€ฏAM3/22/13
to Paolo Corti, geono...@opengeo.org

Thanks for the detailed testing Paolo.

I have never gotten #1 to work, seems related to the thread you shared from the geoserver mailing list.

For #2 you only sent the part of the log where geoserver is shutting down, is there a link to the full one? If it works when you build it in another server (I built one yesterday) try removing your .m2 folder to make sure you have a fresh set of dependencies.

Best,
a

Paolo Corti

unread,
Mar 22, 2013, 10:21:22โ€ฏAM3/22/13
to ingenie...@gmail.com, geono...@opengeo.org
Hi Ariel

On Fri, Mar 22, 2013 at 1:29 PM, Ariel Nunez <ingenie...@gmail.com> wrote:
> Thanks for the detailed testing Paolo.
>
> I have never gotten #1 to work, seems related to the thread you shared from
> the geoserver mailing list.
>

for me this sometime has worked, but not always. Not sure what can it
be wrong from time to time.

> For #2 you only sent the part of the log where geoserver is shutting down,
> is there a link to the full one? If it works when you build it in another
> server (I built one yesterday) try removing your .m2 folder to make sure you
> have a fresh set of dependencies.
>

this should be the full link (copied from IRC): http://pastebin.com/yfEn3ZVk

About the .m2 folder: effectively after I removed it I can now build
latest geoserver on my dev computer and successfully deploy to tomcat
in production.
Everything seems work perfectly, I can log in geonode and geoserver,
but upload are not working.

After some debugging (nothing is logged by geonode neither by
geoserver) I think there can be a communication problem using the rest
interface (as it is done by the upload python method).
For example If I try to create a new workspace:

======================================

# curl -u admin:geoserver -v -XPOST -H 'Content-type: text/x' -d
'<workspace><name>acme</name></workspace>'
http://localhost:8082/geoserver/rest/workspaces
* About to connect() to localhost port 8082 (#0)
* Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 8082 (#0)
* Server auth using Basic with user 'admin'
> POST /geoserver/rest/workspaces HTTP/1.1
> Authorization: Basic YWRtaW46Z2Vvc2VydmVy
> User-Agent: curl/7.21.7 (x86_64-pc-linux-gnu) libcurl/7.21.7 OpenSSL/1.0.0d zlib/1.2.3.4 libidn/1.20 libssh2/1.2.8 librtmp/2.3
> Host: localhost:8082
> Accept: */*
> Content-type: text/x
> Content-Length: 40
>
< HTTP/1.1 401 Unauthorized
< Server: Apache-Coyote/1.1
* Authentication problem. Ignoring this.
< WWW-Authenticate: Basic realm="GeoServer Realm"
< Content-Type: text/html;charset=utf-8
< Content-Length: 1061
< Date: Wed, 20 Mar 2013 12:49:37 GMT
<
<html><head><title>Apache Tomcat/7.0.34 - Error
report</title><style><!--H1
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;}
H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;}
H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;}
BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;}
B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;}
P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A
{color : black;}A.name {color : black;}HR {color :
#525D76;}--></style> </head><body><h1>HTTP Status 401 - Full
authentication is required to access this resource</h1><HR size="1"
noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b>
<u>Full authentication is required to access this
resource</u></p><p><b>description</b> <u>This request requires HTTP
authentication.</u></p><HR size="1" noshade="noshade"><h3>Ap*
Connection #0 to host localhost left intact
* Closing connection #0

======================================

This is the error I get using the importlayers command:

======================================

# ./manage.py importlayers /tmp/global/ -v 3
Notifications Configured for geonode.layers.managment.commands
Verifying that GeoNode is running ...
Found 1 potential layers.

----------------------------------------------------------------------------------------------------

Uploading layer: [global], base filename: [/tmp/global/global.shp]
>>> Step 0. Verify if the file /tmp/global/global.shp exists so we can create the layer [global]
>>> Step 1. Figure out a name for global
Using name as requested
>>> Step 2. Make sure we are not trying to overwrite a existing resource named [global] with the wrong type
>>> Step 3. Identifying if [global] is vector or raster and gathering extra files
Uploading vector layer: [/tmp/global/global.shp]
>>> Step 4. Starting upload of [global] to GeoServer...
Could not save the layer global, there was an upload error: <!DOCTYPE
HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
<hr>
<address>Apache/2.2.17 (Debian) Server at beta.geonode.wfp.org Port 80</address>
</body></html>

[failed] Layer for '/tmp/global/global.shp' (1/1)

Detailed report of failures:


/tmp/global/global.shp
================
Traceback (most recent call last):
File "/opt/geonode-2.0/geonode/geonode/layers/utils.py", line 664, in upload
keywords=keywords,
File "/opt/geonode-2.0/geonode/geonode/layers/utils.py", line 584,
in file_upload
keywords=keywords, title=title)
File "/opt/geonode-2.0/geonode/geonode/layers/utils.py", line 375, in save
overwrite=overwrite)
File "/opt/geonode-2.0/geonode/geonode/layers/utils.py", line 700,
in _create_featurestore
cat.create_featurestore(name, data, overwrite=overwrite)
File "/opt/geonode-2.0/geonode-env/local/lib/python2.7/site-packages/geoserver/catalog.py",
line 317, in create_featurestore
raise UploadError(response)
UploadError: Could not save the layer global, there was an upload
error: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
<hr>
<address>Apache/2.2.17 (Debian) Server at beta.geonode.wfp.org Port 80</address>
</body></html>

Finished processing 1 layers in 10.0 seconds.

0 Created layers
0 Updated layers
0 Skipped layers
1 Failed layers
10.000000 seconds per layer

======================================

The 401 error I get it is just the same I get in the geonode upload interface.
Ideas?
Thanks so much for the great help!
cheers
p

--

Paolo Corti

unread,
Mar 25, 2013, 10:19:41โ€ฏAM3/25/13
to ingenie...@gmail.com, geono...@opengeo.org
Guys, sorry to bother, but I am still with this issue :(
I made some extensive debug, so I though I could share my
investigations, maybe someone of you can have an idea about what can
cause the problem.

I will compare two different instances, the first is on my dev pc, the
second in our production server. On the first instance layer uploading
is working and I get 201, in the second instance is failing with a
401.

The failing code is line 315 in catalog.py, create_featurestore in
gsconfig (https://github.com/dwins/gsconfig.py/blob/master/src/geoserver/catalog.py#L314)
:

headers, response = self.http.request(ds_url, "PUT", message, headers)

WORKING INSTANCE
===================
* Geonode latest master, with Django web server, port 8000
* Geoserver built by paver
* Tomcat 7.0.37, port 8082
* JVM 1.7.0_17 Oracle

Debug information:

Request
------------
ds_url
u'http://localhost:8082/geoserver/rest/workspaces/default/datastores/global_24h/file.shp'
message
<open file '/tmp/tmprMXNn7', mode 'r' at 0xa6f4a70>
headers
{'Content-type': 'application/zip', 'Accept': 'application/xml'}

Response
--------------
headers: {'date': 'Mon, 25 Mar 2013 13:50:34 GMT', 'status': '201',
'content-length': '0', 'server': 'Noelios-Restlet-Engine/1.0..8'}
response:

NOT WORKING INSTANCE
=======================
* Geonode latest master, with Apache web server, port 80
* Geoserver built by paver
* Tomcat 7.0.37, port 8082
* JVM 1.7.0_11-b21 Oracle

Debug information:

Request
-----------
ds_url
u'http://beta.geonode.wfp.org:8082/geoserver/rest/workspaces/default/datastores/global/file.shp'
message
<open file '/tmp/tmpI4N9MF', mode 'r' at 0x3f8f930>
headers
{'Content-type': 'application/zip', 'Accept': 'application/xml'}

Response
--------------
headers
{'status': '401', 'content-length': '1061', 'server':
'Apache-Coyote/1.1', 'date': 'Sat, 23 Mar 2013 11:31:22 GMT',
'content-type': 'text/html;charset=utf-8', 'www-authenticate': 'Basic
realm="GeoServer Realm"'}
response
'<html><head><title>Apache Tomcat/7.0.37 - Error
report</title><style><!--H1
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;}
H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;}
H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;}
BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;}
B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;}
P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A
{color : black;}A.name {color : black;}HR {color :
#525D76;}--></style> </head><body><h1>HTTP Status 401 - Full
authentication is required to access this resource</h1><HR size="1"
noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b>
<u>Full authentication is required to access this
resource</u></p><p><b>description</b> <u>This request requires HTTP
authentication.</u></p><HR size="1" noshade="noshade"><h3>Apache
Tomcat/7.0.37</h3></body></html>'

not sure if this is just isolated to my setup, or it it can be worth
to open an issue in GH.
In both case files are correctly stored in /tmp directory.
ideas?
thanks in advance!

Ariel Nunez

unread,
Mar 25, 2013, 10:38:42โ€ฏAM3/25/13
to Paolo Corti, geono...@opengeo.org
Paolo,

After all this debugging, my next steps would be:

a) Debug the network traffic using Ethereal/Wireshark (http://www.wireshark.org/)

b) Use JVM debugging techniques to connect to the running Tomcat and see what geoserver is doing.

I think given the same code is running in both machines, a) may give the best results. Use that to check session keys, usernames, passwords, etc.

-a

Paolo Corti

unread,
Mar 25, 2013, 12:57:40โ€ฏPM3/25/13
to ingenie...@gmail.com, geono...@opengeo.org
Thanks for the suggestion Ariel, I will give a try.
Meanwhile after some more inspection, it seems to be a problem with
the Apache setup.
In fact I have tried to deploy to Apache my dev instance (the one that
is working well with the django dev server) and now I am getting the
same exact error.

Am I missing anything in the configuration? This is what I have in
local_settings.py:

SITEURL = 'http://localhost/'
GEOSERVER_BASE_URL = 'http://localhost:8082/geoserver/'

And this is what I have in /data/security/auth/geonodeAuthProvider/config.xml:

<baseUrl>http://localhost/</baseUrl>

Is anyone experiencing this? Did anyone try to make such a deployment
with 2.0? (Apache/Tomcat)
In the beta server are we using Apache or the Django dev server?
thanks
p

Paolo Corti

unread,
Mar 25, 2013, 1:03:05โ€ฏPM3/25/13
to ingenie...@gmail.com, geono...@opengeo.org
Just to prevent an eventual question, even setting a proxypass to have
geoserver in the same domain as suggested
(GEOSERVER_BASE_URL=http://localhost/geoserver/) does not help.
thanks
p

Spanring, Christian

unread,
Mar 25, 2013, 1:20:22โ€ฏPM3/25/13
to Paolo Corti, ingenieroariel@gmail.com Nunez, geono...@opengeo.org
FWIW, I can confirm that GeoNode 2.0 works under Apache/mod_wsgi, we have one instance with that configuration live.

I think you need to set GeoServer's Auth provider to the public domain, where GeoServer can find the GeoNode instance, and leave the /geoserver proxypass in your apache vhost config for that domain. At least that's our setup here.

Did you add the domain to your hostsfile?

Christian
Please be advised that the Massachusetts Secretary of State considers e-mail to be a public record, and therefore subject to the Massachusetts Public Records Law, M.G.L. c. 66 ยง 10.

Ian Schneider

unread,
Mar 26, 2013, 5:35:05โ€ฏPM3/26/13
to Paolo Corti, GeoNode Development
Hey Paolo,

Finally getting around to looking at this more...

On Fri, Mar 22, 2013 at 4:02 AM, Paolo Corti <pco...@gmail.com> wrote:
> Hi devs
>
> I have been discussing this with Ian on IRC and I think he is
> investigating on this, I think I will post it here so maybe some of
> you can have an idea of what is going.
> I need to deploy a geoserver instance for geonode in tomcat.
> I did the following two tests, but unfortunately both of them are not working
>
> * deploy a vanilla geoserver 2.2.4 to Tomcat, replaced the security
> directory included with the war with the security geoserver directory
> built with paver. Edited the url in
> security/auth/geonodeAuthProvider/config.xml to point to the Geonode
> Django instance. In this case geoserver starts but as soon as I try to
> authenticate with geonode user geoserver doesn't recognize it (Invalid
> username/password combination).

Unless I'm misunderstanding, this shouldn't work at all - the security
directory configures the geonode integrated security plugin which is
not present in vanilla geoserver. I believe it's possible to run
vanilla geoserver with GeoNode but you'll lose any integration
authentication/authorization.

--
Ian Schneider
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

Paolo Corti

unread,
Mar 27, 2013, 11:01:36โ€ฏAM3/27/13
to Ian Schneider, GeoNode Development
Hi all
thanks to Ariel I realized I had a wrong configuration in my Apache conf file.
I was missing to enable the WSGIPassAuthorization directive.
Sorry for the noise and thanks again to Ariel ;)
p
--
Reply all
Reply to author
Forward
0 new messages