views:

639

answers:

1

hello people i'm struggling with a mac os x 10.5.8 that i've started using recently for development.i successfully installed tomcat and create launchd.conf for my environment variables.i believe it works fine.coz i can build a project with netbeans using maven and cargo plugins succesfully so i found online a script for start and stop the tomcat

#!/bin/bash

case $1 in
 start)
  sh /Library/apache-tomcat-6.0.20/bin/startup.sh
 ;; 
 stop)
  sh /Library/apache-tomcat-6.0.20/bin/shutdown.sh
 ;;
 restart)
  sh /Library/apache-tomcat-6.0.20/bin/shutdown.sh
  sh /Library/apache-tomcat-6.0.20/bin/startup.sh
 ;;
 *)
 echo "Usage :start|stop|restart"
 ;;
 esac
 exit 0

that script was created in nano in sudo sh but when i want to run it. is spit out this

sh: /usr/bin/tomcat: Permission denied

i've added chmod 755 *.sh and *.bat inside /Library/apache-tomcat-6.0.20/bin

still access denied so what do i go around that?i have the admin privileges on the machine thanks for reading

+2  A: 

Where did you install the tomcat script to? I'd recommend you install it to /usr/bin. Once installed, make sure the permissions are correct (i.e. chmod 755 /usr/bin/tomcat). You can then confirm with ls -l /usr/bin/tomcat.

If you still get errors once the permissions on /usr/bin/tomcat are correct, then you can add the following two lines following the #!/bin/bash line.

set -x
set -v

With the above lines, bash will output additional information that will allow you to tell what's being executed and where the error is happening.

Kaleb Pederson
ok thanks very much for the tips.it does start and stop the server but then when i execute the tomcat stop it throwing an exception but it's stoping the server though
black sensei
here are my environment variables inside /etc/launchd.conf setenv JAVA_VERSION 1.6setenv JAVA_HOME /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/lib/setenv JRE_HOME /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/setenv CATALINA_BASE /Library/apache-tomcat-6.0.20setenv CATALINA_HOME /Library/apache-tomcat-6.0.20setenv CATALINA_TMPDIR /Library/apache-tomcat-6.0.20/temp
black sensei
and here are the errorEVERE: Catalina.stop: java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:432) at java.net.Socket.connect(Socket.java:525) at java.net.Socket.connect(Socket.java:475) at java.net.Socket.<init>(Socket.java:372) at java.net.Socket.<init>(Socket.java:186)
black sensei
at java.net.Socket.<init>(Socket.java:186) at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:422) 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.stopServer(Bootstrap.java:337) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:415)
black sensei
Using CATALINA_BASE: /Library/apache-tomcat-6.0.20Using CATALINA_HOME: /Library/apache-tomcat-6.0.20Using CATALINA_TMPDIR: /Library/apache-tomcat-6.0.20/tempUsing JRE_HOME: /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/touch: /Library/apache-tomcat-6.0.20/logs/catalina.out: Permission denied/Library/apache-tomcat-6.0.20/bin/catalina.sh: line 310: /Library/apache-tomcat-6.0.20/logs/catalina.out: Permission denied
black sensei
solve it. but it seems that netbeans nor eclispe can't publish to it.on netbeans i have this : java.io.FileNotFoundException: /Library/apache-tomcat-6.0.20/work/Catalina/localhost/host-manager/SESSIONS.ser (Permission denied) any idea?
black sensei