RE: JDBC Realm problem

2003-02-18 Thread Geoff Peters
Gregg - Are Tomcat and MySQL on the same box? I had some previous issues with not 
being able to reach the box, also had to do a lot of friggin with the permissions in 
MySQL.  I am assuming you have granted permission to 'uname' @ 'localhost'

Here is a copy of my server.xml as is right now and functioning:


Server port=8005 shutdown=SHUTDOWN debug=0

  Service name=Tomcat-Standalone

   

Connector className=org.apache.coyote.tomcat4.CoyoteConnector
port=80 minProcessors=5 maxProcessors=75
   enableLookups=true redirectPort=8443
   acceptCount=100 debug=0 connectionTimeout=2
   useURIValidationHack=false disableUploadTimeout=true /

 
Engine name=Standalone defaultHost=localhost debug=0


  Logger className=org.apache.catalina.logger.FileLogger
  prefix=catalina_log. suffix=.txt
  timestamp=true/

  
Realm  className=org.apache.catalina.realm.JDBCRealm debug=99
  driverName=org.gjt.mm.mysql.Driver
   connectionURL=jdbc:mysql://198.000.000.00/MailAdmn
  connectionName=user connectionPassword=pass
userTable=tblUsers userNameCol=user_name userCredCol=user_pass
  userRoleTable=tblUser_Role roleNameCol=role_name digest = md5/ 
  
  
  Host name=localhost debug=0 appBase=webapps unpackWARs=true 
autoDeploy=true

   
   Valve className=org.apache.catalina.valves.AccessLogValve
 directory=logs  prefix=gpeters_access_log. suffix=.txt
 pattern=common resolveHosts=false/

Logger className=org.apache.catalina.logger.FileLogger
 directory=logs  prefix=gpeters_log. suffix=.txt
timestamp=true/
 
  Context path= docBase=ROOT debug=99/
  
  
Context path=/Mail docBase=Mail debug=99
  reloadable=true crossContext=true 
  
Realm  className=org.apache.catalina.realm.JDBCRealm debug=99
 driverName=org.gjt.mm.mysql.Driver
connectionURL=jdbc:mysql://198.000.000.00/MailAdmn
connectionName=user connectionPassword=pass  userTable=tblUsers  
 userNameCol=user_name userCredCol=user_pass
userRoleTable=tblUser_Role roleNameCol=role_name digest = md5/
 

  
 Logger className=org.apache.catalina.logger.FileLogger
  prefix=tomcat_MailApp_log. suffix=.txt timestamp=true / 
/Context
  /Host

/Engine

  /Service

/Server
-Original Message-
From: Barley [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 18, 2003 1:40 PM
To: [EMAIL PROTECTED]
Subject: JDBC Realm problem


I am unable to start Tomcat with a JDBC Realm
configured. I am guessing it is because Tomcat can't
find the JDBC driver, but it should be able to. I have
the driver in shared/lib and shared/classes. Here is my
Realm configuration from server.xml:

Realm

className=org.apache.catalina.realm.JDBCRealm
driverName=org.gjt.mm.mysql.Driver

connectionURL=jdbc:mysql://localhost/dbmis?user=uname
amp;password=pass
userTable=users
userNameCol=userlogin
userCredCol=userpass
userRoleName=usergroups
roleNameCol=groupname
debug=99
/

I added the %amp; when Tomcat wouldn't start because of
an XML error when I had a plain '' in there.

This is the relevant section of catalina.out:

Starting service Tomcat-Standalone
Apache Tomcat/4.1.18
Catalina.start: LifecycleException:  Exception opening
database connection:  java.sql.SQLException:
org.gjt.mm.mysql.Driver
LifecycleException:  Exception opening database
connection:  java.sql.SQLException:
org.gjt.mm.mysql.Driver
at
org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.jav
a:681)
at
org.apache.catalina.core.ContainerBase.start(ContainerB
ase.java:1173)
at
org.apache.catalina.core.StandardEngine.start(StandardE
ngine.java:347)
at
org.apache.catalina.core.StandardService.start(Standard
Service.java:497)
at
org.apache.catalina.core.StandardServer.start(StandardS
erver.java:2189)
at
org.apache.catalina.startup.Catalina.start(Catalina.jav
a:512)
at
org.apache.catalina.startup.Catalina.execute(Catalina.j
ava:400)
at
org.apache.catalina.startup.Catalina.process(Catalina.j
ava:180)
at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMetho
dAccessorImpl.java:61)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(Delegat
ingMethodAccessorImpl.java:40)
at
java.lang.reflect.Method.invoke(Method.java:335)
at
org.apache.catalina.startup.Bootstrap.main(Bootstrap.ja
va:203)
- Root Cause -
java.sql.SQLException: org.gjt.mm.mysql.Driver
at

Re: JDBC Realm problem

2003-02-18 Thread Sean Dockery
Hello, Barley.

From the HOW-TO from 4.1's documentation:

Place a copy of the JDBC driver you will be using inside the
$CATALINA_HOME/server/lib directory (if you do not need it visible to web
applications) or $CATALINA_HOME/common/lib (if it will be used both by
Tomcat 4 and by your apps). Note that only JAR files are recognized!

From the HOW-TO from 3.3's documentation:

- Make sure that the JDBC driver is in the lib/container directory.

By the way, both 3.3 and 4.1 JDBCRealm declarations accept connectionName
and connectionPassword attributes wherein you can assign a database username
and password for the connection.  Try using those attributes instead of
embedding the username and password in connectionURL.

Good luck.

--
Sean Dockery
[EMAIL PROTECTED]
Certified Java Web Component Developer
Certified Delphi Programmer
SBD Consultants
http://www.sbdconsultants.com

Barley [EMAIL PROTECTED] wrote in message
003001c2d774$cfbec780$0100a8c0@glamdring">news:003001c2d774$cfbec780$0100a8c0@glamdring...
 I am unable to start Tomcat with a JDBC Realm
 configured. I am guessing it is because Tomcat can't
 find the JDBC driver, but it should be able to. I have
 the driver in shared/lib and shared/classes. Here is my
 Realm configuration from server.xml:

 Realm

 className=org.apache.catalina.realm.JDBCRealm
 driverName=org.gjt.mm.mysql.Driver

 connectionURL=jdbc:mysql://localhost/dbmis?user=uname
 amp;password=pass
 userTable=users
 userNameCol=userlogin
 userCredCol=userpass
 userRoleName=usergroups
 roleNameCol=groupname
 debug=99
 /

 I added the %amp; when Tomcat wouldn't start because of
 an XML error when I had a plain '' in there.

 This is the relevant section of catalina.out:

 Starting service Tomcat-Standalone
 Apache Tomcat/4.1.18
 Catalina.start: LifecycleException:  Exception opening
 database connection:  java.sql.SQLException:
 org.gjt.mm.mysql.Driver
 LifecycleException:  Exception opening database
 connection:  java.sql.SQLException:
 org.gjt.mm.mysql.Driver
 at
 org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.jav
 a:681)
 at
 org.apache.catalina.core.ContainerBase.start(ContainerB
 ase.java:1173)
 at
 org.apache.catalina.core.StandardEngine.start(StandardE
 ngine.java:347)
 at
 org.apache.catalina.core.StandardService.start(Standard
 Service.java:497)
 at
 org.apache.catalina.core.StandardServer.start(StandardS
 erver.java:2189)
 at
 org.apache.catalina.startup.Catalina.start(Catalina.jav
 a:512)
 at
 org.apache.catalina.startup.Catalina.execute(Catalina.j
 ava:400)
 at
 org.apache.catalina.startup.Catalina.process(Catalina.j
 ava:180)
 at
 sun.reflect.NativeMethodAccessorImpl.invoke0(Native
 Method)
 at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMetho
 dAccessorImpl.java:61)
 at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(Delegat
 ingMethodAccessorImpl.java:40)
 at
 java.lang.reflect.Method.invoke(Method.java:335)
 at
 org.apache.catalina.startup.Bootstrap.main(Bootstrap.ja
 va:203)
 - Root Cause -
 java.sql.SQLException: org.gjt.mm.mysql.Driver
 at
 org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java
 :606)
 at
 org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.jav
 a:679)
 at
 org.apache.catalina.core.ContainerBase.start(ContainerB
 ase.java:1173)
 at
 org.apache.catalina.core.StandardEngine.start(StandardE
 ngine.java:347)
 at
 org.apache.catalina.core.StandardService.start(Standard
 Service.java:497)
 at
 org.apache.catalina.core.StandardServer.start(StandardS
 erver.java:2189)
 at
 org.apache.catalina.startup.Catalina.start(Catalina.jav
 a:512)
 at
 org.apache.catalina.startup.Catalina.execute(Catalina.j
 ava:400)
 at
 org.apache.catalina.startup.Catalina.process(Catalina.j
 ava:180)
 at
 sun.reflect.NativeMethodAccessorImpl.invoke0(Native
 Method)
 at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMetho
 dAccessorImpl.java:61)
 at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(Delegat
 ingMethodAccessorImpl.java:40)
 at
 java.lang.reflect.Method.invoke(Method.java:335)
 at
 org.apache.catalina.startup.Bootstrap.main(Bootstrap.ja
 va:203)

 MySql logs show nothing, so I don't think it's an
 authentication problem or anything like that. I'd
 appreciate any ideas or suggestions anyone has. Thanks
 very much.

 Gregg




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: JDBC Realm problem..

2001-06-20 Thread Andrew Zhdanov

Hello Anurag,

Wednesday, June 20, 2001, 3:05:54 PM, you wrote:

AT Hi,
AT I am running Tomcat 3.2 with Apache 1.3 and using MySQL database.  I tried
AT to setup JDBC Realm by following the instructions but to no avail. After
AT making the necessary changes in server.xml file, when I start Tomcat, I get
AT the error message SQLException: server configuration denies access to data
AT source. If anybody can help me figure out the what's going wrong, that
AT would be great.
I can suggest to look at mysql database (in MySQL) to grant privelegies for your
host to access databases in mysql. In other words - JDBC driver is not
implicated in mysql priviligies. I've had that problem - because MySQL
is running at Server - and all CGI's that i've run before where executed
at Server also and it was ok  - but when we run java at localhost
there were no permissons - and i've had a gread head-ache to
understand that there must be privilegies in MySQL grants.

AT Another question is that if I want to access my database from the servlets
AT using JDBC, is it essential to have JDBCRealm set up or it can be done
AT without it also just by placing the JDBC drivers jar file at the
AT appropriate place.
I'm sure it is enougph mysql_dirver.jar to be in classpath. You even may
to plase mysql_driver.jar in your-web-app/lib and it will be enougph.
And another nice way is to place mysql_driver.jar to the
%JAVA_HOME%/jre/lib/ext folder - then jvm finds all jars there you
even needn't to add them (jars) to classpath everytime you install new
jars.

But i'd like to say that i'm not sure what is JDBCRealm


AT Thanks in advance,
AT Anurag



-- 
Best regards,
 Andrew





FIXED: Re: JDBC Realm problem

2001-04-24 Thread Jeff Kilbride

For any who are using MySQL and JDBCRealm, configuring the connection string
in server.xml and adding the autoReconnect=true param fixed the timeout
problem I was having with MySQL.

From server.xml:

connectionURL=jdbc:mysql://localhost/dbName?autoReconnect=true

I'm very glad to have this one solved! Thanks to all who gave suggestions.

--jeff

- Original Message -
From: Jeff Kilbride [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Monday, April 23, 2001 6:04 PM
Subject: Re: JDBC Realm problem


 Hi Andrew,

 From the mm.mysql docs:

 Name: autoReconnect
 Use: should the driver attempt to re-connect if the connection dies?
 (true/false)
 Default Value: false

 I wouldn't have found this without your pointer, so thanks! I'll give it a
 try and see what happens.

 I'd love to see your connection pool implementation for JDBCRealm. Would
you
 be willing to send it to me outside the list?

 Thanks,
 --jeff





RE: JDBC Realm problem

2001-04-23 Thread Ignacio J. Ortega

Hola Jeff:

Some people has reported problems that lookclose to yours..no solutions
... please test against latest code on CVS for 3.2 branch...3.3 code (m2
is known to be broken in auth ...get it from CVS until m3 arrives..)..
or 4.0 Beta2...to give that problem another shake.. in different
flavours of tomcat..to se if that makes a difference ( i dont believe
that's wil be true but who knows ..)

For me until now...with one more code review done after reading your
message...this problem relates to the MySql JDBC Driver...so change you
Driver jar version to see if that makes a difference..

Sorry for trying to augment your problems ... not solve them..:)))

TIA.

( Please do not use HTML mail makes hard to chat, thanks)

Saludos ,
Ignacio J. Ortega

-Mensaje original-
De: Jeff Kilbride [mailto:[EMAIL PROTECTED]]
Enviado el: lunes 23 de abril de 2001 23:29
Para: [EMAIL PROTECTED]
Asunto: JDBC Realm problem


I'm using JDBC Realm with MySQL to protect an area of my website. I've
got everything configured correctly and it works. However, I've noticed
that if the protected area is accessed and then *not* accessed again for
a period longer than my MySQL connection timeout value (default of 8
hours), JDBC Realm is unable to recover and all users are sent to my
login error page.

Here's the entryfrom my tomcat.log:

--
2001-04-23 12:51:27 - ContextManager: JDBCRealm: The database connection
is null or was found to be closed. Trying to re-open it.
2001-04-23 12:51:27 - ContextManager: JDBCRealm: There was an
SQLException while in authenticate: null
2001-04-23 12:51:27 - ContextManager: JDBCRealm: SQLException:
java.sql.SQLException: Invalid authorization specification: Access
denied for user: 'nobody@localhost' (Using password: NO)
--

I suppose I could up the timeout value in MySQL, but isn't it a little
strange that JDBC Realm can't open a new connection to recover?

Anyone else had this problem? I'm using Tomcat 3.2.1 on Linux with
IBMJava2-13.

Thanks,
--jeff





Re: JDBC Realm problem

2001-04-23 Thread Jeff Kilbride

Hi Ignacio,

Thanks for the quick response! First, my apologies for the HTML format. I
didn't realize I hadn't changed this machine...

I'll try the 3.2.2 branch and see what happens. Any word on a final release
for 3.2.2?

I'm using the 2.0.4 drivers for MySQL, which seem to be the latest. Can you
be more specific on why this relates to the driver? If so, I'll take a look
at the driver code and see if I can locate the problem or recommend a
solution to the mm.mysql developer.

On another note, I've seen discussions saying the mod_jk implementation in
the 3.3 branch is implemented/optimized better than the mod_jk in 3.2.*. Do
you recommend using the 3.3 mod_jk?

Thanks,
--jeff

- Original Message -
From: Ignacio J. Ortega [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, April 23, 2001 3:31 PM
Subject: RE: JDBC Realm problem


 Hola Jeff:

 Some people has reported problems that lookclose to yours..no solutions
 ... please test against latest code on CVS for 3.2 branch...3.3 code (m2
 is known to be broken in auth ...get it from CVS until m3 arrives..)..
 or 4.0 Beta2...to give that problem another shake.. in different
 flavours of tomcat..to se if that makes a difference ( i dont believe
 that's wil be true but who knows ..)

 For me until now...with one more code review done after reading your
 message...this problem relates to the MySql JDBC Driver...so change you
 Driver jar version to see if that makes a difference..

 Sorry for trying to augment your problems ... not solve them..:)))

 TIA.

 ( Please do not use HTML mail makes hard to chat, thanks)

 Saludos ,
 Ignacio J. Ortega





Re: JDBC Realm problem

2001-04-23 Thread Andrew Robson

Hi Jeff,
  I had exactly the same problem (with mm 2.0.2) and only
solved it by customisng JDBCRealm to use database 
connection pooling. A bit heavy handed but might be 
a lot easier than trying to track potential driver problem if time is 
an issue. I have also seen a suggestinon on the list that adding
autoreconnect=true to the database connection string solves 
the problem but I haven't tried it myself.

andrew

On Mon, 23 Apr 2001, you wrote:
 Hi Ignacio,
 
 Thanks for the quick response! First, my apologies for the HTML format. I
 didn't realize I hadn't changed this machine...
 
 I'll try the 3.2.2 branch and see what happens. Any word on a final release
 for 3.2.2?
 
 I'm using the 2.0.4 drivers for MySQL, which seem to be the latest. Can you
 be more specific on why this relates to the driver? If so, I'll take a look
 at the driver code and see if I can locate the problem or recommend a
 solution to the mm.mysql developer.
 
 On another note, I've seen discussions saying the mod_jk implementation in
 the 3.3 branch is implemented/optimized better than the mod_jk in 3.2.*. Do
 you recommend using the 3.3 mod_jk?
 
 Thanks,
 --jeff
 
 - Original Message -
 From: Ignacio J. Ortega [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, April 23, 2001 3:31 PM
 Subject: RE: JDBC Realm problem
 
 
  Hola Jeff:
 
  Some people has reported problems that lookclose to yours..no solutions
  ... please test against latest code on CVS for 3.2 branch...3.3 code (m2
  is known to be broken in auth ...get it from CVS until m3 arrives..)..
  or 4.0 Beta2...to give that problem another shake.. in different
  flavours of tomcat..to se if that makes a difference ( i dont believe
  that's wil be true but who knows ..)
 
  For me until now...with one more code review done after reading your
  message...this problem relates to the MySql JDBC Driver...so change you
  Driver jar version to see if that makes a difference..
 
  Sorry for trying to augment your problems ... not solve them..:)))
 
  TIA.
 
  ( Please do not use HTML mail makes hard to chat, thanks)
 
  Saludos ,
  Ignacio J. Ortega
-- 





Re: JDBC Realm problem

2001-04-23 Thread Jeff Kilbride

Hi Andrew,

From the mm.mysql docs:

Name: autoReconnect
Use: should the driver attempt to re-connect if the connection dies?
(true/false)
Default Value: false

I wouldn't have found this without your pointer, so thanks! I'll give it a
try and see what happens.

I'd love to see your connection pool implementation for JDBCRealm. Would you
be willing to send it to me outside the list?

Thanks,
--jeff

