I used the same Java 1.5 (the only Java on the system); the snippet occurs in the the build tree for the Tomcat project. The snippet was run inside Eclipse which is running under my own user login, so presumably that's how the snippet ran. I'm not sure what the user is when Tomcat runs -- I've started it both from Eclipse and from the shell script startup.sh.
The same Exception occurs.
[How do I determine the user in this case?]

Note that I've set the permissions for the entire tomcat installation to world -readable (r) and world executable (x), so I would think the user wouldn't make a difference to Tomcat
being able to read the jar.


On Apr 17, 2008, at 10:00 AM, Jim Cox wrote:

Do you use the same version of Java and run as the same user Tomcat runs
under when you run it "statically outside of Tomcat"?

On Thu, Apr 17, 2008 at 9:53 AM, Ken Bowen <[EMAIL PROTECTED]> wrote:

Hi all,

I've successfully built a number of Tomcat projects using MySQL, but now I have to also use PostgreSQL for a small demo app. I'm having some trouble
with the context and datasource.

Setup: Tomcat 5.5.26 (unzipped from the Apache site) on Mac OSX 10.5.2,
developing using Eclipse 6.0.1/MyEclipse;
PostreSQL 8.3.1 with postgresql-8.3-603.jdbc4.jar

The following test snippet works fine when run statically outside of
Tomcat:

public static void main (String[] args)
              throws ClassNotFoundException, SQLException
      {
              Class pgClass = Class.forName("org.postgresql.Driver");
String url = "jdbc:postgresql://localhost:5432/ trackerdb"; Connection connection = DriverManager.getConnection(url,
"trackermgr", "");
....goes on to retrieve rows from a table in trackerdb....

My Tomcat app has the following context.xml in META-INF:

<Context path="" debug="5" reloadable="true" crossContext="true">
 <Resource name="jdbc/trackerdb"  auth="Container"
type="javax.sql.DataSource"
           maxActive="100" maxIdle="30" maxWait="10000"
           username="trackermgr" password=""
           driverClassName="org.postgresql.Driver"
           url="postgresql://localhost:5432/trackerdb"/>
</Context>

There is an AppListener which successully uses this to construct a
DataSource.
However, when I get to attempting to obtain a Connection, I get the
following Exception:

Exception: Cannot create JDBC driver of class 'org.postgresql.Driver' for
connect URL 'postgresql://localhost:5432/trackerdb'
com.herenow.database.DAOException: Cannot create JDBC driver of class
'org.postgresql.Driver' for connect URL
'postgresql://localhost:5432/trackerdb'
      at
com.herenow.database.DAOBaseData.getConnection(DAOBaseData.java:38)
....etc....

However, the jar file postgresql-8.3-603.jdbc4.jar is present in the app's
lib:
tracker/WEB-INF/lib.  I've also tried moving the jar to tomcat's
common/lib, but I get
the same Exception.

What am I missing here?
Thanks in advance,
Ken Bowen
~
~
~
~
~
~
~
~
~
"tomcat-user-postgresql-context" 43L, 1985C written


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to