[GeoNetwork-users] Linking Tomcat to Geonetwork 2.6.x

Hi there,

I'm attempting to link GeoNetwork 2.6.1 to Tomcat and was wondering if you
someone could kindly direct me to any guidelines on how to do this. I have
read the document at
http://trac.osgeo.org/geonetwork/wiki/HowToRunUnderTomcat but I think this
relates more to older versions.

Thanks again.

Richard
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Linking-Tomcat-to-Geonetwork-2-6-x-tp5747050p5747050.html
Sent from the GeoNetwork users mailing list archive at Nabble.com.

We did that plus changing to PostgreSQL/PostGIS db (sorry, also in an older
version 2.4.2), and some minutes about that, in case they'd be of any help:

At least the following sources were used in order to learn how to change the
configuration:

http://geonetwork-opensource.org/

http://lab.usgin.org/applications/doc/running-geonetwork-241-under-tomcat-55-windows-xp

http://trac.osgeo.org/geonetwork/wiki/HowToMoveFromMySQLToPostgres

http://geoserver.org/display/GEOS/GeoServer+GeoNetwork+Integration

http://mimis.simos.googlepages.com/Geonetwork-Simos.pdf

http://www.postgresql.org/docs/8.4/interactive/auth-pg-hba-conf.html

Prerequisites:

JDK (or JRE?) is installed.

Tomcat is installed.

Installation:

Configure the following on the Tomcat software’s Configuration application’s
Java tab:
1. Increase "Initial Memory pool" to 256 MB.
2. Increase "Maximum memory pool" to at least 521 MB - I use 1025 MB but I
have other Java applications besides GeoNetwork's.
3. Add the definitions -XX:MaxPermSize=256m and -XX:PermSize=128m
Run the GeoNetwork installer (typically .jar), and use e.g. the following
options:
• Embedded GeosServer not to be installed (we have it already)
• CSW and the Installer building tools yes, to be installed
• At the end, create installation script if you like, but it is not clear if
there is any need.

Running with Tomcat:
In the Tomcat installation folder, edit …\Tomcat
6.0\conf\Catalina\localhost\geonetwork.xml to be like this:
<Context docBase="/webapps/geonetwork"
crossContext="false"
debug="0"
reloadable="false" />
In the docBase path above, the first slash refers to the Tomcat 6.0\ folder.

Use the latest Java Database Connectivity (JDBC). Download the connector
from http://jdbc.postgresql.org. Here it was JDBC4 Postgresql Driver,
Version 8.4-701 (postgresql-8.4-701.jdbc4.jar, instead of the default
postgresql-8.2-504.jdbc3.jar). How to know which Java Virtual Machine (JVM)
version you are using (here 1.6), see (from the server) Control Panel, Java,
General, About. Namely going to www.javatester.org/version.html may be
blocked when a browser is running from the server? Save the JDBC Connector
(and possible other needed things) into C:\Tomcat\Tomcat
6.0\webapps\geonetwork\WEB-INF\lib\.

Update …\Tomcat 6.0\webapps\geonetwork\WEB-INF\config.xml:

The other two things to be defined in that file are:
• uploadDir (not so essential; it is just a folder where the loaded data
first goes)
• The PostgreSQL resource

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Linking-Tomcat-to-Geonetwork-2-6-x-tp5747050p5747081.html
Sent from the GeoNetwork users mailing list archive at Nabble.com.

Thanks for your prompt reply.

I've almost achieved the task using the following method, with four issues
(noticed at this stage) that I need to resolve.

Method used

To start and stop tomcat:
/etc/init.d/tomcat6 start
/etc/init.d/tomcat6 stop

Add the following lines to /etc/tomcat6/tomcat-users.xml

<role rolename="manager"/>
<role rolename="admin"/>
<user name="admin" password="secret_password" roles="manager,admin"/>

Visited http://localhost:8080/manager/html to check Tomcat is running, and
login.

Initially added the following options to /etc/tomcat6//tomcat6.conf, but had
to delete as it stopped Tomcat from starting
JAVA_OPTS="--JvmMs 256 --JvmMx 512 -XX:MaxPermSize=256 -XX:PermSize=128m"

Created geonetwork.xml in /usr/share/tomcat6/conf/Catalina/localhost/ and
inserted the following:
<Context docBase="/webapps/geonetwork"
privileged="true" antiResourceLocking="false"
antiJARLocking="false">

Downloaded http://jdbc.postgresql.org/download/postgresql-8.4-702.jdbc4.jar
into /srv/tomcat6/webapps/geonetwork/WEB-INF/lib. Removed original (older)
version.

Copied geonetwork directory and contents to /srv/tomcat6/webapps/

Modified config.xml
/srv/tomcat6/webapps/geonetwork/WEB-INF/config.xml
Line 7 <uploadDir>/home/user/geonetwork_243/data/tmp</uploadDir> and
Line 189 <param name="dataDir" value="/home/user/geonetwork_243/data"

Updated location of geonetwork.log in
/srv/tomcat6/webapps/geonetwork/WEB-INF/log4j.cfg
Line40 log4j.appender.jeeves.file =
/srv/tomcat6/webapps/geonetwork/geonetwork.log

Issues remaining after starting GN in Tomcat:
1. categories missing from homepage at
http://localhost:8080/geonetwork/srv/en/main.home
2. Small map and 'Show map' items missing from homepage until after
refreshing page in browser (see attachment).
3. login gives 'Null pointer exception error'
4. geonetwork.log does not appear at
/srv/tomcat6/webapps/geonetwork/geonetwork.log. Not being generated?

Thanks,
Richard
http://osgeo-org.1803224.n2.nabble.com/file/n5750828/Screenshot-1.png
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Linking-Tomcat-to-Geonetwork-2-6-x-tp5747050p5750828.html
Sent from the GeoNetwork users mailing list archive at Nabble.com.

hi,

your issues 1 and 3 are almost certainly caused because you have no access
to your database. Could you check your log files for hints about that ?

Kind regards
Heikki Doeleman

On Thu, Nov 18, 2010 at 9:40 AM, RichC <richard@anonymised.com> wrote:

Thanks for your prompt reply.

I've almost achieved the task using the following method, with four issues
(noticed at this stage) that I need to resolve.

Method used

To start and stop tomcat:
/etc/init.d/tomcat6 start
/etc/init.d/tomcat6 stop

Add the following lines to /etc/tomcat6/tomcat-users.xml

<role rolename="manager"/>
<role rolename="admin"/>
<user name="admin" password="secret_password" roles="manager,admin"/>

Visited http://localhost:8080/manager/html to check Tomcat is running, and
login.

Initially added the following options to /etc/tomcat6//tomcat6.conf, but
had
to delete as it stopped Tomcat from starting
JAVA_OPTS="--JvmMs 256 --JvmMx 512 -XX:MaxPermSize=256 -XX:PermSize=128m"

Created geonetwork.xml in /usr/share/tomcat6/conf/Catalina/localhost/ and
inserted the following:
<Context docBase="/webapps/geonetwork"
privileged="true" antiResourceLocking="false"
antiJARLocking="false">

Downloaded
http://jdbc.postgresql.org/download/postgresql-8.4-702.jdbc4.jar
into /srv/tomcat6/webapps/geonetwork/WEB-INF/lib. Removed original (older)
version.

Copied geonetwork directory and contents to /srv/tomcat6/webapps/

Modified config.xml
/srv/tomcat6/webapps/geonetwork/WEB-INF/config.xml
Line 7 <uploadDir>/home/user/geonetwork_243/data/tmp</uploadDir> and
Line 189 <param name="dataDir" value="/home/user/geonetwork_243/data"

Updated location of geonetwork.log in
/srv/tomcat6/webapps/geonetwork/WEB-INF/log4j.cfg
Line40 log4j.appender.jeeves.file =
/srv/tomcat6/webapps/geonetwork/geonetwork.log

