Re: Cannot create JDBC driver of class '' for connect URL 'null'

2004-04-05 Thread Andy Grove
I found the problem.

To get it working I needed to have the  and 
in the Global section and then add a  in the context for
my webapp. This enabled Tomcat to resolve the parameters.

I've posted my config files here for anyone interested:

http://www.codefutures.com/weblog/openknowledge/archives/77.html

On Mon, 2004-04-05 at 15:08, Andy Grove wrote:

> Thanks Harry but the problem is that it is not even trying to load the
> Postgres driver - it is not getting that far. It is trying to load JDBC
> driver class '' (empty string) and is trying to access JDBC URL of
> 'null'. It seems that the ResourceParams section is not being used. 
> 
> I do have the postgres jar deployed to common/lib.
> 
> Thanks.
> 
> On Mon, 2004-04-05 at 14:52, Harry Mantheakis wrote:
> 
> > Hello
> > 
> > 
> > > My web.xml contains:
> > 
> > 
> > That looks the same as mine (which works) so no problem there. You do not
> > actually *need* this element in the deployment descriptor if you are using
> > Tomcat 5, but it makes your code portable, should you ever (God forbid!)
> > switch to another servlet container.
> > 
> > 
> > > My $TOMCAT_HOME/conf/server.xml contains the following...
> > 
> > 
> > BTW, it is $CATALINA_HOME that matters - $TOMCAT_HOME is not used.
> > 
> > Looking at your resource definitions, this sub-element:
> > 
> > 
> > 
> >  url
> >  
> >  jdbc:postgresql://localhost/mydb
> >  
> > 
> > 
> > 
> > Maybe should read:
> > 
> > 
> > 
> >  url
> >  
> >  jdbc:postgresql://localhost:5432/mydb
> >  
> > 
> > 
> > 
> > Mine, at least, needs a port number to be specified.
> > 
> > The rest of the resource element looks okay to me. Also, your look-up code
> > looks good too, so my only guess is that you have forgotten to put the
> > PostgreSQL JDBC driver under the container's classpath.
> > 
> > You probably have the driver located under your application's 'WEB-INF/lib'
> > directory.
> > 
> > Try placing the driver in the '$CATALINA_HOME/common/lib' directory, but do
> > not have it both places! (Remove it from the 'WEB-INF/lib' directory.)
> > 
> > Also, make sure you have a driver named 'pg74.1jdbc3.jar'. The one that
> > comes bundled with the PostgreSQL 7.4 RPM is out of date. You can download
> > the 7.4 driver from PG's JDBC site.
> > 
> > Good luck.
> > 
> > Harry Mantheakis
> > London, UK
> > 
> > 
> > 
> > 
> > > Hi,
> > > 
> > > I am trying to convert my Tomcat web application to use JNDI to lookup a
> > > DataSource rather than using DriverManager directly. My application
> > > works fine using DriverManager so I know I have my classpath set up
> > > correctly. 
> > > 
> > > The problem I have seems to be a very common one yet I cannot find a
> > > solution to it using Google. I am getting the following error message
> > > when I attempt to look up a DataSource:
> > > 
> > > Cannot create JDBC driver of class '' for connect URL 'null'
> > > 
> > > This implies to me that Tomcat is recognizing my  declaration
> > > in my conf/server.xml but is not loading the associated
> > > . I get this problem with Tomcat 4.1 and 5.0 on Red Hat
> > > 9 with Sun JDK 1.4.2.
> > > 
> > > My web.xml contains:
> > > 
> > > 
> > >   DB Connection
> > >   jdbc/mydb
> > >   javax.sql.DataSource
> > >   Container
> > > 
> > > 
> > > My $TOMCAT_HOME/conf/server.xml contains the following (I have tried
> > > defining this within the context of my webapp and also in the
> > > GlobalNamingResources section).
> > > 
> > >  > > />
> > >  
> > > 
> > >   
> > > factory
> > > org.apache.commons.dbcp.BasicDataSourceFactory
> > >   
> > >   
> > > maxActive
> > > 100
> > >   
> > >   
> > > maxIdle
> > > 30
> > >   
> > >   
> > > maxWait
> > > 1
> > >   
> > >   
> > >username
> > >ebay
> > >   
> > >   
> > >password
> > >
> > >   
> > >   
> > >  driverClassName
> > >  org.postgresql.Driver
> > >   
> > >   
> > > url
> > > jdbc:postgresql://localhost/mydb
> > >   
> > > 
> > > 
> > > Lastly, my Java code is as follows:
> > > 
> > > InitialContext initCtx = new InitialContext();
> > > Object obj = initCtx.lookup( "java:comp/env/jdbc/mydb" );
> > > DataSource ds = (DataSource) obj;
> > > return ds.getConnection();
> > > 
> > > Does anyone have JNDI working with Tomcat? Any help would be much
> > > appreciated!
> > > 
> > > Thanks,
> > > 
> > > Andy Grove.
> > > 
> > > 
> > 
> > 
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 


Re: Cannot create JDBC driver of class '' for connect URL 'null'

2004-04-05 Thread Andy Grove
Thanks Harry but the problem is that it is not even trying to load the
Postgres driver - it is not getting that far. It is trying to load JDBC
driver class '' (empty string) and is trying to access JDBC URL of
'null'. It seems that the ResourceParams section is not being used. 

I do have the postgres jar deployed to common/lib.

Thanks.

On Mon, 2004-04-05 at 14:52, Harry Mantheakis wrote:

