Manual installation, CentOS 6.5, Postresql. Failed to start up

Installation Forum (Inactive)
Manual installation, CentOS 6.5, Postresql. Failed to start up yuw  2015-09-25 19:34
Status: Closed
There seems to be a problem with my labkey.xml setup. The admin account 'yuw' for Postgresql was setup to be the same as the login account on my CentOS acct.

Any clue?


<Resource name="jdbc/labkeyDataSource" auth="Container"
        validationQuery="SELECT 1"

org.labkey.api.util.ConfigurationException: DataSources are not properly configured in labkey.xml.
       at org.labkey.api.module.ModuleLoader.initializeDataSources(
       at org.labkey.api.module.ModuleLoader.doInit(
       at org.labkey.api.module.ModuleLoader.init(

Caused by: javax.naming.NameNotFoundException: Name [comp/env] is not bound in this Context. Unable to find [comp].
       at org.apache.naming.NamingContext.lookup(
       at org.apache.naming.NamingContext.lookup(
       at org.apache.naming.SelectorContext.lookup(
       at javax.naming.InitialContext.lookup(
       at org.labkey.api.module.ModuleLoader.ensureDatabase(
       at org.labkey.api.module.ModuleLoader.initializeDataSources(
yuw responded:  2015-09-26 04:12
A bit more details about my setup:

1. This is a fresh install on a CentOS 6.5 VM.
2. All 3rd party components are the most recent stable version according to LabKey instruction. i.e. Java 8, tomcat 7, Postgresql 9.4.4
3. 'yuw' is my login account where I have the sudo privilege. The acct (role) was added to PostgreSQL as follow.

# add a new superuser 'yuw'
-bash-4.1$ createuser -s -P -e yuw
Enter password for new role:
Enter it again:

-bash-4.1$ psql -c "\du"
                             List of roles
 Role name | Attributes | Member of
 yuw | Superuser, Create role, Create DB | {}
 postgres | Superuser, Create role, Create DB, Replication | {}

5. From the tomcat 7 manager page, I started the labkey servlet and click on the labkey url. The error page came up right away during its initialization process.

adam responded:  2015-09-26 08:19
I've never seen this error before. It looks like a Tomcat JNDI problem (not directly related to PostgreSQL, Java, or OS versions). The code that's failing is the JNDI lookup in the second line below:

InitialContext ctx = new InitialContext();
Context envCtx = (Context) ctx.lookup("java:comp/env");

This code matches the approach recommended by the Tomcat JNDI instructions ("4. Accessing the datasource" section). Their example uses "java:/comp/env" not "java:comp/env"… but I'd be surprised if that's the problem.

A few questions:

  • What specific version of Tomcat 7 are you running? Most recent is 7.0.64, for example.
  • Can you post or attach your full labkey.xml file?
  • Where is labkey.xml located?
  • Do other webapps run correctly on this Tomcat installation?
  • Are you configured to debug the LabKey Server code?
jeckels responded:  2015-09-26 12:42
I have one more question to add to Adam's list:

How did you install Tomcat? Via the package manager for CentOS, or by downloading the distribution from the Tomcat web site?

Thanks, Josh

yuw responded:  2015-09-26 16:13
Thanks for the responses! I don't have the setup for debugging yet, though that's the whole reason I'm going through the Linux setup.

1. Tomcat version is 7.0.64. I've only tried the demo servlet come with the installation. They work just fine.
2. The labkey.xml is located in '/usr/local/tomcat/conf/Catalina/localhost' folder.
3. The Tomcat server was installed by copying the distribution from Tomcat web site to '/usr/local/apache-tomcat-7.0.64' and setup a symbolic link as '/usr/local/tomcat'


My copy of the labkey.xml

<?xml version='1.0' encoding='utf-8'?>
<Context docBase="/usr/local/labkey/labkeywebapp" debug="0" reloadable="true" crossContext="true">

    <Resource name="jdbc/labkeyDataSource" auth="Container"
        validationQuery="SELECT 1"

    <Resource name="mail/Session" auth="Container"

    <Loader loaderClass="org.labkey.bootstrap.LabkeyServerBootstrapClassLoader" useSystemClassLoaderAsParent="false" />

    <!-- Encryption key for encrypted property store -->
    <Parameter name="MasterEncryptionKey" value="@@masterEncryptionKey@@" />

    <!-- mzML support via JNI -->
        <Parameter name="org.labkey.api.ms2.mzmlLibrary" value="pwiz_swigbindings"></Parameter>

    <!-- Track installations from Windows Installer -->
    <!--@@installer@@ <Parameter name="org.labkey.api.util.mothershipreport.usedInstaller" value="true"/> @@installer@@-->

    <!-- Pipeline configuration -->
    <!--@@pipeline@@ <Parameter name="org.labkey.api.pipeline.config" value="@@pipelineConfigPath@@"/> @@pipeline@@-->

    <!-- brokerURL="tcp://localhost:61616" userName="username" password="password" -->
    <!-- <Resource name="jms/ConnectionFactory" auth="Container"
        description="JMS Connection Factory"
        brokerName="LocalActiveMQBroker"/> -->
    <!-- <Resource name="services/NotificationConsumerService/home"
        resourceKeyType="java.lang.String" />
    <Resource name="timer/ContainerTimer"
        factory="org.globus.wsrf.jndi.BeanFactory" />
    <Resource name="topic/ContainerTopicExpressionEngine"
        factory="org.globus.wsrf.jndi.BeanFactory" />
    <Resource name="query/eval/xpath"
        factory="org.globus.wsrf.jndi.BeanFactory" />
    <Resource name="query/ContainerQueryEngine"
        factory="org.globus.wsrf.jndi.BeanFactory" />
    <Resource name="topic/eval/simple"
        factory="org.globus.wsrf.jndi.BeanFactory" /> -->
adam responded:  2015-09-27 17:56
Everything you've listed looks completely reasonable. I just installed 7.0.64 and deployed your labkey.xml (adjusting docbase and credentials) locally, and the server started up and worked fine. Unfortunately.

Could you post your full labkey.log, just in case there's an additional clue in there somewhere?

yuw responded:  2015-09-27 18:02
Hi, where can I find the labkey.log? /usr/local/tomcat/logs/ contains only Tomcat related logs.

yuw responded:  2015-09-27 19:09
LabKey logs are stored in CATALINA_HOME/logs
– Logs files are labkey.log and labkey-errors.log
Tomcat logs stored in CATALINA_HOME/logs

I don't see either labkey.log or labkey-errors.log in my CATALINA_HOME/logs folder. Since the error occurred during the servlet initialization, the logs may not have a chance to get created.

Jon (LabKey DevOps) responded:  2015-09-28 10:54
Hi Wen,

Just curious, but are you running LabKey via the binaries or are you running it as source through something like IntelliJ or Eclipse?

Based on what I've found online, this problem seems to be tied to the Context.xml and Web.xml files that live in your Tomcat directory, specifically under CATALINA_HOME/conf

Were there any changes you made to either of these files prior to starting LabKey where you saw the error?


yuw responded:  2015-09-28 11:38
It's downloaded from LabKey as binary package. The Tomcat7 is a fresh install without any change to the files in 'conf' folder except for tomcat-user.xml to allow for manager-gui access.

I'll try to load the source in my IDEA and run it from there. I'm just afraid that might be another can of worm. My colleague had pretty good luck with Windows installer though.