Issues remaining after starting GN in Tomcat:
1. categories missing from homepage at
http://localhost:8080/geonetwork/srv/en/main.home
2. Small map and 'Show map' items missing from homepage until after
refreshing page in browser (see attachment).
3. login gives 'Null pointer exception error'
4. geonetwork.log does not appear at
/srv/tomcat6/webapps/geonetwork/geonetwork.log. Not being generated?

Thanks,
Richard
http://osgeo-org.1803224.n2.nabble.com/file/n5750828/Screenshot-1.png
--
View this message in context:
http://osgeo-org.1803224.n2.nabble.com/Linking-Tomcat-to-Geonetwork-2-6-x-tp5747050p5750828.html
Sent from the GeoNetwork users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
GeoNetwork-users mailing list
GeoNetwork-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-users
GeoNetwork OpenSource is maintained at
http://sourceforge.net/projects/geonetwork

I've tried changing line 108 in config.xml to point to the database...

  <activator
class="org.fao.geonet.activators.McKoiActivator"><configFile>/srv/tomcat6/webapps/geonetwork/WEB-INF/db/db.conf</configFile></activator></resource>

but it is still not resolving the issue (see log file below). I've also
tried editing db.conf but again the same issue about connecting to the
database.

2010-11-19 12:45:13,096 INFO [jeeves.engine] - --- Starting handler
--------------------------------------
2010-11-19 12:45:13,101 INFO [jeeves.apphand] - Initializing GeoNetwork
2.6.1.0 ...
2010-11-19 12:45:13,402 INFO [jeeves.apphand] - Failed to open database
connection, Check config.xml db file configuration.Error is: null
2010-11-19 12:45:13,409 ERROR [jeeves.engine] - Raised exception while
starting appl handler. Skipped.
2010-11-19 12:45:13,409 ERROR [jeeves.engine] - Handler :
org.fao.geonet.Geonetwork
2010-11-19 12:45:13,409 ERROR [jeeves.engine] - Exception :
java.lang.NullPointerException
2010-11-19 12:45:13,409 ERROR [jeeves.engine] - Message : null
2010-11-19 12:45:13,409 ERROR [jeeves.engine] - Stack :
java.lang.NullPointerException
  at org.fao.geonet.Geonetwork.initDatabase(Geonetwork.java:388)
  at org.fao.geonet.Geonetwork.start(Geonetwork.java:130)
  at jeeves.server.JeevesEngine.initAppHandler(JeevesEngine.java:429)
  at jeeves.server.JeevesEngine.init(JeevesEngine.java:148)
  at jeeves.server.sources.http.JeevesServlet.init(JeevesServlet.java:74)
  at javax.servlet.GenericServlet.init(GenericServlet.java:212)
  at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
  at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
  at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4187)
  at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4496)
  at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
  at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
  at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
  at
org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041)
  at
org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964)
  at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
  at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
  at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
  at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
  at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
  at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
  at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
  at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
  at org.apache.catalina.core.StandardService.start(StandardService.java:516)
  at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
  at org.apache.catalina.startup.Catalina.start(Catalina.java:593)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:616)
  at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
  at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

2010-11-19 12:45:13,409 INFO [jeeves.engine] - Starting schedule manager...
2010-11-19 12:45:13,412 INFO [jeeves.engine] - Memory used is : 465 Kb
2010-11-19 12:45:13,412 INFO [jeeves.engine] - Total memory is : 520256 Kb
2010-11-19 12:45:13,412 INFO [jeeves.engine] - Startup time is : 2 (secs)
2010-11-19 12:45:13,412 INFO [jeeves.engine] - === System working

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Linking-Tomcat-to-Geonetwork-2-6-x-tp5747050p5754307.html
Sent from the GeoNetwork users mailing list archive at Nabble.com.

Hi Rich:
Although we do not use postgresql db, we have had success with Tomcat
and GN 2.6.x doing the following:
1. Using Tomcat 5.5 and jre 1.5 as indicated by the GN
documentation.
2. Using the downloadable geonetwork.war and adding it to the
Tomcat ".../webapps" directory. Tomcat will deploy Geonetwork
automatically.
3. Changing the config.xml file to point to the preferred db...we
have done this for McKoi and Oracle.
4. Stopping and starting Tomcat.