- Original Message -
From: Andrew Robson [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, April 23, 2001 5:56 PM
Subject: Re: JDBC Realm problem


 Hi Jeff,
   I had exactly the same problem (with mm 2.0.2) and only
 solved it by customisng JDBCRealm to use database
 connection pooling. A bit heavy handed but might be
 a lot easier than trying to track potential driver problem if time is
 an issue. I have also seen a suggestinon on the list that adding
 autoreconnect=true to the database connection string solves
 the problem but I haven't tried it myself.

 andrew

 On Mon, 23 Apr 2001, you wrote:
  Hi Ignacio,
 
  Thanks for the quick response! First, my apologies for the HTML format.
I
  didn't realize I hadn't changed this machine...
 
  I'll try the 3.2.2 branch and see what happens. Any word on a final
release
  for 3.2.2?
 
  I'm using the 2.0.4 drivers for MySQL, which seem to be the latest. Can
you
  be more specific on why this relates to the driver? If so, I'll take a
look
  at the driver code and see if I can locate the problem or recommend a
  solution to the mm.mysql developer.
 
  On another note, I've seen discussions saying the mod_jk implementation
in
  the 3.3 branch is implemented/optimized better than the mod_jk in 3.2.*.
Do
  you recommend using the 3.3 mod_jk?
 
  Thanks,
  --jeff
 
  - Original Message -
  From: Ignacio J. Ortega [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Monday, April 23, 2001 3:31 PM
  Subject: RE: JDBC Realm problem
 
 
   Hola Jeff:
  
   Some people has reported problems that lookclose to yours..no
solutions
   ... please test against latest code on CVS for 3.2 branch...3.3 code
(m2
   is known to be broken in auth ...get it from CVS until m3 arrives..)..
   or 4.0 Beta2...to give that problem another shake.. in different
   flavours of tomcat..to se if that makes a difference ( i dont believe
   that's wil be true but who knows ..)
  
   For me until now...with one more code review done after reading your
   message...this problem relates to the MySql JDBC Driver...so change
you
   Driver jar version to see if that makes a difference..
  
   Sorry for trying to augment your problems ... not solve them..:)))
  
   TIA.
  
   ( Please do not use HTML mail makes hard to chat, thanks)
  
   Saludos ,
   Ignacio J. Ortega
 --






RE: JDBC Realm problem

2001-04-23 Thread Ignacio J. Ortega

Hola Jeff:

 Hi Ignacio,
 
 Thanks for the quick response! First, my apologies for the 
 HTML format. I
 didn't realize I hadn't changed this machine...
 
 I'll try the 3.2.2 branch and see what happens. Any word on a 
 final release
 for 3.2.2?
 

Soon will be out Beta3 ( i dont recall , perhaps is Beta4  dont take my
word as knife ) , i think 3.2.2 will be out really soon, same for 3.3
Beta1 ..soon ...in weeks...


 I'm using the 2.0.4 drivers for MySQL, which seem to be the 
 latest. Can you
 be more specific on why this relates to the driver? If so, 

Well nothing apart that i have many succesfull installations ...but
using Oracle Drivers, Interbase Drivers, as far as JDBC-ODBC Bridge too
works as a charm..without any complaint... but with you there are 2
persons with 2.0.4 drivers and problems .. too much for coincidences
;)...


 I'll take a look
 at the driver code and see if I can locate the problem or recommend a
 solution to the mm.mysql developer.
 

Good luck..but the fail it's very basiccan be catched in a while..or
not :)


 On another note, I've seen discussions saying the mod_jk 
 implementation in
 the 3.3 branch is implemented/optimized better than the 
 mod_jk in 3.2.*. Do
 you recommend using the 3.3 mod_jk?
 

Well mod_jk in 3.3 branch it's less buggy  more complete in the 3.3
branch ( it 's a no branch it's HEAD )..and it's fully compatible with
ajp13 implementation on 3.2..so the answer is yes you can use mod_jk
from 3.3..., 

h, recommend .too much for an email..use at your own risk :))) 

 Thanks,
 --jeff
 



Saludos ,
Ignacio J. Ortega

 - Original Message -
 From: Ignacio J. Ortega [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, April 23, 2001 3:31 PM
 Subject: RE: JDBC Realm problem
 
 
  Hola Jeff:
 
  Some people has reported problems that lookclose to 
 yours..no solutions
  ... please test against latest code on CVS for 3.2 
 branch...3.3 code (m2
  is known to be broken in auth ...get it from CVS until m3 
 arrives..)..
  or 4.0 Beta2...to give that problem another shake.. in different
  flavours of tomcat..to se if that makes a difference ( i 
 dont believe
  that's wil be true but who knows ..)
 
  For me until now...with one more code review done after reading your
  message...this problem relates to the MySql JDBC 
 Driver...so change you
  Driver jar version to see if that makes a difference..
 
  Sorry for trying to augment your problems ... not solve them..:)))
 
  TIA.
 
  ( Please do not use HTML mail makes hard to chat, thanks)
 
  Saludos ,
  Ignacio J. Ortega