3

I have edited my post to make it look more clear.

I wanted to upgrade GeoServer from v.2.7.1 to v.2.10.1 on Ubunutu 14.4. I deployed v.2.7.1 in Tomcat Web Application Manager. I have downloaded v2.10.1, geoserver-2.10.1-war.zip and unzipped it in /var/lib/tomcat7/webapps/. Tomcat Web Application Manager is saying that geoserver is not running, http://myhostname:8080/geoserver/web returned HTTP Status 404.

server.xml in /var/lib/tomcat7/conf looks like:

<Connector port="8080" protocol="HTTP/1.1"
           connectionTimeout="20000"
           URIEncoding="UTF-8"
           redirectPort="8443" />

Then I have undeployed v.2.10.1 and deployed v.2.7.1 a-g-a-i-n in the same configuration and it worked fine.


Edit:

I figured out that v.2.10.1 needs java8 to run, and previously I had java 7 running with tomcat7. I have uninstalled both of them and then install new versions java version "1.8.0_111" and Apache Tomcat/8.0.39 (https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-8-on-ubuntu-14-04 where in tomcat.conf I changed line env JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/jre to env JAVA_HOME=/usr/lib/jvm/java-8-oracle/jre.

So now I have:

opt
├── gwc
├── java
└── tomcat

/opt/tomcat/webapps
├── docs
├── examples
├── geoserver
├── host-manager
├── manager
└── ROOT

Tomcat Web Application Manager says that GeoServer is running, however myhostname:8080/geoserver/web returned HTTP Status 404.

with catalina.sh run I get this:

$ ./catalina.sh run
Using CATALINA_BASE:   /opt/tomcat
Using CATALINA_HOME:   /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar
14-Jan-2017 16:55:22.435 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.0.39
14-Jan-2017 16:55:22.438 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Nov 9 2016 08:48:39 UTC
14-Jan-2017 16:55:22.438 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.0.39.0
14-Jan-2017 16:55:22.438 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Linux
14-Jan-2017 16:55:22.438 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            3.16.0-30-generic
14-Jan-2017 16:55:22.438 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
14-Jan-2017 16:55:22.438 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             /usr/lib/jvm/java-8-oracle/jre
14-Jan-2017 16:55:22.438 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_111-b14
14-Jan-2017 16:55:22.439 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
14-Jan-2017 16:55:22.439 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         /opt/tomcat
14-Jan-2017 16:55:22.439 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         /opt/tomcat
14-Jan-2017 16:55:22.439 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/opt/tomcat/conf/logging.properties
14-Jan-2017 16:55:22.439 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
14-Jan-2017 16:55:22.439 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
14-Jan-2017 16:55:22.439 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
14-Jan-2017 16:55:22.440 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=/opt/tomcat/endorsed
14-Jan-2017 16:55:22.440 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/opt/tomcat
14-Jan-2017 16:55:22.440 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/opt/tomcat
14-Jan-2017 16:55:22.440 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/opt/tomcat/temp
14-Jan-2017 16:55:22.440 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
14-Jan-2017 16:55:22.590 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
14-Jan-2017 16:55:22.605 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
14-Jan-2017 16:55:22.607 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
14-Jan-2017 16:55:22.609 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
14-Jan-2017 16:55:22.609 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 555 ms
14-Jan-2017 16:55:22.635 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
14-Jan-2017 16:55:22.635 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.39
14-Jan-2017 16:55:22.645 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /opt/tomcat/webapps/geoserver
14-Jan-2017 16:55:22.971 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /opt/tomcat/webapps/geoserver has finished in 325 ms
14-Jan-2017 16:55:22.971 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /opt/tomcat/webapps/docs
14-Jan-2017 16:55:22.988 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /opt/tomcat/webapps/docs has finished in 16 ms
14-Jan-2017 16:55:22.988 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /opt/tomcat/webapps/examples
14-Jan-2017 16:55:23.216 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /opt/tomcat/webapps/examples has finished in 228 ms
14-Jan-2017 16:55:23.216 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /opt/tomcat/webapps/manager
14-Jan-2017 16:55:23.313 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /opt/tomcat/webapps/manager has finished in 97 ms
14-Jan-2017 16:55:23.314 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /opt/tomcat/webapps/host-manager
14-Jan-2017 16:55:23.330 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /opt/tomcat/webapps/host-manager has finished in 16 ms
14-Jan-2017 16:55:23.330 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /opt/tomcat/webapps/ROOT
14-Jan-2017 16:55:23.342 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /opt/tomcat/webapps/ROOT has finished in 12 ms
14-Jan-2017 16:55:23.345 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
14-Jan-2017 16:55:23.350 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
14-Jan-2017 16:55:23.351 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 741 ms
1
  • Comments are not for extended discussion; this conversation has been moved to chat.
    – Ian Turton
    Commented Jan 14, 2017 at 16:37

2 Answers 2

1

To run GeoServer 2.10+ you must make sure that tomcat is running in a Java 8 JVM. To see if this is your issue check in /var/log/tomcat/localhost.2017-01-13/log (with today's date) and if you see anything that says Unsupported major.minor version 52.0 like:

Jan 13, 2017 1:07:27 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Jan 13, 2017 1:07:27 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class org.geoserver.GeoserverInitStartupListener
java.lang.UnsupportedClassVersionError: org/geoserver/GeoserverInitStartupListener : Unsupported major.minor version 52.0 (unable to load class org.geoserver.GeoserverInitStartupListener)
        at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2948)
        at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1208)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569)
        at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:529)
        at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:511)
        at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:139)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4925)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5504)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1073)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)