Somethings to keep in mind...
1. The Geoserver.war file will have to be installed separately for
purposes of generating the map viewers. Use the admin console to create
your data sources and layers.
2. GeoNetwork will need to be configured for your Geoserver through
the config-gui.xml to properly show the map viewers.
3. If you have any other installations of GeoNetwork on the server,
check your ports to make sure that they are not already consumed by
another installation. This happens with McKoi. The db.conf will allow
you to do this.
4. We did not have to make any changes to the config.xml for the
parameters you mentioned other than to set "true" for the appropriate db
nor changes to log4j.cfg other than to set: log4j.rootLogger = ON for
debug purposes.

Hopefully this helps some.

Ralph

GIS Data Services
BSS-Geographic Business Solutions
MNR-Land Resources Cluster
Government of Ontario
300 Water St., 2nd Fl, Nth Tower
Peterborough, ON
Canada K9J 8M5

-----Original Message-----
From: RichC [mailto:richard@anonymised.com]
Sent: November 18, 2010 3:41 AM
To: geonetwork-users@lists.sourceforge.net
Subject: Re: [GeoNetwork-users] Linking Tomcat to Geonetwork 2.6.x

Thanks for your prompt reply.

I've almost achieved the task using the following method, with four
issues
(noticed at this stage) that I need to resolve.

Method used

To start and stop tomcat:
/etc/init.d/tomcat6 start
/etc/init.d/tomcat6 stop

Add the following lines to /etc/tomcat6/tomcat-users.xml

<role rolename="manager"/>
<role rolename="admin"/>
<user name="admin" password="secret_password" roles="manager,admin"/>

Visited http://localhost:8080/manager/html to check Tomcat is running,
and
login.

Initially added the following options to /etc/tomcat6//tomcat6.conf, but
had
to delete as it stopped Tomcat from starting
JAVA_OPTS="--JvmMs 256 --JvmMx 512 -XX:MaxPermSize=256
-XX:PermSize=128m"

Created geonetwork.xml in /usr/share/tomcat6/conf/Catalina/localhost/
and
inserted the following:
<Context docBase="/webapps/geonetwork"
privileged="true" antiResourceLocking="false"
antiJARLocking="false">

Downloaded
http://jdbc.postgresql.org/download/postgresql-8.4-702.jdbc4.jar
into /srv/tomcat6/webapps/geonetwork/WEB-INF/lib. Removed original
(older)
version.

Copied geonetwork directory and contents to /srv/tomcat6/webapps/

Modified config.xml
/srv/tomcat6/webapps/geonetwork/WEB-INF/config.xml
Line 7 <uploadDir>/home/user/geonetwork_243/data/tmp</uploadDir> and
Line 189 <param name="dataDir" value="/home/user/geonetwork_243/data"

Updated location of geonetwork.log in
/srv/tomcat6/webapps/geonetwork/WEB-INF/log4j.cfg
Line40 log4j.appender.jeeves.file =
/srv/tomcat6/webapps/geonetwork/geonetwork.log

Issues remaining after starting GN in Tomcat:
1. categories missing from homepage at
http://localhost:8080/geonetwork/srv/en/main.home
2. Small map and 'Show map' items missing from homepage until after
refreshing page in browser (see attachment).
3. login gives 'Null pointer exception error'
4. geonetwork.log does not appear at
/srv/tomcat6/webapps/geonetwork/geonetwork.log. Not being generated?

Thanks,
Richard
http://osgeo-org.1803224.n2.nabble.com/file/n5750828/Screenshot-1.png
--
View this message in context:
http://osgeo-org.1803224.n2.nabble.com/Linking-Tomcat-to-Geonetwork-2-6-
x-tp5747050p5750828.html
Sent from the GeoNetwork users mailing list archive at Nabble.com.

Thanks Ralph, I've now got this to work, using the following method. Although
it seems to work okay, I noticed an error in the log (see below), though not
sure if it should be ignored?
Cheers,
Richard

