Thanks for the suggestions Martin, I'll give them a try in a couple of
hours, I've got to do something now.

I tried the same daemon script at boot time from init.d and I get the same
issue, it runs under root. Does that mean that my setting for the tomcat
user for jsvc is not working? I assumed that jsvc would take that identity
to do everything, including creating the dirs and files.

Thanks

Fred

On Sat, Aug 25, 2012 at 3:40 AM, Martin Gainty <mgai...@hotmail.com> wrote:

>  save yourself a ton of permission-errors grief
>
> login tomcat
> mkdir /datadisk1/tomcat/conf/Catalina/localhost
> BTW when you do a
> ls -al /datadisk1/tomcat/conf/Catalina/localhost
> you should have god rights rwd pretty much everything
>
> sudo is tricky because you'll need to add tomcat user to run the tomcat
> daemon(sh) to
>
> /etc/sudoers
>
> but then you'll only have permission to run daemon(.sh)
> access to temp, work and log folders have not been granted
>
> cd $CATALINA_BASE
> chown tomcat work
> chown tomcat logs
> chown tomcat temp
>
> Your clock is 6 hours ahead of me so you will receive this email very
> early am..i assume you're in CET
> I'll check back SAT roughly 8am CST
> Martin Gainty
> ______________________________________________
> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
> dient lediglich dem Austausch von Informationen und entfaltet keine
> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
>
> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
> destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
> l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci 
> est interdite. Ce message sert à l'information seulement et n'aura pas 
> n'importe quel effet légalement obligatoire. Étant donné que les email 
> peuvent facilement être sujets à la manipulation, nous ne pouvons accepter 
> aucune responsabilité pour le contenu fourni.
>
>
>
>
> > From: fja...@gmail.com
> > Date: Sat, 25 Aug 2012 00:22:50 +0200
> > Subject: Re: Issue building the Unix daemon (jsvc) with the "configure"
> script in Tomcat7
> > To: users@tomcat.apache.org
>
> >
> > Hi Jeff,
> >
> > I tried both:
> >
> > [ec2-user@ip-10-34-89-185 bin]$ ./daemon.sh start
> > Cannot set group id for user 'tomcat'
> > Error validating user 'tomcat'
> >
> > With sudo, I get the permissions issue. ec2-user is a sudoer.
> >
> > sudo ./daemon.sh start
> >
> > *SEVERE: Unable to create directory for deployment:
> > /datadisk1/tomcat/conf/Catalina/localhost*
> > Aug 24, 2012 1:29:12 PM org.apache.catalina.startup.HostConfig
> > deployDirectory
> > INFO: Deploying web application directory
> /datadisk1/tomcat/webapps/examples
> > Aug 24, 2012 1:29:12 PM org.apache.catalina.core.StandardContext
> > postWorkDirectory
> > *WARNING: Failed to create work directory
> > [/datadisk1/tomcat/work/Catalina/localhost/examples] for context
> [/examples]
> > *
> > Aug 24, 2012 1:29:13 PM org.apache.jasper.EmbeddedServletOptions <init>
> > *SEVERE: The scratchDir you specified:
> > /datadisk1/tomcat/work/Catalina/localhost/examples is unusable.*
> >
> > I am trying to see the whole command passed to jsvc but I am not fluent
> in
> > shell scripts and I can't get to echo it yet.
> >
> > Fred
> >
> > On Fri, Aug 24, 2012 at 10:45 PM, Jeff MAURY <jeffma...@jeffmaury.com
> >wrote:
> >
> > > It probably means your current user (ec2-user) has not the rights to
> run as
> > > tomcat user.
> > > Try the same command with sudo in front, if ec2-user is part of the
> sudoers
> > >
> > > Jeff
> > >
> > >
> > > On Fri, Aug 24, 2012 at 4:09 PM, Fred Janon <fja...@gmail.com> wrote:
> > >
> > > > Ah! Thanks Jeff, you are right, thanks. I checked and the OpenJDK
> > > installed
> > > > is not the full JDK (??? confusing). I had to install the
> OpenJDK-dev to
> > > > get the full JDK.
> > > >
> > > > I managed to build the jsvc (yeah!), now I am getting an error after
> > > > starting tomcat using daemon.sh, it seems that it runs a root, not
> tomcat
> > > > as I configured setenv.sh. tomcat cannot create some dirs, reported
> in
> > > > catalina-daemon.out.
> > > >
> > > > If I launch tomcat without being root, I get this error:
> > > >
> > > > [ec2-user@ip-10-34-89-185 bin]$ ./daemon.sh start
> > > > Cannot set group id for user 'tomcat'
> > > > Error validating user 'tomcat'
> > > >
> > > > Not sure what this means, I have a tomcat user in the tomcat group.
> > > >
> > > > If I launch tomcat using that command:
> > > >
> > > > sudo ./daemon.sh start
> > > >
> > > > with setenv.sh:
> > > >
> > > > export CATALINA_HOME=/datadisk1/tomcat
> > > > export CATALINA_OPTS="-server -Xms128M -Xmx512M"
> > > > export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre
> > > > export TOMCAT_USER=tomcat
> > > >
> > > > then catalina-daemon.out shows:
> > > >
> > > > Aug 24, 2012 1:29:11 PM org.apache.catalina.core.AprLifecycleListener
> > > init
> > > > SEVERE: An incompatible version 1.1.22 of the APR based Apache Tomcat
> > > > Native library is installed, while Tomcat requires version 1.1.24
> > > > Aug 24, 2012 1:29:11 PM org.apache.catalina.core.AprLifecycleListener
> > > init
> > > > SEVERE: An incompatible version 1.1.22 of the APR based Apache Tomcat
> > > > Native library is installed, while Tomcat requires version 1.1.24
> > > > Aug 24, 2012 1:29:11 PM org.apache.catalina.core.AprLifecycleListener
> > > init
> > > > SEVERE: An incompatible version 1.1.22 of the APR based Apache Tomcat
> > > > Native library is installed, while Tomcat requires version 1.1.24
> > > > Aug 24, 2012 1:29:11 PM org.apache.catalina.core.AprLifecycleListener
> > > init
> > > > SEVERE: An incompatible version 1.1.22 of the APR based Apache Tomcat
> > > > Native library is installed, while Tomcat requires version 1.1.24
> > > > Aug 24, 2012 1:29:11 PM org.apache.catalina.core.AprLifecycleListener
> > > init
> > > > SEVERE: An incompatible version 1.1.22 of the APR based Apache Tomcat
> > > > Native library is installed, while Tomcat requires version 1.1.24
> > > > Aug 24, 2012 1:29:11 PM org.apache.coyote.AbstractProtocol init
> > > > INFO: Initializing ProtocolHandler ["http-bio-8080"]
> > > > Aug 24, 2012 1:29:11 PM org.apache.coyote.AbstractProtocol init
> > > > INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
> > > > Aug 24, 2012 1:29:11 PM org.apache.catalina.startup.Catalina load
> > > > INFO: Initialization processed in 1316 ms
> > > > Aug 24, 2012 1:29:12 PM org.apache.catalina.core.StandardService
> > > > startInternal
> > > > INFO: Starting service Catalina
> > > > Aug 24, 2012 1:29:12 PM org.apache.catalina.core.StandardEngine
> > > > startInternal
> > > > INFO: Starting Servlet Engine: Apache Tomcat/7.0.29
> > > > Aug 24, 2012 1:29:12 PM org.apache.catalina.startup.HostConfig start
> > > > *SEVERE: Unable to create directory for deployment:
> > > > /datadisk1/tomcat/conf/Catalina/localhost*
> > > > Aug 24, 2012 1:29:12 PM org.apache.catalina.startup.HostConfig
> > > > deployDirectory
> > > > INFO: Deploying web application directory
> > > > /datadisk1/tomcat/webapps/examples
> > > > Aug 24, 2012 1:29:12 PM org.apache.catalina.core.StandardContext
> > > > postWorkDirectory
> > > > *WARNING: Failed to create work directory
> > > > [/datadisk1/tomcat/work/Catalina/localhost/examples] for context
> > > > [/examples]
> > > > *
> > > > Aug 24, 2012 1:29:13 PM org.apache.jasper.EmbeddedServletOptions
> <init>
> > > > *SEVERE: The scratchDir you specified:
> > > > /datadisk1/tomcat/work/Catalina/localhost/examples is unusable.*
> > > > Aug 24, 2012 1:29:13 PM org.apache.catalina.startup.HostConfig
> > > > deployDirectory
> > > > INFO: Deploying web application directory
> /datadisk1/tomcat/webapps/ROOT
> > > > Aug 24, 2012 1:29:13 PM org.apache.catalina.core.StandardContext
> > > > postWorkDirectory
> > > > WARNING: Failed to create work directory
> > > > [/datadisk1/tomcat/work/Catalina/localhost/_] for context []
> > > > Aug 24, 2012 1:29:13 PM org.apache.jasper.EmbeddedServletOptions
> <init>
> > > > SEVERE: The scratchDir you specified:
> > > > /datadisk1/tomcat/work/Catalina/localhost/_ is unusable.
> > > > Aug 24, 2012 1:29:13 PM org.apache.catalina.startup.HostConfig
> > > > deployDirectory
> > > > INFO: Deploying web application directory
> /datadisk1/tomcat/webapps/docs
> > > > Aug 24, 2012 1:29:13 PM org.apache.catalina.core.StandardContext
> > > > postWorkDirectory
> > > > WARNING: Failed to create work directory
> > > > [/datadisk1/tomcat/work/Catalina/localhost/docs] for context [/docs]
> > > > Aug 24, 2012 1:29:13 PM org.apache.jasper.EmbeddedServletOptions
> <init>
> > > > SEVERE: The scratchDir you specified:
> > > > /datadisk1/tomcat/work/Catalina/localhost/docs is unusable.
> > > > Aug 24, 2012 1:29:13 PM org.apache.catalina.startup.HostConfig
> > > > deployDirectory
> > > > INFO: Deploying web application directory
> > > /datadisk1/tomcat/webapps/manager
> > > > Aug 24, 2012 1:29:13 PM org.apache.catalina.core.StandardContext
> > > > postWorkDirectory
> > > > WARNING: Failed to create work directory
> > > > [/datadisk1/tomcat/work/Catalina/localhost/manager] for context
> > > [/manager]
> > > > Aug 24, 2012 1:29:13 PM org.apache.jasper.EmbeddedServletOptions
> <init>
> > > > SEVERE: The scratchDir you specified:
> > > > /datadisk1/tomcat/work/Catalina/localhost/manager is unusable.
> > > > Aug 24, 2012 1:29:13 PM org.apache.catalina.startup.HostConfig
> > > > deployDirectory
> > > > INFO: Deploying web application directory
> > > > /datadisk1/tomcat/webapps/host-manager
> > > > Aug 24, 2012 1:29:13 PM org.apache.catalina.core.StandardContext
> > > > postWorkDirectory
> > > > WARNING: Failed to create work directory
> > > > [/datadisk1/tomcat/work/Catalina/localhost/host-manager] for context
> > > > [/host-manager]
> > > > Aug 24, 2012 1:29:13 PM org.apache.jasper.EmbeddedServletOptions
> <init>
> > > > SEVERE: The scratchDir you specified:
> > > > /datadisk1/tomcat/work/Catalina/localhost/host-manager is unusable.
> > > > Aug 24, 2012 1:29:13 PM org.apache.coyote.AbstractProtocol start
> > > > INFO: Starting ProtocolHandler ["http-bio-8080"]
> > > > Aug 24, 2012 1:29:13 PM org.apache.coyote.AbstractProtocol start
> > > > INFO: Starting ProtocolHandler ["ajp-bio-8009"]
> > > > Aug 24, 2012 1:29:13 PM org.apache.catalina.startup.Catalina start
> > > > INFO: Server startup in 1613 ms
> > > >
> > > > I am not sure my "export TOMCAT_USER=tomcat" is right, or if I am
> missing
> > > > something.
> > > >
> > > > Regards,
> > > >
> > > > Fred
> > > >
> > > > On Fri, Aug 24, 2012 at 12:01 PM, Jeff MAURY <
> jeffma...@jeffmaury.com
> > > > >wrote:
> > > >
> > > > > Fred,
> > > > >
> > > > > you are getting confused by the term OpenJDK. It comes in two
> flavor,
> > > JRE
> > > > > and JDK. I have some .h files on my Ubuntu server, but not under
> > > > > /usr/lib/jvm/java-1.6.0-openjdk but under
> /usr/lib/jvm/java-6-openjdk
> > > > >
> > > > > Regards
> > > > > Jeff
> > > > >
> > > > >
> > > > > On Fri, Aug 24, 2012 at 8:52 AM, Fred Janon <fja...@gmail.com>
> wrote:
> > > > >
> > > > > > Hi Jeff,
> > > > > >
> > > > > > Thanks, but I read the instructions and requirements for a C
> compiler
> > > > an
> > > > > > the JDK. As shown in my original message there is a JDK
> > > > > >
> > > > > > > /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/*
> > > > > >
> > > > > > but no "jni_md.h" in the Open JDK. As I said the "jni_md.h"
> seems to
> > > be
> > > > > in
> > > > > > the Windows JDK, but not in the Linux one.
> > > > > >
> > > > > > Cheers,
> > > > > >
> > > > > > Fred
> > > > > >
> > > > > > On Fri, Aug 24, 2012 at 7:51 AM, Jeff MAURY <
> jeffma...@jeffmaury.com
> > > >
> > > > > > wrote:
> > > > > >
> > > > > > > You need a JDK to be installed on your machine and it seems
> you've
> > > > > only a
> > > > > > > JRE
> > > > > > >
> > > > > > > Jeff
> > > > > > >
> > > > > > >
> > > > > > > On Thu, Aug 23, 2012 at 10:12 PM, Fred Janon <fja...@gmail.com
> >
> > > > wrote:
> > > > > > >
> > > > > > > > Hi,
> > > > > > > >
> > > > > > > > I am trying to build the Unix deamon jsvc in AWS EC2 Linux.
> I did
> > > > not
> > > > > > > > install Tomcat7 that comes with the AWS Linux, I downloaded
> > > Tomcat7
> > > > > > from
> > > > > > > > the Apache Tomcat website, I installed it and ran Tomcat7
> > > > > successfully.
> > > > > > > Now
> > > > > > > > I am trying to build the daemon to run Tomcat7 as a daemon.
> I get
> > > > an
> > > > > > > error
> > > > > > > > running the "configure" script as indicated in the Tomcat
> > > > > > documentation.
> > > > > > > I
> > > > > > > > did a lot of searching on the web and cannot find a solution
> to
> > > > this
> > > > > > > issue.
> > > > > > > > I am not fluent in shell scripting, so my understanding of
> > > > > "configure"
> > > > > > is
> > > > > > > > very limited.
> > > > > > > >
> > > > > > > > Do I need to regenerate the "configure" script or do I need
> to
> > > > modify
> > > > > > the
> > > > > > > > script?
> > > > > > > >
> > > > > > > > The error is:
> > > > > > > > *checking for JDK os include directory... Cannot find
> jni_md.h in
> > > > > > > > /usr/lib/jvm/jre/*
> > > > > > > > *configure: error: You should retry --with-os-type=SUBDIR*
> > > > > > > > *
> > > > > > > > *
> > > > > > > > It looks like *"jni_md.h"* is part of the Windows JDK, *but
> it's
> > > > not
> > > > > in
> > > > > > > the
> > > > > > > > Linux OpenJDK on CentOS.*
> > > > > > > >
> > > > > > > > I don't really understand why the message says
> "*with-os-type*"
> > > > where
> > > > > > it
> > > > > > > > seems to mean JDK?
> > > > > > > >
> > > > > > > > As indicated in the INSTALL.txt below, I am reporting the
> issue,
> > > > > hoping
> > > > > > > > that someone can give me a solution or a patch for the
> script...
> > > > > > > >
> > > > > > > > "Depending on your JDK layout, configure might fail to find
> the
> > > JNI
> > > > > > > > machine dependant include file (jni_md.h). If that's the
> case use
> > > > the
> > > > > > > > --with-os-type=<subdir> parameter where subdir points to the
> > > > > directory
> > > > > > > > within JDK include directory containing jni_md.h file.
> > > > > > > > If your operating system is supported, configure will go thru
> > > > > cleanly,
> > > > > > > > otherwise it will report an error (please send us the
> details of
> > > > your
> > > > > > > > OS/JDK, or a patch against the sources)."
> > > > > > > >
> > > > > > > > Below is the console output running configure and some
> > > information
> > > > > > about
> > > > > > > > the jdk installed.
> > > > > > > >
> > > > > > > > [ec2-user@ip-10-244-162-78 unix]$ *./configure*
> > > > > > > > *** Current host ***
> > > > > > > > checking build system type... i686-pc-linux-gnu
> > > > > > > > checking host system type... i686-pc-linux-gnu
> > > > > > > > checking cached host system type... ok
> > > > > > > > *** C-Language compilation tools ***
> > > > > > > > checking for gcc... gcc
> > > > > > > > checking for C compiler default output file name... a.out
> > > > > > > > checking whether the C compiler works... yes
> > > > > > > > checking whether we are cross compiling... no
> > > > > > > > checking for suffix of executables...
> > > > > > > > checking for suffix of object files... o
> > > > > > > > checking whether we are using the GNU C compiler... yes
> > > > > > > > checking whether gcc accepts -g... yes
> > > > > > > > checking for gcc option to accept ANSI C... none needed
> > > > > > > > checking for ranlib... ranlib
> > > > > > > > checking for strip... strip
> > > > > > > > *** Host support ***
> > > > > > > > checking C flags dependant on host system type... ok
> > > > > > > > *** Java compilation tools ***
> > > > > > > > *checking for JDK os include directory... Cannot find
> jni_md.h in
> > > > > > > > /usr/lib/jvm/jre/*
> > > > > > > > *configure: error: You should retry --with-os-type=SUBDIR*
> > > > > > > >
> > > > > > > > [ec2-user@ip-10-244-162-78 unix]$ find / -name 'jni_md.h'
> > > > > 2>/dev/null
> > > > > > > >
> > > > > > > > [ec2-user@ip-10-244-162-78 unix]$ find / -name '*jni*'
> > > 2>/dev/null
> > > > > > > > /usr/share/java-jni
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> /datadisk1/tomcat/bin/commons-daemon-1.0.10-native-src/windows/src/javajni.c
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> /datadisk1/tomcat/bin/commons-daemon-1.0.10-native-src/windows/include/javajni.h
> > > > > > > >
> > > > > > > > Installed Packages
> > > > > > > > java-1.6.0-openjdk.i686
> > > installed
> > > > > > > >
> > > > > > > > ----------------------------------------
> > > > > > > > [ec2-user@ip-10-244-162-78 unix]$ *./configure
> > > > > > > > -with-java=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre*
> > > > > > > > *** Current host ***
> > > > > > > > checking build system type... i686-pc-linux-gnu
> > > > > > > > checking host system type... i686-pc-linux-gnu
> > > > > > > > checking cached host system type... ok
> > > > > > > > *** C-Language compilation tools ***
> > > > > > > > checking for gcc... gcc
> > > > > > > > checking for C compiler default output file name... a.out
> > > > > > > > checking whether the C compiler works... yes
> > > > > > > > checking whether we are cross compiling... no
> > > > > > > > checking for suffix of executables...
> > > > > > > > checking for suffix of object files... o
> > > > > > > > checking whether we are using the GNU C compiler... yes
> > > > > > > > checking whether gcc accepts -g... yes
> > > > > > > > checking for gcc option to accept ANSI C... none needed
> > > > > > > > checking for ranlib... ranlib
> > > > > > > > checking for strip... strip
> > > > > > > > *** Host support ***
> > > > > > > > checking C flags dependant on host system type... ok
> > > > > > > > *** Java compilation tools ***
> > > > > > > > checking JAVA_HOME...
> /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre
> > > > > > > > *checking for JDK os include directory... Cannot find
> jni_md.h in
> > > > > > > > /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/*
> > > > > > > > *configure: error: You should retry --with-os-type=SUBDIR*
> > > > > > > >
> > > > > > > > -----------------------------------------
> > > > > > > > configure script excerpt:
> > > > > > > >
> > > > > > > > echo "$as_me:$LINENO: checking for JDK os include directory"
> > > > >&5
> > > > > > > > echo $ECHO_N "checking for JDK os include directory...
> $ECHO_C"
> > > >&6
> > > > > > > > JAVA_OS=NONE
> > > > > > > > if test -f $JAVA_HOME/$JAVA_INC/jni_md.h
> > > > > > > > then
> > > > > > > > JAVA_OS=""
> > > > > > > > else
> > > > > > > > for f in $JAVA_HOME/$JAVA_INC/*/jni_md.h
> > > > > > > > do
> > > > > > > > if test -f $f; then
> > > > > > > > JAVA_OS=`dirname $f`
> > > > > > > > JAVA_OS=`basename $JAVA_OS`
> > > > > > > > echo " $JAVA_OS"
> > > > > > > > break
> > > > > > > > fi
> > > > > > > > done
> > > > > > > > if test "x$JAVA_OS" = "xNONE"; then
> > > > > > > > echo "$as_me:$LINENO: result: Cannot find jni_md.h in
> > > > > > > > ${JAVA_HOME}/${OS}" >&5
> > > > > > > > echo "${ECHO_T}Cannot find jni_md.h in ${JAVA_HOME}/${OS}"
> >&6
> > > > > > > > { { echo "$as_me:$LINENO: error: You should retry
> > > > > > > > --with-os-type=SUBDIR" >&5
> > > > > > > > echo "$as_me: error: You should retry --with-os-type=SUBDIR"
> > > >&2;}
> > > > > > > > { (exit 1); exit 1; }; }
> > > > > > > > fi
> > > > > > > > fi
> > > > > > > >
> > > > > > > > -----------------------------------------
> > > > > > > >
> > > > > > > > Thanks
> > > > > > > >
> > > > > > > > Fred
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > Jeff MAURY
> > > > > > >
> > > > > > >
> > > > > > > "Legacy code" often differs from its suggested alternative by
> > > > actually
> > > > > > > working and scaling.
> > > > > > > - Bjarne Stroustrup
> > > > > > >
> > > > > > > http://www.jeffmaury.com
> > > > > > > http://riadiscuss.jeffmaury.com
> > > > > > > http://www.twitter.com/jeffmaury
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Jeff MAURY
> > > > >
> > > > >
> > > > > "Legacy code" often differs from its suggested alternative by
> actually
> > > > > working and scaling.
> > > > > - Bjarne Stroustrup
> > > > >
> > > > > http://www.jeffmaury.com
> > > > > http://riadiscuss.jeffmaury.com
> > > > > http://www.twitter.com/jeffmaury
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Jeff MAURY
> > >
> > >
> > > "Legacy code" often differs from its suggested alternative by actually
> > > working and scaling.
> > > - Bjarne Stroustrup
> > >
> > > http://www.jeffmaury.com
> > > http://riadiscuss.jeffmaury.com
> > > http://www.twitter.com/jeffmaury
> > >
>

Reply via email to