Oracle DB not listed when run as Service on Centos

Hi,

I followed step by step guide to run metabase with oracle.

Metabase Directory Structure

[bkmetabase@BK01 MetaBase]$ pwd
/home/bkmetabase/MetaBase
[bkmetabase@BK01 MetaBase]$ ll
total 119488
-rw-rw-r-- 1 bkmetabase bkmetabase      3975 Jun  28 07:52 logger_metabase.log
-rw-rw-r-- 1 bkmetabase bkmetabase   7503872 Jun  28 07:52 metabase.db.mv.db
-rw-rw-r-- 1 bkmetabase bkmetabase       187 Jun  28 12:12 metabase.db.trace.db
-rw-rw-r-- 1 bkmetabase bkmetabase 114839203 Jun  28 13:10 metabase.jar
drwxrwxr-x 2 bkmetabase bkmetabase      4096 Jun  28 12:05 plugins
[bkmetabase@BK01 MetaBase]$ cd plugins/
[bkmetabase@BK01 MetaBase]$ ll
total 3320
-rw-rw-r-- 1 bkmetabase bkmetabase 3397734 Jun  28 17:13 ojdbc7.jar

Service when started is working with H2 Database as well as MySQL database but not working with oracle.

Below is Oracle Database Details

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
"CORE	11.2.0.4.0	Production"
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production

Below is Service Creation (/etc/init.d/metabse)

SERVICE_NAME=Metabase
METABASE_DIR=/home/bkmetabase/MetaBase
METABASE_JAR=$METABASE_DIR/metabase.jar
METABASE_PORT=6767
METABASE_DB=$METABASE_DIR/metabase.db
METABASE_PID=$METABASE_DIR/metabase-pid

JAVA_PATH=/home/bkmetabase/jdk1.8.0_171/bin/java

