Running semanticturkey on startup ?

153 views
Skip to first unread message

Thomas Francart

unread,
May 13, 2016, 6:03:22 AM5/13/16
to vocbench-user
Hello

I am trying to make sure GraphDB, SemanticTurkey and VocBench runs automatically on (Linux) server startup. This works fine for Graphdb, and VocBench is deployed in Tomcat, so no problem here.
I tried to run the following command to run semanticturkey on startup :

sudo /var/lib/semanticturkey/semanticturkey-0.12-2016-01-19/bin/st_server_run &

but i have the following error in ST log, and ST is not started correctly :

May 13, 2016 11:51:55 AM org.apache.karaf.main.SimpleFileLock lock
INFO: locking
2016-05-13 11:52:13,676 | ERROR | Executor: 1      | WebXmlObserver                   | nder.war.internal.WebXmlObserver  168 | 134 - org.ops4j.pax.web.pax-web-extender-war - 1.1.4 | Could not parse web.xml
java.lang.IllegalStateException: Invalid BundleContext.
        at org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:514)[org.apache.felix.framework-4.0.3.jar:]
        at org.apache.felix.framework.BundleContextImpl.createFilter(BundleContextImpl.java:125)[org.apache.felix.framework-4.0.3.jar:]
...


Does anyone can share a procedure to have ST run automatically on startup ? I saw https://groups.google.com/forum/?hl=fr#!searchin/vocbench-user/init.d/vocbench-user/LWpoKY1i5y0/VnuYLoNBF80J has the same question, but does not have an answer.

Many thanks
Thomas

--

Thomas Francart - SPARNA
Web de données | Architecture de l'information | Accès aux connaissances
blog :
blog.sparna.fr, site : sparna.fr, linkedin : fr.linkedin.com/in/thomasfrancart
tel : 
 +33 (0)6.71.11.25.97
, skype : francartthomas

Cristian Romanescu

unread,
May 13, 2016, 7:50:36 AM5/13/16
to vocbench-user

Hi,


I use this script:



#!/bin/sh

#

# semantic_turkey  This shell script takes care of starting and stopping

#               the Semantic Turkey server

#

# chkconfig: 345 96 30

# description: Manage Semantic Turkey service

# processname: java


# Source function library.

. /etc/rc.d/init.d/functions


JAVA_HOME='/usr/java/jdk1.7.0_60/'

PATH=$JAVA_HOME/bin:$PATH

ST_HOME="/opt/semantic-turkey/semanticturkey-0.11"

PIDFILE="/var/run/semantic-turkey.pid"

PROG="Semantic Turkey"

RETVAL=0

USER="java"


cd $ST_HOME/bin


CMD="./st_server_run"


export JAVA_HOME PATH 


start() {

       echo -n "Starting $PROG ..."

su $USER -c "$CMD start > /dev/null 2>&1 &"

       RETVAL=$?

       if [ $RETVAL -eq 0 ]; then

               echo_success

       else

               echo_failure

       fi

}


stop() {

       echo -n "Stopping $PROG ..."

       su $USER -c "$CMD stop > /dev/null 2>&1"

RETVAL=$?

       echo 

if [ $RETVAL = 0 ]; then

echo_success

else

echo_failure

fi

}


case "$1" in

       'start')

               start

               ;;

       'stop')

               stop

               ;;

       *)

       echo "Please supply an argument [start|stop]"

esac



HTH,

Cristian

Thomas Francart

unread,
May 16, 2016, 12:24:08 PM5/16/16
to Cristian Romanescu, vocbench-user
Thanks a lot Cristian.

I have adapted your approach to create a daemon, but unfortunately I still get the same error below on startup in karaf.log. ST runs correctly when I manually launch st_server_run. Looks like karaf cannot find the ST application, or something.
Any idea what I am doing wrong, or what this error can mean ?

Best regards
Thomas

