2

I recently tried to create a script to check if my geoserver was running and if not, restart tomcat so that it was running. I placed the script into the cron.hourly folder, however the script was not updating the log file that I created. My geoserver now will not start back up and I am getting a java.Nullpointerexception when I try to do the shutdown command. The script looked like this:

#!/bin/bash
STAT=`netstat -na | grep 8765 | awk '{print $7}'`
if [ "$STAT" = "LISTEN" ]; then
cd /home/blair
date >> practice-log.txt
echo "DEFAULT TOMCAT PORT IS LISTENING, SO ITS OK" >> practice-log.txt
elif [ "$STAT" = "" ]; then
cd /home/blair/
date >> practice-log.txt
echo "8765 PORT IS NOT IN USE SO TOMCAT IS NOT WORKING" >> practice-log.txt

############################################################################
cd /opt/apache-tomcat-7.0.52/bin
sudo ./shutdown.sh
sudo ./startup.sh
fi
RESULT=`netstat -na | grep 8765 | awk '{print $7}' | wc -l`
if [ "$RESULT" = 0 ]; then
cd /home/blair/
echo "TOMCAT PORT STILL NOT LISTENING" >> practice-log.txt
elif [ "$RESULT" != 0 ]; then
cd /home/blair/
echo "TOMCAT PORT IS LISTENINS AND SO TOMCAT WORKING" >> practice-log.txt
fi

It is now impossible for me to finish the shutdown command without getting an error message of:

java.lang.NullPointerException at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:494) 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:622) at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:370) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:457)

I could really use some help to get this back and running. Also when trying to start the geoserver using the tomcat webapp manager on the html page I get the FAIL - Application at context path /geoserver could not be started error message. If anyone has any suggestions they would be extremely useful.

Also I am running tomcat 7 on apache 2 on an ubuntu server.

closed as off-topic by Midavalo, PolyGeo Sep 21 '16 at 8:39

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions relating to general Information Technology, with no clear GIS component, are off-topic here, but can be researched/asked at Stack Overflow (software development), Super User (computing hardware and software) and Database Administrators (relational databases)" – Midavalo, PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.