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?

Thanks!
Wen

<Resource name="jdbc/labkeyDataSource" auth="Container"
        type="javax.sql.DataSource"
        username="yuw"
        password="myPassword"
        driverClassName="org.postgresql.Driver"
        url="jdbc:postgresql://localhost/labkey"
        maxActive="20"
        maxIdle="10"
        accessToUnderlyingConnectionAllowed="true"
        validationQuery="SELECT 1"
        />


org.labkey.api.util.ConfigurationException: DataSources are not properly configured in labkey.xml.
       at org.labkey.api.module.ModuleLoader.initializeDataSources(ModuleLoader.java:887)
       at org.labkey.api.module.ModuleLoader.doInit(ModuleLoader.java:318)
       at org.labkey.api.module.ModuleLoader.init(ModuleLoader.java:230)
       at java.lang.Thread.run(Thread.java:745)

Caused by: javax.naming.NameNotFoundException: Name [comp/env] is not bound in this Context. Unable to find [comp].
       at org.apache.naming.NamingContext.lookup(NamingContext.java:819)
       at org.apache.naming.NamingContext.lookup(NamingContext.java:167)
       at org.apache.naming.SelectorContext.lookup(SelectorContext.java:156)
       at javax.naming.InitialContext.lookup(InitialContext.java:417)
       at org.labkey.api.module.ModuleLoader.ensureDatabase(ModuleLoader.java:902)
       at org.labkey.api.module.ModuleLoader.initializeDataSources(ModuleLoader.java:864)
 
 
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:
CREATE ROLE yuw PASSWORD 'md58c3221749d1ee4aa85a31a4d4d0428ed' SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN;

-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.


Thanks!
Wen
 
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?
Adam
 
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'

Wen

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"
        type="javax.sql.DataSource"
        username="yuw"
        password="myPassword"
        driverClassName="org.postgresql.Driver"
        url="jdbc:postgresql://localhost/labkey"
        maxActive="20"
        maxIdle="10"
        accessToUnderlyingConnectionAllowed="true"
        validationQuery="SELECT 1"
        />

    <Resource name="mail/Session" auth="Container"
        type="javax.mail.Session"
        mail.smtp.host="localhost"
        mail.smtp.user="admin"
        mail.smtp.port="25"/>

    <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"
        type="org.apache.activemq.ActiveMQConnectionFactory"
        factory="org.apache.activemq.jndi.JNDIReferenceFactory"
        description="JMS Connection Factory"
        brokerURL="vm://localhost?broker.persistent=false&amp;broker.useJmx=false"
        brokerName="LocalActiveMQBroker"/> -->
    <!-- <Resource name="services/NotificationConsumerService/home"
        type="org.globus.wsrf.impl.notification.NotificationConsumerHome"
        factory="org.globus.wsrf.jndi.BeanFactory"
        resourceClass="org.globus.wsrf.impl.NotificationConsumerCallbackManagerImpl"
        resourceKeyName="{http://www.globus.org/namespaces/2004/06/core}NotificationConsumerKey"
        resourceKeyType="java.lang.String" />
    <Resource name="timer/ContainerTimer"
        type="org.globus.wsrf.impl.timer.TimerManagerImpl"
        factory="org.globus.wsrf.jndi.BeanFactory" />
    <Resource name="topic/ContainerTopicExpressionEngine"
        type="org.globus.wsrf.impl.TopicExpressionEngineImpl"
        factory="org.globus.wsrf.jndi.BeanFactory" />
    <Resource name="query/eval/xpath"
        type="org.globus.wsrf.impl.XPathExpressionEvaluator"
        factory="org.globus.wsrf.jndi.BeanFactory" />
    <Resource name="query/ContainerQueryEngine"
        type="org.globus.wsrf.impl.QueryEngineImpl"
        factory="org.globus.wsrf.jndi.BeanFactory" />
    <Resource name="topic/eval/simple"
        type="org.globus.wsrf.impl.SimpleTopicExpressionEvaluator"
        factory="org.globus.wsrf.jndi.BeanFactory" /> -->
</Context>
 
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?

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

Thanks!
Wen
 
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.

Wen
 
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?

Regards,

Jon
 
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.

Thanks!
Wen