May 16, 2016 6:17:13 PM org.apache.karaf.main.SimpleFileLock lock
INFO: locking
2016-05-16 18:17:18,445 | ERROR | Executor: 1      | WebXmlObserver                   | nder.war.internal.WebXmlObserver  168 | 134 - org.ops4j.pax.web.pax-web-extender-war - 1.1.4 | Could not parse web.xml
java.lang.NullPointerException
        at org.ops4j.pax.web.extender.war.internal.WebXmlObserver.getHeader(WebXmlObserver.java:360)[134:org.ops4j.pax.web.pax-web-extender-war:1.1.4]
        at org.ops4j.pax.web.extender.war.internal.WebXmlObserver.addingEntries(WebXmlObserver.java:158)[134:org.ops4j.pax.web.pax-web-extender-war:1.1.4]
        at org.ops4j.pax.swissbox.extender.BundleWatcher$3.run(BundleWatcher.java:224)[134:org.ops4j.pax.web.pax-web-extender-war:1.1.4]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_91]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_91]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)[:1.8.0_91]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)[:1.8.0_91]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_91]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_91]
        at java.lang.Thread.run(Thread.java:745)[:1.8.0_91]
2016-05-16 18:17:18,458 | ERROR | Executor: 1      | WebEventDispatcher               | .war.internal.WebEventDispatcher  235 | 134 - org.ops4j.pax.web.pax-web-extender-war - 1.1.4 | WebEvent [replay=false, type=5, bundle=it.uniroma2.art.semanticturkey.st-core-services [136], extenderBundle=org.ops4j.pax.web.pax-web-extender-war [134], cause=java.lang.NullPointerException, timestamp=1463415438457, contextPath=/semanticturkey, collisionIds=null]
2016-05-16 18:17:19,604 | ERROR | ExtenderThread-1 | WaiterApplicationContextExecutor | WaiterApplicationContextExecutor  424 | 112 - org.springframework.osgi.extender - 1.2.1 | Unable to create application context for [it.uniroma2.art.semanticturkey.st-core-framework], unsatisfied dependencies: none

java.lang.IllegalStateException: Invalid BundleContext.
        at org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:514)[org.apache.felix.framework-4.0.3.jar:]
        at org.apache.felix.framework.BundleContextImpl.getServiceReferences(BundleContextImpl.java:425)[org.apache.felix.framework-4.0.3.jar:]
        at org.springframework.osgi.util.OsgiServiceReferenceUtils.getServiceReferences(OsgiServiceReferenceUtils.java:159)[111:org.springframework.osgi.core:1.2.1]
        at org.springframework.osgi.util.OsgiServiceReferenceUtils.getServiceReferences(OsgiServiceReferenceUtils.java:195)[111:org.springframework.osgi.core:1.2.1]
        at org.springframework.osgi.util.OsgiServiceReferenceUtils.isServicePresent(OsgiServiceReferenceUtils.java:327)[111:org.springframework.osgi.core:1.2.1]
        at org.springframework.osgi.extender.internal.dependencies.startup.MandatoryServiceDependency.isServicePresent(MandatoryServiceDependency.java:82)[112:org.springframework.osgi.extender:1.2.1]
        at org.springframework.osgi.extender.internal.dependencies.startup.DependencyServiceManager.doFindDependencies(DependencyServiceManager.java:287)[112:org.springframework.osgi.extender:1.2.1]
        at org.springframework.osgi.extender.internal.dependencies.startup.DependencyServiceManager.access$700(DependencyServiceManager.java:40)[112:org.springframework.osgi.extender:1.2.1]
        at org.springframework.osgi.extender.internal.dependencies.startup.DependencyServiceManager$1.run(DependencyServiceManager.java:213)[112:org.springframework.osgi.extender:1.2.1]
        at org.springframework.osgi.extender.internal.util.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:124)[112:org.springframework.osgi.extender:1.2.1]
        at org.springframework.osgi.extender.internal.dependencies.startup.DependencyServiceManager.findServiceDependencies(DependencyServiceManager.java:209)[112:org.springframework.osgi.extender:1.2.1]
        at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplicationContextExecutor.java:239)[112:org.springframework.osgi.extender:1.2.1]
        at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicationContextExecutor.java:169)[112:org.springframework.osgi.extender:1.2.1]
        at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:175)[111:org.springframework.osgi.core:1.2.1]
        at org.springframework.osgi.extender.internal.activator.ContextLoaderListener$2.run(ContextLoaderListener.java:716)[112:org.springframework.osgi.extender:1.2.1]
        at java.lang.Thread.run(Thread.java:745)[:1.8.0_91]







--
You received this message because you are subscribed to the Google Groups "vocbench-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vocbench-use...@googlegroups.com.
Visit this group at https://groups.google.com/group/vocbench-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/vocbench-user/fd687624-300c-483f-99ca-ef37b73539ae%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Armando Stellato

unread,
May 17, 2016, 6:44:23 PM5/17/16
to Thomas Francart, Cristian Romanescu, vocbench-user

