Tomcat will not start after deploying sakai from source

1.5k views Asked by At

I've followed the instructions in this URL: http://pmungai.wordpress.com/sakai-developer-guide/sakai-linux-cheatsheet/ and was able to compile and deploy sakai, however, after restarting tomcat, it will show me this:

root@ip-10-72-129-39:/opt/sakai# sh /opt/tomcat/bin/startup.sh
Using CATALINA_BASE:   /opt/tomcat
Using CATALINA_HOME:   /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME:        /usr/lib/jvm/java-1.6.0-openjdk-amd64
Using CLASSPATH:       /opt/tomcat/bin/bootstrap.jar

meaning that tomcat started successfully, but when I try to open the url from a browser, it simply loads forever, waiting for a response. If I try to shutdown tomcat, I get:

root@ip-10-72-129-39:/opt/sakai# sh /opt/tomcat/bin/shutdown.sh
Using CATALINA_BASE:   /opt/tomcat
Using CATALINA_HOME:   /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME:        /usr/lib/jvm/java-1.6.0-openjdk-amd64
Using CLASSPATH:       /opt/tomcat/bin/bootstrap.jar
2012-05-24 15:26:34,357 ERROR main org.apache.catalina.startup.Catalina - Catalina.stop:
java.net.ConnectException: Connection refused
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:327)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:193)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:180)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384)
        at java.net.Socket.connect(Socket.java:546)
        at java.net.Socket.connect(Socket.java:495)
        at java.net.Socket.<init>(Socket.java:392)
        at java.net.Socket.<init>(Socket.java:206)
        at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:395)
        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.stopServer(Bootstrap.java:344)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:435)

Which happens when tomcat wasn't running to begin with. I was able to test that tomcat was running exactly before deploying sakai, and right after, it wasn't able to load a web page.

Does anyone know what is going on?

2

There are 2 answers

0
NullByte On

In my experience this is usually database related. Are you using the out-of-the-box hsqldb or MySQL? After compiling and deploying with Maven into your tomcat directory when you first startup Tomcat it has to auto-create a bunch of tables. In many cases this can fail for a few reasons.

I will assume you are using MySQL as hsqldb has very few issues:

  • Sometimes the initial tomcat launch can shutdown your mysqlservice and not allow it to start back up again. This is usually due to it being unable to create error log files in the locations specified in your my.cnf file. Try commenting out any instances where these logs are being used and restart the service. Then retry the launch.

  • On Linux use "# ./catalina.sh run" instead of invoking the startup shell script. This will spawn a 2nd terminal window and show you everything that's happening (including any errors) while Tomcat is attempting to launch.

  • See if any tables were made in your database. If not then its a database connection issue. If so you should have around 377 tables or so depending on the Sakai version.

  • If you are getting "cache is not alive" errors in your tomcat logs this is a known race condition. You may need to disable the table auto-creation (assuming the tables have already been made from previous launch trials) and apply the patch outlined here:

KNL-1290

Without having error messages to work with it's difficult to diagnose your problem.

0
Bogdan Emil Mariesan On

Before starting a sakai development environment i'd sugges trying the sakai 2.8.x demo, it will provide an internal database and have some most of the standard functionalities.

You should download the demo project from: https://testdrivesakai.com/portal

After you get used to the flows, configurations etc. you should set up your own instance with your own sakai schema. But when you do so also make sure you have at least some minimum hardware settings available and also the following tomcat startup arguments in place:

-Xms512m
-Xmx1024m
-XX:PermSize=128m
-XX:MaxPermSize=256m
-XX:NewSize=192m
-XX:MaxNewSize=384m
-Djava.awt.headless=true
-Dhttp.agent=Sakai
-Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false
-Dsun.lang.ClassLoader.allowArraySyntax=true

Also make sure you join the sakai-dev mailing list as you will get faster support by posting problems there.

The link to join the sakai dev-list: http://collab.sakaiproject.org/mailman/listinfo/sakai-dev