Thread: jdbc works with java programs. not with tomcat.

jdbc works with java programs. not with tomcat.

From
"Andrew B. Luck"
Date:
Hi,

I'm a little green with Java, Linux & tomcat; so please assume I am
completely ignorant.  I've read through the tomcat related threads & I'm not
having much luck with jdbc in my jsp scripts.  I'm able to use jdbc in Java
programs, so I believe that my problem is in getting tomcat in touch with
the jdbc classes in postresql.jar.

I've tried:
- including the jar in different folders (/tomcat/lib/) for tomcat to find;
    (how can I determine which directory tomcat is looking to?)
- including postgresql.jar in a classpath in tomcat.properties.

A couple of other things I'd love to be able to do...

Tomcat doesn't shut down.  I use the command 'tomcat stop' & it hangs with
the message 'Stoping tomcat on 8007 null' (one 'p' in stopping).  Fixing
this would be fantastic - right now I have to reboot every time I try to
place postgresql.jar in a different directory.

I've been starting PostgreSQL with the command '/etc/rc.d/init.d/postgresql
start'.  How can I cause it to start automatically?

Thank you so much for any assistance & I hope that my ignorance doesn't
cause me too much embarrassment.

-Andy Luck




_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Re: jdbc works with java programs. not with tomcat.

From
"Brett W. McCoy"
Date:
On Thu, 12 Apr 2001, Andrew B. Luck wrote:

> Tomcat doesn't shut down.  I use the command 'tomcat stop' & it hangs with
> the message 'Stoping tomcat on 8007 null' (one 'p' in stopping).  Fixing
> this would be fantastic - right now I have to reboot every time I try to
> place postgresql.jar in a different directory.

You shouldn't ever have to reboot Linux unless you have a very serious
hardware error that has locked up your system.

I recommend using the shell scripts provided with Tomcat to start and shut
it down.  Also, there is no need to place & at the end of 'tomcat stop'.

As for the CLASSPATH tomcat searches, if you use startup.sh and
shutdown.sh provided with Tomcat, it lists the classpath Tomcat is using
before Tomcat starts up.  You can add custom classpaths to the script or
add to the system classpath.

> I've been starting PostgreSQL with the command '/etc/rc.d/init.d/postgresql
> start'.  How can I cause it to start automatically?

Most likely, there should be a link (probably something like S##postgres)
under /etc/rc.d/rc3 that points back to the main startup script, which
should start up PostgreSQL upon bootup.  What version of Linux are you
using?

-- Brett
                   http://www.chapelperilous.net/btfwk/
------------------------------------------------------------------------
"Your attitude determines your attitude."
-- Zig Ziglar, self-improvement doofus


Re: jdbc works with java programs. not with tomcat.

From
"Andrew B. Luck"
Date:
Hi Brett,

Thank you for the help.  I still haven't made much progress.  tomcat and
postgresql were already installed on this computer when it was supplied to
me.  unfortunately, i'm pretty much on my own now...

> I recommend using the shell scripts provided with Tomcat to start and shut
> it down.  Also, there is no need to place & at the end of 'tomcat stop'.

- i didn't intend to be ambiguous.  i've been using 'tomcat stop' (no '&').
- i tried to stop tomcat with the script... '/etc/rc.d/init.d/tomcat stop'.
no luck.

i was able to find a script '/etc/rc.d/init.d/tomcat'.  perhaps this is the
script i should use?  i'll include the contents...

#!/bin/sh
#
# Startup script for Tomcat, the Apache Servlet Engine
#
# chkconfig: 345 80 20
# description: Tomcat is the Apache Servlet Engine
# processname: tomcat
# pidfile: /var/run/tomcat.pid
#
# Gomez Henri <hgomez@slib.fr>
#
# version 1.02 - Removed initlog support
# version 1.03 - Removed config:
# version 1.04 - tomcat will start before httpd and stop after httpd
#
# Source function library.
. /etc/rc.d/init.d/functions

export JAVA_HOME=/usr/local/java
export TOMCAT_HOME=/var/tomcat

export PATH=$PATH:${JAVA_HOME}/bin:${JAVA_HOME}/jre/bin

# See how we were called.
case "$1" in
  start)
 echo -n "Starting tomcat: "
 touch /var/run/tomcat.pid
 chown apache:apache /var/run/tomcat.pid
 daemon --user apache tomcat start
 echo
 touch /var/lock/subsys/tomcat
 ;;
  stop)
 echo -n "Shutting down tomcat: "
 daemon tomcat stop
 echo
 rm -f /var/lock/subsys/tomcat
 rm -f /var/run/tomcat.pid
 ;;
  restart)
 $0 stop
 sleep 2
 $0 start
 ;;
  *)
 echo "Usage: $0 {start|stop|restart}"
 exit 1
esac

exit 0


>
> As for the CLASSPATH tomcat searches, if you use startup.sh and
> shutdown.sh provided with Tomcat, it lists the classpath Tomcat is using
> before Tomcat starts up.  You can add custom classpaths to the script or
> add to the system classpath.
i wasn't able to those files anywhere on the computer.  am i insane or just
dumb?


>
> Most likely, there should be a link (probably something like S##postgres)
> under /etc/rc.d/rc3 that points back to the main startup script, which
> should start up PostgreSQL upon bootup.  What version of Linux are you
> using?
>
- i was able to find the directory, but not the file.  can you help me find
the main startup script?
- i've got red had version 7.


Thank you again for the help & i apologize for my abundance of ignorance.

-andy



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Re: jdbc works with java programs. not with tomcat.

From
"Brett W. McCoy"
Date:
On Fri, 13 Apr 2001, Andrew B. Luck wrote:

> Thank you for the help.  I still haven't made much progress.  tomcat and
> postgresql were already installed on this computer when it was supplied to
> me.  unfortunately, i'm pretty much on my own now...

Ah, I was going by the assumption that Tomcat was installed under
/usr/local/jakarta or something like that.  Not knowing how your system is
set up, I'm not sure what to tell you.  You mayb have to find where the
actual tomcat script is (probably /usr/local) and see if you can add the
classpath there.

-- Brett
                   http://www.chapelperilous.net/btfwk/
------------------------------------------------------------------------
Hmmm ... A hash-singer and a cross-eyed guy were SLEEPING on a deserted
island, when ...