> Hello
> 
> 
> > My web.xml contains:
> 
> 
> That looks the same as mine (which works) so no problem there. You do not
> actually *need* this element in the deployment descriptor if you are using
> Tomcat 5, but it makes your code portable, should you ever (God forbid!)
> switch to another servlet container.
> 
> 
> > My $TOMCAT_HOME/conf/server.xml contains the following...
> 
> 
> BTW, it is $CATALINA_HOME that matters - $TOMCAT_HOME is not used.
> 
> Looking at your resource definitions, this sub-element:
> 
> 
> 
>  url
>  
>  jdbc:postgresql://localhost/mydb
>  
> 
> 
> 
> Maybe should read:
> 
> 
> 
>  url
>  
>  jdbc:postgresql://localhost:5432/mydb
>  
> 
> 
> 
> Mine, at least, needs a port number to be specified.
> 
> The rest of the resource element looks okay to me. Also, your look-up code
> looks good too, so my only guess is that you have forgotten to put the
> PostgreSQL JDBC driver under the container's classpath.
> 
> You probably have the driver located under your application's 'WEB-INF/lib'
> directory.
> 
> Try placing the driver in the '$CATALINA_HOME/common/lib' directory, but do
> not have it both places! (Remove it from the 'WEB-INF/lib' directory.)
> 
> Also, make sure you have a driver named 'pg74.1jdbc3.jar'. The one that
> comes bundled with the PostgreSQL 7.4 RPM is out of date. You can download
> the 7.4 driver from PG's JDBC site.
> 
> Good luck.
> 
> Harry Mantheakis
> London, UK
> 
> 
> 
> 
> > Hi,
> > 
> > I am trying to convert my Tomcat web application to use JNDI to lookup a
> > DataSource rather than using DriverManager directly. My application
> > works fine using DriverManager so I know I have my classpath set up
> > correctly. 
> > 
> > The problem I have seems to be a very common one yet I cannot find a
> > solution to it using Google. I am getting the following error message
> > when I attempt to look up a DataSource:
> > 
> > Cannot create JDBC driver of class '' for connect URL 'null'
> > 
> > This implies to me that Tomcat is recognizing my  declaration
> > in my conf/server.xml but is not loading the associated
> > . I get this problem with Tomcat 4.1 and 5.0 on Red Hat
> > 9 with Sun JDK 1.4.2.
> > 
> > My web.xml contains:
> > 
> > 
> >   DB Connection
> >   jdbc/mydb
> >   javax.sql.DataSource
> >   Container
> > 
> > 
> > My $TOMCAT_HOME/conf/server.xml contains the following (I have tried
> > defining this within the context of my webapp and also in the
> > GlobalNamingResources section).
> > 
> >  > />
> >  
> > 
> >   
> > factory
> > org.apache.commons.dbcp.BasicDataSourceFactory
> >   
> >   
> > maxActive
> > 100
> >   
> >   
> > maxIdle
> > 30
> >   
> >   
> > maxWait
> > 1
> >   
> >   
> >username
> >ebay
> >   
> >   
> >password
> >
> >   
> >   
> >  driverClassName
> >  org.postgresql.Driver
> >   
> >   
> > url
> > jdbc:postgresql://localhost/mydb
> >   
> > 
> > 
> > Lastly, my Java code is as follows:
> > 
> > InitialContext initCtx = new InitialContext();
> > Object obj = initCtx.lookup( "java:comp/env/jdbc/mydb" );
> > DataSource ds = (DataSource) obj;
> > return ds.getConnection();
> > 
> > Does anyone have JNDI working with Tomcat? Any help would be much
> > appreciated!
> > 
> > Thanks,
> > 
> > Andy Grove.
> > 
> > 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


Cannot create JDBC driver of class '' for connect URL 'null'

2004-04-05 Thread Andy Grove
Hi,

I am trying to convert my Tomcat web application to use JNDI to lookup a
DataSource rather than using DriverManager directly. My application
works fine using DriverManager so I know I have my classpath set up
correctly. 

The problem I have seems to be a very common one yet I cannot find a
solution to it using Google. I am getting the following error message
when I attempt to look up a DataSource:

Cannot create JDBC driver of class '' for connect URL 'null'

This implies to me that Tomcat is recognizing my  declaration
in my conf/server.xml but is not loading the associated
. I get this problem with Tomcat 4.1 and 5.0 on Red Hat
9 with Sun JDK 1.4.2.

My web.xml contains:

  
DB Connection
jdbc/mydb
javax.sql.DataSource
Container
  

My $TOMCAT_HOME/conf/server.xml contains the following (I have tried
defining this within the context of my webapp and also in the
GlobalNamingResources section).

 
   
  


  factory
  org.apache.commons.dbcp.BasicDataSourceFactory


  maxActive
  100


  maxIdle
  30


  maxWait
  1


 username
 ebay


 password
 


   driverClassName
   org.postgresql.Driver


  url
  jdbc:postgresql://localhost/mydb

  

Lastly, my Java code is as follows:

InitialContext initCtx = new InitialContext();
Object obj = initCtx.lookup( "java:comp/env/jdbc/mydb" );
DataSource ds = (DataSource) obj;
return ds.getConnection();

Does anyone have JNDI working with Tomcat? Any help would be much
appreciated!

Thanks,

Andy Grove.



Where to find mod_jk2 for redhat?

2004-03-24 Thread Andy Grove
Hi,

I'm using Apache 2.0.46 and Tomcat 4.1.29 on Red Hat Enterprise Linux
and I am looking for the correct mod_jk2.so to use. 

There are no linux binary releases on the Jakarta site and the library
that I use successfully on another redhat server gives me this error
when starting Apache:

Starting httpd: httpd: module "../../server/apache2/mod_jk2.c" is not
compatible with this version of Apache (found 20020628, need 20020903).
Please contact the vendor for the correct version.

I did try downloading the source from the Jakarta site bu the build
script refers to util directory that is not in the source distribution
(does anyone know why?).

Any help would be much appreciated!

Cheers,

Andy Grove.