Tomcat will not start after deploying sakai from source - maven-2

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?

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

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.

Related

JavaMelody error - Monitoring of sql requests and of jdbc connections in GlassFish v4.1

I want to use JavaMelody to monitor the SQL requested by a Glassfish Application Server. There are step-by-step instructions on https://github.com/javamelody/javamelody/wiki/UserGuideAdvanced#monitoring-of-sql-requests-and-of-jdbc-connections-in-glassfish-v3
I followed the instructions (I didn't download javamelody-objectfactory.jar but used javamelody-core-1.54.0.jar instead) and I get this error when clicking on the refresh button (javamelody web page) :
server.log :
exception while collecting data
java.lang.NoClassDefFoundError: org/jrobin/core/RrdException
at net.bull.javamelody.Collector.getCounterJRobin(Collector.java:836)
at net.bull.javamelody.Collector.collectJRobinValues(Collector.java:489)
...
any idea how to resolve this ?
jrobin-1.5.9.1.jar is installed in the lib folder of glassfish (and in my ear project).
thanks !
javamelody-objectfactory.jar (java source included in the jar) and javamelody-core jar file are absolutely different things. The first is to make the datasource monitorable in Glassfish and the second is the monitoring tool itself.
First fix the exception. You should probably put javamelody-core jar and jrobin jar files in your ear project (and not one in lib folder of Glassfish and one in ear).
Then if the monitoring reports don't include SQL monitoring for the datasource declared in Glassfish, use the javamelody-objectfactory.jar including all steps as said in the doc.

Starting Zookeeper Cluster. Error: Could not find or load main class org.apache.zookeeper.server.quorum.QuorumPeerMain

(I'm running on CentOS 5.8). I've been following the direction for a Clustered (Multiserver) Zookeeper Set-up, but getting an error when I try to start up my server. When I run the command as described in the documentation:
java -cp zookeeper-3.4.6.jar:lib/log4j-1.2.16.jar:conf \ org.apache.zookeeper.server.quorum.QuorumPeerMain conf/zoo.cfg
I get the error:
Error: Could not find or load main class org.apache.zookeeper.server.quorum.QuorumPeerMain
I have my files location as such and am running from the ~/zookeeper-3.4.6 directory:
~/zookeeper-3.4.6/zookeeper-3.4.6.jar
~/zookeeper-3.4.6/conf/zoo.cfg
~/zookeeper-3.4.6/data/myid
~/zookeeper-3.4.6/lib/log4j-1.2.16.jar
~/zookeeper-3.4.6/bin/zkServer.sh
Does anyone know why this error is happening? I don't quite understand the arguments that are being passed, so it is hard for me to debug the path issue. As a side note, I've tried running ./zookeeper-3.4.6/bin/zkServer.sh start, which did successfully work, but the documentation seems to indicate that command is meant for a single-node instance.
Edit:
I was able to make some progress by modifying the command and taking out the :conf \ part, so now I'm running:
java -cp zookeeper-3.4.6.jar:lib/log4j-1.2.16.jar: org.apache.zookeeper.server.quorum.QuorumPeerMain conf/zoo.cfg
I get a new error, but this is progress...
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFacto
ry
at org.apache.zookeeper.server.quorum.QuorumPeerMain.<clinit>(QuorumPeer
Main.java:64)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 1 more
which corresponds to lines 63 and 64 from QuorumPeerMain
public class QuorumPeerMain {
private static final Logger LOG = LoggerFactory.getLogger(QuorumPeerMain.class);
I got the Error: Could not find or load main class org.apache.zookeeper.server.quorum.QuorumPeerMain, because I had downloaded the apache-zookeeper-X.X.X.tar.gz file and not the apache-zookeeper-X.X.X.bin.tar.gz file. Downloading, untarring and using the bin.tar file fixed it for me.
You can also build the binaries from the apache-zookeeper-X.X.X.tar.gz file; see the answer of #vincent.
This happens when you download and used apache-zookeeper-X.X.X.tar.gz, you should use apache-zookeeper-X.X.X-bin.tar.gz. this will surely solve this issue
The issue can be solved by untaring apache-zookeeper-3.5.6-bin.tar.gz. Initially, I encountered the same error while untared/installed apache-zookeeper-3.5.6.tar.gz and executed /bin/zkServer.sh start
Please make sure you have downloaded apache-zookeeper-3.5.6-bin.tar.gz
I got the same errors. I solved the error by check the README.md file in apache-zookeeper-[version].tar.gz Just type:
mvn clean install -DskipTests
then start the zookeeper. You will solve the error, too.
You should be able to run zkServer.sh to get a clustered setup. It will use the same conf/zoo.cfg that you are providing manually, which will contain the cluster endpoints.
The best way to check what you are missing from your classpath (and see the proper java command) is to run the zkServer.sh you said worked for you.
When it starts up, check the actual command used like this:
ps -ef | grep zookeeper
I also get this error when try to run Apache Zookeper v3.5.5 on Windows:
Error: Could not find or load main class org.apache.zookeeper.server.quorum.QuorumPeerMain
As said by #Onnonymous, I finish my problem by downloading the .bin.tar.gz (here) instead of .tar.gz version.
I am using apache-zookeeper-3.8.0-bin.tar.gz (Ubuntu 20.04)
This has all the necessary files to successfully start the zookeeper process.
specifying the other nodes in zoo.cfg file and starting the zookeeper automatically adds other nodes and starts the election process.
digital ocean has a good setup guide here setup zookeeper cluster
here's the zoo.cfg for reference
tickTime=2000
dataDir=/data/zookeeper
clientPort=2181
maxClientCnxns=60
initLimit=10
syncLimit=5
server.1=server1hostname/ip:2888:3888
server.2=server1hostname/ip:2888:3888
server.3=server1hostname/ip:2888:3888

How to define MySQL data source in TomEE?

Platform: TomEE Web profile 1.5.0.
I am trying to do a very basic thing, setup a data source for MySQL. I have read the official guide (http://openejb.apache.org/configuring-datasources.html). It asks us to enter a Resource element in openejb.xml. I can not find that file anywhere in tomee-webprofile-1.5.0. I read in other places that I could use tomee.xml for the same purpose. So, I added this to my conf/tomee.xml.
<Resource id="TestDS" type="DataSource">
JdbcDriver com.mysql.jdbc.Driver
JdbcUrl jdbc:mysql://localhost/test
UserName root
Password some_pass
</Resource>
I copied MySQL driver JAR to tomee/lib folder.
I wrote this code. Showing snippets here:
#Resource(name="TestDS")
DataSource ds;
Connection con = ds.getConnection();
PreparedStatement ps = con.prepareStatement("select * from UserProfile");
The prepareStatement() call is throwing this exception:
java.sql.SQLSyntaxErrorException: user lacks privilege or object not found: USERPROFILE
at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
Why is the system using hsqldb driver? In fact, no matter what is use as name for #Resource, I get the same exception.
What am I doing wrong? I am starting TomEE from Eclipse, if that makes any difference.
I have tracked down the root cause. The problem happens only when I start TomEE from Eclipse. If I start it from command line, my data source definition works just fine.
It appears that when I run TomEE from command line, it uses configuration files from /.metadata/.plugins/org.eclipse.wst.server.core/tmp0/conf. To change this, I had to take these steps in Eclipse:
Remove all deployed projects from the server.
Open server settings and from "Server Locations" choose "Use Tomcat installation". This section is greyed out if you have at least one project still deployed to the server. So, make sure you have done step #1.
Restart the server and redeploy the application. Now, my application is finding the data source.
normally the installation is explained here http://tomee.apache.org/tomee-and-eclipse.html
[I would make this a comment to the answer of RajV, but do not have enough reputation to do so.]
Platform: Tomee 1.6.0 Webprofile, eclipse-jee-kepler-SR2-linux-gtk-x86_64 and OpenJDK 1.7.0_51
After doing the steps in http://tomee.apache.org/tomee-and-eclipse.html (including "Workspace Metadata Installation") I got the same error "user lacks privilege or object not found".
My reaction was to:
$ ln -s [workspace_path]/Servers/tomee.xml \
[workspace_path]/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/conf/
As an advantage of this solution TomEE in eclipse is always using the current version of Workspace/Servers/tomee.xml without any further manual operation.
For me, better solution is to put tomee.xml file in your wpt server directory (/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/conf) and define your datasource there.

Run adt (Adobe's AIR developer tool) from SSH

Attempting to run adt from an SSH session results in:
Exception in thread "main" java.lang.InternalError: Can't connect to window server - not enough permissions.
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1827)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1724)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1045)
at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:50)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Toolkit.loadLibraries(Toolkit.java:1605)
at java.awt.Toolkit.<clinit>(Toolkit.java:1627)
at java.awt.Dimension.<clinit>(Dimension.java:70)
...
Normally this can be fixed by passing -Djava.awt.headless=true to java. However, adt spawns other java processes without this argument, so this solution doesn't work.
I was able to hack my way around by replacing /usr/bin/java with a shell script containing:
java.old -Djava.awt.headless=true "$#"
However, this affects all java processes running on this box, causing many other issues. There has to be a better way...
I just noticed there's an extremely simple work-around. I tested this on OS X, and although not exactly a solution, might be good enough. Just ensure that the user trying to adt over ssh has an open console session and adt will run fine.
The only work arounds you tend to find are making the your Jenkins user an actual user on OSX.
I have been having to rely on setting up Jenkins as a normal user on my OSX build box. Even utilizing the Xvfb Jenkins plug-in does not help the problem. It's extremely frustrating.
There is a rather unhelpful thread from Adobe here:
http://forums.adobe.com/message/4162406
There is another thread here for wrapping part of the job in a shell script:
https://groups.google.com/forum/?fromgroups=#!topic/fluint-discussions/tL6AEWKgDfw

Selenium Grid - remote control connections to hub - fail to register, but build successfully

I've successfully run a Selenium Grid on my local machine, and I've moved it to a server (windows Server 2008 R2).
The server instance has run successfully with locally launched agents
The server hosted console is visible over the internet
However, when I create a new remote control on a different machine, they build successfully but they do not register with the hub.
The command line is:
ant -Dport=6601 -Dhost=<ip address of my box> -DhubURL=http://ab.cdefg.ca:4444/wd/hub* -Denvironment"firefox" launch-remote-control
I've also used my hostname as a replacement for my ip name (pc78.subdomain.domain.ca)
If I do not specify the Denvironment, I get the following back:
C:\Sgrid\selenium-grid-1.0.8>ant -Dport=6601 -Dhost=pcname.subdomain.domain.ca -Dhu
bURL=http://ab.cdefg.ca:4444/wd/hub* launch-remote-control
Buildfile: C:\Sgrid\selenium-grid-1.0.8\build.xml
launch-remote-control:
[java] Sep 15, 2011 3:37:11 PM com.thoughtworks.selenium.grid.remotecontrol
.RegistrationRequest execute
[java] INFO: Registering to http://ab.cdefg.ca.ca:4444/wd/hub*/registration
-manager/register
[java] Exception in thread "main" java.lang.IllegalStateException: Could no
t register successfuly to http://ab.cdefg.ca.ca:4444/wd/hub*/registration-manage
r/register with environment '*firefox'. Most likely this environment is not defi
ned on the hub.
[java] at com.thoughtworks.selenium.grid.remotecontrol.RegistrationRequ
est.execute(RegistrationRequest.java:29)
[java] at com.thoughtworks.selenium.grid.remotecontrol.SelfRegisteringR
emoteControl.register(SelfRegisteringRemoteControl.java:29)
[java] at com.thoughtworks.selenium.grid.remotecontrol.SelfRegisteringR
emoteControlLauncher.main(SelfRegisteringRemoteControlLauncher.java:27)
BUILD FAILED
C:\Sgrid\selenium-grid-1.0.8\build.xml:90: Java returned: 1
Total time: 1 second
If do specify the Denvironment, I get the following back:
C:\Sgrid\selenium-grid-1.0.8>ant -Dport=6601 -Dhost=pcname.sub.domain.ca -Dhu
bURL=http://ab.cdefg.ca:4444 -Denvironment"firefox" launch-remote-control
Buildfile: C:\Sgrid\selenium-grid-1.0.8\build.xml
BUILD SUCCESSFUL
Total time: 0 seconds
C:\Sgrid\selenium-grid-1.0.8>
However, the console does not recognize or utilize this agent. Nor is this agent visible on http://localhost:4444/console
So I thought, I'll reverse it and use my local as a server and try and register the server as a remote control, but the same problem repeated itself, command line success, but functionally no activity. Sounds like a network problem, so I booted up a third machine, installed and tested selenium grid (works). Console is visible from my laptop, running on my desktop, via ipaddress:4444/console.
I then launched a remote control, had the same problem. Okay, I then turn off the firewall on my local desktop (treating it as my server) and my laptop (treating it as a remote). Same problem.
Finally, thinking maybe the existence of a local console is messing with the remote launch, I reboot and run only the following:
ant -Dport=6601 -Dhost=<laptop ip> -DhubURL=http://<desktop ip>:4444 -Denvironment"firefox" launch-remote-control
Same problem.
Also I can ping the server from my desktop
Is there a setting I'm missing? It seems like everything in each instance is okay, and all of them have the same versions installed. Clearly something isn't getting from one place to the other, but I have no idea how to work around it when everything else seems okay. Many thanks.
You need an "=" after the environment. I.e., -Denvironment="firefox".
ant -Dport=6666 -Dhost=pc78.subdomain.domain.ca -DhubURL=http://ab.cdef.ca:4444 launch-remote-control
Thanks for the kick start - dropping the "/wd/hub*" from the DhubURL and dropping the Denvironment all together actually got me working - thanks for the response. I