AnsweredAssumed Answered

Alfresco 3.2 as a Unix Daemon

Question asked by garcimouche on Aug 5, 2009
Latest reply on Dec 1, 2012 by scottcarson
Hi there,

I can't have Alfresco 3.2 CE running properly as a Unix Daemon under RHEL 5.
I followed the steps to build the jsvc tool as described here : http://tomcat.apache.org/tomcat-6.0-doc/setup.html#Unix%20daemon .
I've created the following script that I correctly register using chkconfig shell command.

#!/bin/sh
# alsfresco    Startup script for the Alfresco ECM
#
# chkconfig: - 99 15
# description: Alfresco CM Software (Embedded Tomcat) for FTNC
# pidfile: /var/run/jsvc.pid
##############################################################################
#
#   Copyright 2004 The Apache Software Foundation.
#
#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.
##############################################################################
#
# Small shell script to show how to start/stop Tomcat using jsvc
# If you want to have Tomcat running on port 80 please modify the server.xml
# file:
#
#    <!– Define a non-SSL HTTP/1.1 Connector on port 80 –>
#    <Connector className="org.apache.catalina.connector.http.HttpConnector"
#               port="80" minProcessors="5" maxProcessors="75"
#               enableLookups="true" redirectPort="8443"
#               acceptCount="10" debug="0" connectionTimeout="60000"/>
#
# That is for Tomcat-5.0.x (Apache Tomcat/5.0)
#
# Adapt the following lines to your configuration

ALF_HOME=/usr/alfresco

JAVA_HOME=/usr/java/jdk1.6.0_14
APPSERVER="${ALF_HOME}/tomcat"
CATALINA_HOME="${APPSERVER}"
DAEMON_HOME="${CATALINA_HOME}/bin"

# Set the default -Djava.endorsed.dirs argument
JAVA_ENDORSED_DIRS="$APPSERVER"/endorsed

# for multi instances adapt those lines.
TMP_DIR=/var/tmp
PID_FILE=/var/run/jsvc.pid
CATALINA_BASE="${APPSERVER}"

#CATALINA_OPTS="-Djava.library.path=/home/jfclere/jakarta-tomcat-connectors/jni/native/.libs"

# Set any default JVM values
export JAVA_OPTS='-Xms128m -Xmx512m -XX:MaxPermSize=128m'
export JAVA_OPTS="${JAVA_OPTS} -Dalfresco.home=${ALF_HOME} -Dcom.sun.management.jmxremote"
# Following only needed for Sun JVMs before to 1.5 update 8
export JAVA_OPTS="${JAVA_OPTS} -XX:CompileCommand=exclude,org/apache/lucene/index/IndexReader\$1,doBody -XX:CompileCommand=exclude,org/alfresco/repo/search/impl/lucene/index/IndexInfo\$Merger,mergeIndexes -XX:CompileCommand=exclude,org/alfresco/repo/search/impl/lucene/index/IndexInfo\$Merger,mergeDeletions"


CLASSPATH=\
$JAVA_HOME/lib/tools.jar:\
$CATALINA_HOME/bin/commons-daemon.jar:\
$CATALINA_HOME/bin/bootstrap.jar

case "$1" in
  start)
    #
    # Start Tomcat
    #
    $DAEMON_HOME/jsvc \
    -user root \
    -verbose \
    -home $JAVA_HOME \
    -jvm server \
    -nodetach \
    -Dcatalina.home=$CATALINA_HOME \
    -Dcatalina.base=$CATALINA_BASE \
    -Djava.io.tmpdir=$TMP_DIR \
    -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \
     $JAVA_OPTS \
    -wait 300 \
    -pidfile $PID_FILE \
    -outfile $CATALINA_HOME/logs/catalina.out \
    -errfile '&1' \
    -debug \
    -cp $CLASSPATH \
    org.apache.catalina.startup.Bootstrap "$@" start
    #
    # To get a verbose JVM
    #-verbose \
    # To get a debug of jsvc.
    exit $?
    ;;

  stop)
    #
    # Stop Tomcat
    #
    $DAEMON_HOME/jsvc \
    -stop \
    -pidfile $PID_FILE \
    org.apache.catalina.startup.Bootstrap "$@" stop
    exit $?
    ;;

  *)
    echo "Usage tomcat.sh start/stop"
    exit 1;;
esac
When I start my service, I've got the following errors in catalina.out:

…..
13:13:52,701  INFO  [alfresco.config.JndiPropertyPlaceholderConfigurer] Loading properties file from class path resource [alfresco/alfresco-shared.properties]
java.net.UnknownHostException: basename
   at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
   at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
   at java.net.Socket.connect(Socket.java:519)
   at java.net.Socket.connect(Socket.java:469)
   at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
   at sun.net.NetworkClient.openServer(NetworkClient.java:118)
   at sun.net.ftp.FtpClient.openServer(FtpClient.java:488)
   at sun.net.ftp.FtpClient.openServer(FtpClient.java:475)
   at sun.net.www.protocol.ftp.FtpURLConnection.connect(FtpURLConnection.java:270)
   at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(FtpURLConnection.java:352)
   at java.net.URL.openStream(URL.java:1009)
   at org.apache.xml.resolver.Catalog.parseCatalogFile(Unknown Source)
   at org.apache.xml.resolver.Catalog.parsePendingCatalogs(Unknown Source)
   at org.apache.xml.resolver.Catalog.parseCatalog(Unknown Source)
   at org.apache.xml.resolver.Catalog.loadSystemCatalogs(Unknown Source)
   at org.apache.xml.resolver.CatalogManager.getPrivateCatalog(Unknown Source)
   at org.apache.xml.resolver.CatalogManager.getCatalog(Unknown Source)
   at org.apache.xml.resolver.tools.CatalogResolver.initializeCatalogs(Unknown Source)
   at org.apache.xml.resolver.tools.CatalogResolver.<init>(Unknown Source)
   at org.apache.cxf.catalog.OASISCatalogManager.<init>(OASISCatalogManager.java:60)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
   at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
   at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:85)
   at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:61)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:757)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:722)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:386)
   at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)
   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
   at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:291)
   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
   at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
   at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:189)
   at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
   at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:69)
   at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
   at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
   at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
   at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
   at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
   at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:627)
   at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
   at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
   at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
   at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
   at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
   at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
   at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
   at org.apache.catalina.core.StandardService.start(StandardService.java:516)
   at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
   at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.apache.commons.daemon.support.DaemonLoader.start(DaemonLoader.java:177)
…..
…..
13:14:36,297  DEBUG [org.alfresco.fileserver] [SMB] Server error : org.alfresco.jlan.server.config.InvalidConfigurationException: Error initializing TCP-IP SMB session handler, Permission denied
13:14:36,301  DEBUG [org.alfresco.fileserver] org.alfresco.jlan.server.config.InvalidConfigurationException: Error initializing TCP-IP SMB session handler, Permission denied
13:14:36,301  DEBUG [org.alfresco.fileserver]    at org.alfresco.jlan.smb.server.nio.NIOCifsConnectionsHandler.initializeHandler(NIOCifsConnectionsHandler.java:256)
13:14:36,301  DEBUG [org.alfresco.fileserver]    at org.alfresco.jlan.smb.server.SMBServer.run(SMBServer.java:512)
13:14:36,301  DEBUG [org.alfresco.fileserver]    at java.lang.Thread.run(Thread.java:619)
…..

The Alfresco web applications got deployed and I can access them with my browser through port 8080. But I cannot access the CIFS server. If I run it manually using alfresco.sh script, everything is fine, I don't have any errors and I can access the CIFS server.

Any help is appreciated

Outcomes