On Ubuntu 14 I found that the init.d/tomcat7 script was hardcoded to look for Java 7 or 6. To fix this (after I had installed Java 8 and set it using the alternatives system) I edited (as root) /etc/init.d/tomcat7 and found the section that was setting JAVA_HOME:

# this is a work-around until there is a suitable runtime replacement 
# for dpkg-architecture for arch:all packages
# this function sets the variable OPENJDKS
find_openjdks()
{
        for jvmdir in /usr/lib/jvm/java-7-openjdk-*
        do
                if [ -d "${jvmdir}" -a "${jvmdir}" != "/usr/lib/jvm/java-7-openjdk-common" ]
                then
                        OPENJDKS=$jvmdir
                fi
        done
        for jvmdir in /usr/lib/jvm/java-6-openjdk-*
        do
                if [ -d "${jvmdir}" -a "${jvmdir}" != "/usr/lib/jvm/java-6-openjdk-common" ]
                then
                        OPENJDKS="${OPENJDKS} ${jvmdir}"
                fi
        done
}
# 
OPENJDKS=""
find_openjdks
# The first existing directory is used for JAVA_HOME (if JAVA_HOME is not
# defined in $DEFAULT)
JDK_DIRS="/usr/lib/jvm/default-java ${OPENJDKS} /usr/lib/jvm/java-6-openjdk /usr/lib/jvm/java-6-sun /usr/lib/jvm/java-7-oracle"

# Look for the right JVM to use
for jdir in $JDK_DIRS; do
    if [ -r "$jdir/bin/java" -a -z "${JAVA_HOME}" ]; then
      JAVA_HOME="$jdir"
    fi
done

I commented all of that out (by adding # at the start of each line) and then added this.

JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::")
export JAVA_HOME

Then simply restart tomcat with sudo service tomcat7 restart and a quick check in /var/log/tomcat7/localhost.2017-01-13.log (with your date in) will show if it is working.

1
  • thanks for your great help. i just wanted to do one more thing before I try your recommendation and it got me working in the end. check my solution above! Commented Jan 14, 2017 at 18:56
1

This is what I did in the end.

I uninstalled everything.

First I made sure that java8 is installed over instructions @iant provided belowe in his answer (How to install Oracle Java on Ubuntu 14.04?).

Then I installed Tomcat7 again following this tutorial: http://www.negengec.com/2014/09/run-geoserver-ubuntu-tomcat7/, except line sudo apt-get install default-jdk that I didnt use, plus in the file sudo nano /etc/default/tomcat7 I have changed line with JAVA_HOME to: JAVA_HOME=/usr/lib/jvm/java-8-oracle/jre (https://stackoverflow.com/questions/29052127/how-to-setup-tomcat7-in-ubuntu-14-04-so-that-it-uses-latest-jre-of-java-8-oracle).

Then I have just unzipped Geoserver file war.zip in var/lib/tomcat7/webapps and suddenly thing was working!

I hope I havent forgotten something and also, I hope some of the previous things didnt left behind during unistallation, in that case maybe something else was the cause of making this thing work!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.