Method for linking GN to Tomcat

Downloaded Tomcat 5.5 http://tomcat.apache.org/download-55.cgi

1. Core:
http://mirrors.issp.co.th/apache//tomcat/tomcat-5/v5.5.31/bin/apache-tomcat-5.5.31.tar.gz
Extracted and copied into home directory (e.g.,
/home/user/apache-tomcat-5.5.31)

2. Admin:
http://mirrors.issp.co.th/apache//tomcat/tomcat-5/v5.5.31/bin/apache-tomcat-5.5.31-admin.tar.gz

(also
see:http://www.coderanch.com/t/87988/Tomcat/Tomcat-Manager-Admin-Login)
Copied /admin directory into webapps (~/apache-tomcat-5.5.31/webapps/admin)
Copied /conf/Catalina/localhost/admin.xml into Tomcat conf directory
(~/apache-tomcat-5.5.31/conf/admin.xml) Not sure if the latter needed. Also
http://localhost:8080/admin/ is not accessible, but Tomcat manager is
accessible at http://localhost:8080/manager/html.

Added the following lines into ~/apache-tomcat-5.5.31/conf/tomcat-users.xml

<role rolename="manager"/>
<role rolename="admin"/>
<user name="admin" password="secret_password" roles="manager,admin"/>

Copied geonetwork directory and geoserver.war (from GN 2.6.1 download:
~/web/geonetwork and ~/web/geoserver.war) into
~/apache-tomcat-5.5.31/webapps

To show default layers in GN viewer, edit line 53 in
~/geoserver/webapps/web.xml
     
<param-value>/home/use/apache-tomcat-5.5.31/webapps/data/geoserver_data</param-value>

Start/stop Tomcat with:
cd /home/user/apache-tomcat-5.5.31/bin
./startup.sh
./shutdown/sh

Check installation working:
http://localhost:8080/geonetwork/srv/en/main.home

Java version used:
java version "1.6.0_18"

However, note error on startup from catalina.out log:

Nov 21, 2010 3:50:11 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal
performance in production environments was not found on the
java.library.path:
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0/jre/lib/i386/client:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0/jre/lib/i386:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0/jre/../lib/i386:/usr/lib/mpi/gcc/openmpi/lib:/usr/java/packages/lib/i386:/lib:/usr/lib
Nov 21, 2010 3:50:12 PM org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Nov 21, 2010 3:50:12 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 610 ms
Nov 21, 2010 3:50:12 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Nov 21, 2010 3:50:12 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.31
Nov 21, 2010 3:50:12 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Nov 21, 2010 3:50:12 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive geoserver.war
Nov 21, 2010 3:50:13 PM org.apache.catalina.loader.WebappClassLoader
validateJarFile
INFO:
validateJarFile(/home/user/apache-tomcat-5.5.31/webapps/geoserver/WEB-INF/lib/servlet-api-2.4.jar)
- jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class:
javax/servlet/Servlet.class
Nov 21, 2010 3:50:14 PM it.geosolutions.imageio.gdalframework.GDALUtilities
loadGDAL
WARNING: Native library load failed.java.lang.UnsatisfiedLinkError: no
gdaljni in java.library.path
Nov 21, 2010 3:50:23 PM org.apache.catalina.loader.WebappClassLoader
validateJarFile
INFO:
validateJarFile(/home/user/apache-tomcat-5.5.31/webapps/geonetwork/WEB-INF/lib/servlet-api-2.5-6.1.14.jar)
- jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class:
javax/servlet/Servlet.class
Nov 21, 2010 3:50:32 PM org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Nov 21, 2010 3:50:32 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Nov 21, 2010 3:50:32 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/23 config=null
Nov 21, 2010 3:50:32 PM org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
Nov 21, 2010 3:50:32 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 20313 ms

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Linking-Tomcat-to-Geonetwork-2-6-x-tp5747050p5760020.html
Sent from the GeoNetwork users mailing list archive at Nabble.com.