Dear Thomas,

 

sorry I’m traveling quite often in these two weeks and it’s hard to follow the list.

I will try to make one step back from where you are now:

Have you read this?

http://karaf.apache.org/manual/latest-2.x/users-guide/start-stop.html

 

the recommended script here for background work is “start”.

 

Pls let us know if it works,

 

Cheers,

 

Armando

 

Da: vocben...@googlegroups.com [mailto:vocben...@googlegroups.com] Per conto di Thomas Francart
Inviato: lunedì 16 maggio 2016 18:24
A: Cristian Romanescu <cristian....@gmail.com>
Cc: vocbench-user <vocben...@googlegroups.com>
Oggetto: Re: [vocbench-user] Re: Running semanticturkey on startup ?

Thomas Francart

unread,
May 18, 2016, 9:49:15 AM5/18/16
to Armando Stellato, Cristian Romanescu, vocbench-user
Hello

Yes, the script works when launching "/bin/start" instead of "/bin/st_server_run". The procedure was as follow :

  1. create /etc/init.d/semanticturkey with the content below;
  2. test the script with "/etc/init.d/semanticserver start"
  3. systemctl daemon-reload (don't know if this is really useful)
  4. add the service to startup services : update-rc.d semanticturkey defaults

Many thanks for your answers

Thomas

#!/bin/sh
#
# semantic_turkey  This shell script takes care of starting and stopping
#               the Semantic Turkey server
#
# chkconfig: 345 96 30
# description: Manage Semantic Turkey service

# processname: Semantic Turkey

JAVA_HOME='/usr/lib/jvm/java-8-openjdk-amd64'
PATH=$JAVA_HOME/bin:$PATH
ST_HOME="/var/lib/semanticturkey/semanticturkey-0.12-2016-01-19"


PIDFILE="/var/run/semantic-turkey.pid"
PROG="Semantic Turkey"
RETVAL=0

USER="root"

cd $ST_HOME/bin

# CMD="./st_server_run"



export JAVA_HOME PATH

start() {
       echo -n "Starting $PROG ..."

       su $USER -c "./start > /dev/null 2>&1 &"


       RETVAL=$?
       if [ $RETVAL -eq 0 ]; then

               echo "Success"
       else
               echo "Failed !"


       fi
}

stop() {
       echo -n "Stopping $PROG ..."

       su $USER -c "./stop > /dev/null 2>&1"


       RETVAL=$?
       echo
       if [ $RETVAL = 0 ]; then

              echo "Success"
       else
              echo "Failed !"


       fi
}

case "$1" in
       'start')
               start
               ;;
       'stop')
               stop
               ;;
       *)
                echo "Please supply an argument [start|stop]"
esac

tellura....@gmail.com

unread,
Jan 26, 2018, 12:56:23 PM1/26/18
to vocbench-user


On Wednesday, 18 May 2016 14:49:15 UTC+1, Thomas Francart wrote:

Yes, the script works when launching "/bin/start" instead of "/bin/st_server_run". The procedure was as follow :

  1. create /etc/init.d/semanticturkey with the content below;
  2. test the script with "/etc/init.d/semanticserver start"
  3. systemctl daemon-reload (don't know if this is really useful)
  4. add the service to startup services : update-rc.d semanticturkey defaults



Hello Thomas,

Thanks for posting that script. It looked like just what I need, but unfortunately when I tried this it just fails silently. I modified the JAVA_HOME, PATH and ST_HOME values to suit my system and put the script into /etc/init.d/, and changed the ownership to root:root. Then I ran line 2 above (actually I ran /etc/init.d/semanticturkey start). I had a success message, but when I did ps aux | grep karaf (or ps aux | grep st_server_run) there is no process running. I looked in semanticturkey-2.0/data/logs/karaf.log and there was nothing to suggest a problem.

Do you have any thoughts on what I am doing wrong? I am running on Debian 9 BTW.

Thanks,


Ian.
-- 

Thomas Francart

unread,
Jan 29, 2018, 3:20:26 AM1/29/18
to tellura....@gmail.com, vocbench-user
Hello

This script was made for VocBench 2, not VocBench 3. For VocBench 3, have you tried the pointer given in this other discussion : https://groups.google.com/forum/#!topic/vocbench-user/Yc5b0srEVdI ?
It worked for me.

Thomas

--
You received this message because you are subscribed to the Google Groups "vocbench-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vocbench-user+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages