pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
JDBC driver works in  ccommand line, not in Tomcat5
6+ messages / 4 participants
[nested] [flat]

* JDBC driver works in  ccommand line, not in Tomcat5
@ 2007-09-04 14:11 Chris Baty <batymohn@yahoo.com>
  2007-09-05 01:31 ` Re: JDBC driver works in  ccommand line, not in Tomcat5 Giuseppe Sacco <giuseppe@eppesuigoccas.homedns.org>
  2007-09-05 07:11 ` Re: JDBC driver works in  ccommand line, not in Tomcat5 Kris Jurka <books@ejurka.com>
  0 siblings, 2 replies; 6+ messages in thread

From: Chris Baty @ 2007-09-04 14:11 UTC (permalink / raw)
  To: pgsql-jdbc

Hi Guys,
I'm trying to get Tomcat 5 to  access psql.  I created a "test' database and put several drivers in common/lib.  I keep getting 

org.postgresql.util.PSQLException: Something unusual has occured to cause the driver to fail. Please report this exception.

in my log  files.  This  same drive worked fine in a test  program I wrote in  the command line program.

Does aneone know what might be  happening?

Thanks.
Chris


       
____________________________________________________________________________________Ready for the edge of your seat? 
Check out tonight's top picks on Yahoo! TV. 
http://tv.yahoo.com/

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: JDBC driver works in  ccommand line, not in Tomcat5
  2007-09-04 14:11 JDBC driver works in  ccommand line, not in Tomcat5 Chris Baty <batymohn@yahoo.com>
@ 2007-09-05 01:31 ` Giuseppe Sacco <giuseppe@eppesuigoccas.homedns.org>
  1 sibling, 0 replies; 6+ messages in thread

From: Giuseppe Sacco @ 2007-09-05 01:31 UTC (permalink / raw)
  To: pgsql-jdbc

Il giorno mar, 04/09/2007 alle 07.11 -0700, Chris Baty ha scritto:
> Hi Guys,
> I'm trying to get Tomcat 5 to  access psql.  I created a "test'
> database and put several drivers in common/lib.  I keep getting 
>  
> org.postgresql.util.PSQLException: Something unusual has occured to
> cause the driver to fail. Please report this exception.
[...]

Could you please post the complete exception trace?




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: JDBC driver works in  ccommand line, not in Tomcat5
  2007-09-04 14:11 JDBC driver works in  ccommand line, not in Tomcat5 Chris Baty <batymohn@yahoo.com>
@ 2007-09-05 07:11 ` Kris Jurka <books@ejurka.com>
  2007-09-05 08:18   ` Re: JDBC driver works in  ccommand line, not in Tomcat5 Kris Jurka <books@ejurka.com>
  1 sibling, 1 reply; 6+ messages in thread

From: Kris Jurka @ 2007-09-05 07:11 UTC (permalink / raw)
  To: Chris Baty <batymohn@yahoo.com>; +Cc: pgsql-jdbc



On Tue, 4 Sep 2007, Chris Baty wrote:

> I'm trying to get Tomcat 5 to access psql.  I created a "test' database 
> and put several drivers in common/lib.  I keep getting
>
> org.postgresql.util.PSQLException: Something unusual has occured to 
> cause the driver to fail. Please report this exception.

This is probably caused by a permission denied error because you are 
running tomcat with a security policy that does not let you connect to 
outside resources (such as a database).

We should probably do a better job of catching and reporting this error 
with a helpful suggestion instead of the obscure message and request for a 
report above.

Kris Jurka



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: JDBC driver works in  ccommand line, not in Tomcat5
  2007-09-04 14:11 JDBC driver works in  ccommand line, not in Tomcat5 Chris Baty <batymohn@yahoo.com>
  2007-09-05 07:11 ` Re: JDBC driver works in  ccommand line, not in Tomcat5 Kris Jurka <books@ejurka.com>
@ 2007-09-05 08:18   ` Kris Jurka <books@ejurka.com>
  2007-09-05 15:07     ` Re: JDBC driver works in ccommand line, not in Tomcat5 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 6+ messages in thread

From: Kris Jurka @ 2007-09-05 08:18 UTC (permalink / raw)
  To: Chris Baty <batymohn@yahoo.com>; +Cc: pgsql-jdbc



On Wed, 5 Sep 2007, Kris Jurka wrote:

> This is probably caused by a permission denied error because you are running 
> tomcat with a security policy that does not let you connect to outside 
> resources (such as a database).
>
> We should probably do a better job of catching and reporting this error with 
> a helpful suggestion instead of the obscure message and request for a report 
> above.
>