start() {
    echo -n $"Starting $SERVICE_NAME ... "
    if [ ! -f $METABASE_PID ]; then
        MB_JETTY_PORT=$METABASE_PORT MB_DB_FILE=$METABASE_DB nohup $JAVA_PATH -jar $METABASE_JAR >> $METABASE_DIR/log_service.out 2>&1 &
        echo $! > $METABASE_PID
        echo "Started $SERVICE_NAME."
    else
        echo "$SERVICE_NAME already running."
    fi
}![Capture|690x305](upload://prQbzNTqX1z401gZZpmICbzHs07.PNG)![Capture2|689x305](upload://59BE5Ov6vydsQWlX5CwS4oRx9gA.PNG)![Capture3|690x314](upload://x9vUBuigWsSqEv7F4f3USWY8SbB.PNG)

Can you get it running from the shell as the bkmetabase user from /home/bkmetabase/MetaBase?

The log during startup should reveal if the Oracle JDBC driver is found in the plugins dir

Yes, when run from terminal as direct java -jar commaond it works and loading plugin directory as well.

[bkmetabase@BK01 MetaBase]$ /home/bkmetabase/jdk1.8.0_171/bin/java -jar metabase.jar > logger_metabase.log
06-29 08:10:16 INFO metabase.util :: Loading Metabase...
06-29 08:10:19 INFO util.encryption :: DB details encryption is ENABLED for this Metabase instance.  
See http://www.metabase.com/docs/latest/operations-guide/start.html#encrypting-your-database-connection-details-at-rest for more information.
06-29 08:10:23 INFO metabase.core :: Starting Metabase in STANDALONE mode
06-29 08:10:23 INFO metabase.core :: Launching Embedded Jetty Webserver with config:
 {:port 3000}

06-29 08:10:23 INFO metabase.core :: Starting Metabase version v0.29.3 (0de4585 release-0.29.3) ...
06-29 08:10:23 INFO metabase.core :: System timezone is 'Africa' ...
06-29 08:10:23 INFO metabase.plugins :: Loading plugins in directory /home/bkmetabase/MetaBase/plugins/plugins...
06-29 08:10:23 INFO metabase.plugins :: Loading plugin /home/bkmetabase/MetaBase/plugins/ojdbc7.jar... 
06-29 08:10:25 INFO metabase.core :: Setting up and migrating Metabase DB. Please sit tight, this may take a minute...
06-29 08:10:25 INFO metabase.db :: Verifying h2 Database Connection ...
06-29 08:10:25 INFO metabase.db :: Verify Database Connection ...  ✅
06-29 08:10:25 INFO metabase.db :: Running Database Migrations...
06-29 08:10:25 INFO metabase.db :: Setting up Liquibase...
06-29 08:10:25 INFO metabase.db :: Liquibase is ready.
06-29 08:10:25 INFO metabase.db :: Checking if Database has unrun migrations...
06-29 08:10:27 INFO metabase.db :: Database Migrations Current ...  ✅
06-29 08:10:27 INFO db.migrations :: Running all necessary data migrations, this may take a minute.
06-29 08:10:27 INFO db.migrations :: Finished running data migrations.
06-29 08:10:27 INFO metabase.events :: Starting events listener: metabase.events.notifications 
06-29 08:10:27 INFO metabase.events :: Starting events listener: metabase.events.metabot-lifecycle 
06-29 08:10:27 INFO metabase.events :: Starting events listener: metabase.events.dependencies 
06-29 08:10:27 INFO metabase.events :: Starting events listener: metabase.events.activity-feed 
06-29 08:10:27 INFO metabase.events :: Starting events listener: metabase.events.last-login 
06-29 08:10:27 INFO metabase.events :: Starting events listener: metabase.events.revision 
06-29 08:10:27 INFO metabase.events :: Starting events listener: metabase.events.sync-database 
06-29 08:10:27 INFO metabase.events :: Starting events listener: metabase.events.view-log 
06-29 08:10:27 INFO metabase.events :: Starting events listener: metabase.events.driver-notifications 
06-29 08:10:27 INFO metabase.task :: Loading tasks namespace: metabase.task.send-anonymous-stats 
06-29 08:10:27 INFO metabase.task :: Loading tasks namespace: metabase.task.sync-databases 
06-29 08:10:27 INFO metabase.task :: Loading tasks namespace: metabase.task.cleanup-temporary-computation-job-results 
06-29 08:10:27 INFO metabase.task :: Loading tasks namespace: metabase.task.upgrade-checks 
06-29 08:10:27 INFO metabase.task :: Loading tasks namespace: metabase.task.follow-up-emails 
06-29 08:10:27 INFO metabase.task :: Loading tasks namespace: metabase.task.send-pulses 
06-29 08:10:27 INFO metabase.core :: Metabase Initialization COMPLETE

Though i am getting below error as well in logs

com.mchange.v2.cfg.DelayedLogItem [ level -> FINE, text -> "The configuration file for resource identifier 'hocon:/reference,/application,/c3p0,/' could not be found. Skipping.", exception -> null]

Great! Sounds like we’re narrowing down the problem.

In your service creation script try setting MB_PLUGINS_DIR mentioned in the Oracle section of the admin guide.

I have added MB_PLUGINS_DIR into .bash_profile for user bkmetabase and tried running the service but it still doesn't list Oracle as Database

[bkmetabase@BK01 MetaBase]$ echo $MB_PLUGINS_DIR
/home/bkmetabase/MetaBase/plugins

Also i added in service creation script
SERVICE_NAME=Metabase
METABASE_DIR=/home/bkmetabase/MetaBase
MB_PLUGINS_DIR=/home/ghmetabase/mymeta/plugins
METABASE_JAR=$METABASE_DIR/metabase.jar
METABASE_PORT=6767
METABASE_DB=$METABASE_DIR/metabase.db
METABASE_PID=$METABASE_DIR/metabase-pid

image

Re-reading here I’m wondering if you have specified anywhere what user the service us running as?

For Centos (with a systemd style init script) it looks like you can specify User=xxx:

The problem you have here is definitely not a Metabase bug - but merely a Centos service configuration issue because it’s running fine when you run it interactively.

Thanks for your feedback, Currently i am running the service as root user and Metabase is starting the only issue i am facing is its unable to detect the Plugin Directory which is not the case when run from terminal.

Facing the same issue.
Any suggestions on I can get plugins working with service?