Turns out this is pretty easy to do, I'm just not sure what the best text 
to report to the user is, so far I have:

     Your security policy has prevented the connection from being
     attempted.  You must grant the connect java.net.SocketPermission
     to the database server host and port that you wish to connect to.

It's a little awkward because it tries to tell you what you need to do, 
but since there are a number of ways to define a policy for different app 
servers and configurations, there's no way to be specific enough to 
solve the problem right here.  Anyone have a better suggestions?

Kris Jurka



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: JDBC driver works in ccommand line, not in Tomcat5
  2007-09-04 14:11 JDBC driver works in  ccommand line, not in Tomcat5 Chris Baty <batymohn@yahoo.com>
  2007-09-05 07:11 ` Re: JDBC driver works in  ccommand line, not in Tomcat5 Kris Jurka <books@ejurka.com>
  2007-09-05 08:18   ` Re: JDBC driver works in  ccommand line, not in Tomcat5 Kris Jurka <books@ejurka.com>
@ 2007-09-05 15:07     ` Tom Lane <tgl@sss.pgh.pa.us>
  2007-09-05 17:31       ` Re: JDBC driver works in ccommand line, not in Tomcat5 Kris Jurka <books@ejurka.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Tom Lane @ 2007-09-05 15:07 UTC (permalink / raw)
  To: Kris Jurka <books@ejurka.com>; +Cc: Chris Baty <batymohn@yahoo.com>; pgsql-jdbc

Kris Jurka <books@ejurka.com> writes:
> Turns out this is pretty easy to do, I'm just not sure what the best text 
> to report to the user is, so far I have:

>      Your security policy has prevented the connection from being
>      attempted.  You must grant the connect java.net.SocketPermission
>      to the database server host and port that you wish to connect to.

Can you really tell for sure that it's security policy and not something
else?  A message as specific as this would be downright
counterproductive if it's wrong.

FWIW, the backend's style guide would suggest dividing that into an
ERROR and a HINT, particularly if the HINT could be mistaken.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: JDBC driver works in ccommand line, not in Tomcat5
  2007-09-04 14:11 JDBC driver works in  ccommand line, not in Tomcat5 Chris Baty <batymohn@yahoo.com>
  2007-09-05 07:11 ` Re: JDBC driver works in  ccommand line, not in Tomcat5 Kris Jurka <books@ejurka.com>
  2007-09-05 08:18   ` Re: JDBC driver works in  ccommand line, not in Tomcat5 Kris Jurka <books@ejurka.com>
  2007-09-05 15:07     ` Re: JDBC driver works in ccommand line, not in Tomcat5 Tom Lane <tgl@sss.pgh.pa.us>
@ 2007-09-05 17:31       ` Kris Jurka <books@ejurka.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Kris Jurka @ 2007-09-05 17:31 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Chris Baty <batymohn@yahoo.com>; pgsql-jdbc



On Wed, 5 Sep 2007, Tom Lane wrote:

> Kris Jurka <books@ejurka.com> writes:
>> Turns out this is pretty easy to do, I'm just not sure what the best text
>> to report to the user is, so far I have:
>
>>      Your security policy has prevented the connection from being
>>      attempted.  You must grant the connect java.net.SocketPermission
>>      to the database server host and port that you wish to connect to.
>
> Can you really tell for sure that it's security policy and not something
> else?  A message as specific as this would be downright
> counterproductive if it's wrong.

We can be pretty sure by checking if the connection setup failed because 
of an AccessControlException:

http://java.sun.com/j2se/1.5.0/docs/api/java/security/AccessControlException.html


> FWIW, the backend's style guide would suggest dividing that into an
> ERROR and a HINT, particularly if the HINT could be mistaken.
>

We don't have separate fields, but I agree it's a little strong, perhaps 
"You probably need to" instead of "You must".

Kris Jurka



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2007-09-05 17:31 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-09-04 14:11 JDBC driver works in  ccommand line, not in Tomcat5 Chris Baty <batymohn@yahoo.com>
2007-09-05 01:31 ` Giuseppe Sacco <giuseppe@eppesuigoccas.homedns.org>
2007-09-05 07:11 ` Kris Jurka <books@ejurka.com>
2007-09-05 08:18   ` Kris Jurka <books@ejurka.com>
2007-09-05 15:07     ` Re: JDBC driver works in ccommand line, not in Tomcat5 Tom Lane <tgl@sss.pgh.pa.us>
2007-09-05 17:31       ` Re: JDBC driver works in ccommand line, not in Tomcat5 Kris Jurka <books@ejurka.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox