RE: JNDI Datasource is *still* null

2002-10-15 Thread James hughes

Ok, now I feel really silly.

It has been pointed out to me that I have "java.sql.DataSource" as opposed
to "javax.sql.DataSource" in my Resource definition in server.xml

It all works now!  Silly mistake, although I wish there had been a stack
trace somewhere to tell me this.

Thanks for your responses.
J

-Original Message-
From: Raj Saini [mailto:[EMAIL PROTECTED]]
Sent: 15 October 2002 10:23
To: Tomcat Users List
Subject: Re: JNDI Datasource is *still* null


Please post the Context defination part of your server.xml. Can you also 
post the stacktrace?

BTW, do you have the latest oracle driver? Did you rename your 
classes.zip to classes.jar?

Raj
James hughes wrote:
> Made the changes, still no DataSource.
> 
> -Original Message-
> From: Raj Saini [mailto:[EMAIL PROTECTED]]
> Sent: 14 October 2002 19:42
> To: Tomcat Users List
> Subject: Re: JNDI Datasource is null
> 
> 
> Hi,
> 
> Do you really need the CharacterSetMappers in your context defination? 
> Try using the vanila configuration for testing.
> 
> Try moving up the DriverClassName element just about the url.
> 
> Raj Saini
> 
> James hughes wrote:
> 
>>Surely there must be somebody out there who has connection pooling working
>>with DBCP and Oracle.
>>
>>Please! :)
>>
>>-Original Message-
>>From: James hughes [mailto:[EMAIL PROTECTED]]
>>Sent: 14 October 2002 14:55
>>To: Tomcat Users List
>>Subject: RE: JNDI Datasource is null
>>
>>
>>I changed the values, but still the Datasource is null :(
>>
>>I find it strange that the JNDI name exists with no object - that is, I
> 
> dont
> 
>>get a NameNotFoundException.
>>
>>
>>-Original Message-
>>From: Jacob Kjome [mailto:[EMAIL PROTECTED]]
>>Sent: 14 October 2002 14:53
>>To: Tomcat Users List
>>Subject: Re: JNDI Datasource is null
>>
>>
>>
>>2 things are possible culprits
>>
>>The syntax for JNDI datasources changed slightly after moving from Tyrex
> 
> as 
> 
>>the default provider to DBCP.  Specifically, "user" should be 
>>"username".  The other thing is the .  That 
>>might be right, but I've never used it.  I use "Container" for that value.
>>
>>Jake
>>
>>At 02:07 PM 10/14/2002 +0100, you wrote:
>>
>>
>>>Hi there,
>>>
>>>I am using Oracle 9i, DBCP and Tomcat 4.1.12.  I am trying to configure a
>>>JNDI datasource that implements connection pooling.  I have been
following
>>>the instructions in the JNDI how to, specifically the section for Oracle.
>>>
>>>My problem is that the JNDI Datasource is null when I try to get it from
>>
>>the
>>
>>
>>>context.  I cant see any exceptions being thrown anywhere.
>>>
>>>Can anyone tell me what I have missed?
>>>
>>>My server.xml is as follows (this entry is in the HOST tag, after the
>>>/examples context):
>>>
>>>   >>cachingAllowed="true"
>>>
>>
>>charsetMapperClass="org.apache.catalina.util.CharsetMapper"
>>
>>
>>>cookies="true"
>>>crossContext="true"
>>>debug="5" docBase="TestDB"
>>>
>>>mapperClass="org.apache.catalina.core.StandardContextMapper"
>>>path="/TestDB" privileged="false"
>>>reloadable="true" swallowOutput="false"
>>>useNaming="true"
>>>wrapperClass="org.apache.catalina.core.StandardWrapper">
>>> >> debug="0" directory="logs"
>>> prefix="localhost_DBTest_log."
>>> suffix=".txt" timestamp="true" verbosity="1"/>
>>> >
>>scope="Shareable"
>>
>>
>>>type="java.sql.DataSource"/>
>>> 
>>>   
>>> factory
>>>
>>org.apache.commons.dbcp.BasicDataSourceFactory
>>
>>>   
>>>   
>>> url
>>> jdbc:oracle:thin:@127.0.0.1:1521:RHODES
>>>   
>>>   
>>> password
>>> tiger
>>>   
>>>   
>>> maxActive
>>> 20
>>&g

RE: JNDI Datasource is *still* null

2002-10-15 Thread James hughes

Made the changes, still no DataSource.

-Original Message-
From: Raj Saini [mailto:[EMAIL PROTECTED]]
Sent: 14 October 2002 19:42
To: Tomcat Users List
Subject: Re: JNDI Datasource is null


Hi,

Do you really need the CharacterSetMappers in your context defination? 
Try using the vanila configuration for testing.

Try moving up the DriverClassName element just about the url.

Raj Saini

James hughes wrote:
> Surely there must be somebody out there who has connection pooling working
> with DBCP and Oracle.
> 
> Please! :)
> 
> -Original Message-----
> From: James hughes [mailto:[EMAIL PROTECTED]]
> Sent: 14 October 2002 14:55
> To: Tomcat Users List
> Subject: RE: JNDI Datasource is null
> 
> 
> I changed the values, but still the Datasource is null :(
> 
> I find it strange that the JNDI name exists with no object - that is, I
dont
> get a NameNotFoundException.
> 
> 
> -Original Message-
> From: Jacob Kjome [mailto:[EMAIL PROTECTED]]
> Sent: 14 October 2002 14:53
> To: Tomcat Users List
> Subject: Re: JNDI Datasource is null
> 
> 
> 
> 2 things are possible culprits
> 
> The syntax for JNDI datasources changed slightly after moving from Tyrex
as 
> the default provider to DBCP.  Specifically, "user" should be 
> "username".  The other thing is the .  That 
> might be right, but I've never used it.  I use "Container" for that value.
> 
> Jake
> 
> At 02:07 PM 10/14/2002 +0100, you wrote:
> 
>>Hi there,
>>
>>I am using Oracle 9i, DBCP and Tomcat 4.1.12.  I am trying to configure a
>>JNDI datasource that implements connection pooling.  I have been following
>>the instructions in the JNDI how to, specifically the section for Oracle.
>>
>>My problem is that the JNDI Datasource is null when I try to get it from
> 
> the
> 
>>context.  I cant see any exceptions being thrown anywhere.
>>
>>Can anyone tell me what I have missed?
>>
>>My server.xml is as follows (this entry is in the HOST tag, after the
>>/examples context):
>>
>>> cachingAllowed="true"
>>
> 
> charsetMapperClass="org.apache.catalina.util.CharsetMapper"
> 
>> cookies="true"
>> crossContext="true"
>> debug="5" docBase="TestDB"
>>
>>mapperClass="org.apache.catalina.core.StandardContextMapper"
>> path="/TestDB" privileged="false"
>> reloadable="true" swallowOutput="false"
>> useNaming="true"
>> wrapperClass="org.apache.catalina.core.StandardWrapper">
>>  >  debug="0" directory="logs"
>>  prefix="localhost_DBTest_log."
>>  suffix=".txt" timestamp="true" verbosity="1"/>
>>   
> scope="Shareable"
> 
>>type="java.sql.DataSource"/>
>>  
>>
>>  factory
>>
> org.apache.commons.dbcp.BasicDataSourceFactory
> 
>>
>>
>>  url
>>  jdbc:oracle:thin:@127.0.0.1:1521:RHODES
>>
>>
>>  password
>>  tiger
>>
>>
>>  maxActive
>>  20
>>
>>
>>  maxWait
>>  10
>>
>>
>>  driverClassName
>>  oracle.jdbc.driver.OracleDriver
>>
>>
>>  user
>>  scott
>>
>>
>>  maxIdle
>>  10
>>
>>  
>>
>>
>>
>>And web.xml is as follows:
>>
>>  
>>Oracle Datasource example
>>jdbc/myoracle
>>javax.sql.DataSource
>>Container
>>  
>>
>>
>>
>>I have a class as follows:
>>
>>package foo;
>>
>>import javax.naming.*;
>>import javax.sql.*;
>>import java.sql.*;
>>
>>public class DBTest
>>{
>>  String foo = "Not Connected";
>>  int bar = -1;
>>
>>public void init()
>>{
>>try
>>{
>> 

RE: JNDI Datasource is null

2002-10-14 Thread James hughes

Surely there must be somebody out there who has connection pooling working
with DBCP and Oracle.

Please! :)

-Original Message-
From: James hughes [mailto:[EMAIL PROTECTED]]
Sent: 14 October 2002 14:55
To: Tomcat Users List
Subject: RE: JNDI Datasource is null


I changed the values, but still the Datasource is null :(

I find it strange that the JNDI name exists with no object - that is, I dont
get a NameNotFoundException.


-Original Message-
From: Jacob Kjome [mailto:[EMAIL PROTECTED]]
Sent: 14 October 2002 14:53
To: Tomcat Users List
Subject: Re: JNDI Datasource is null



2 things are possible culprits

The syntax for JNDI datasources changed slightly after moving from Tyrex as 
the default provider to DBCP.  Specifically, "user" should be 
"username".  The other thing is the .  That 
might be right, but I've never used it.  I use "Container" for that value.

Jake

At 02:07 PM 10/14/2002 +0100, you wrote:
>Hi there,
>
>I am using Oracle 9i, DBCP and Tomcat 4.1.12.  I am trying to configure a
>JNDI datasource that implements connection pooling.  I have been following
>the instructions in the JNDI how to, specifically the section for Oracle.
>
>My problem is that the JNDI Datasource is null when I try to get it from
the
>context.  I cant see any exceptions being thrown anywhere.
>
>Can anyone tell me what I have missed?
>
>My server.xml is as follows (this entry is in the HOST tag, after the
>/examples context):
>
>   cachingAllowed="true"
>
charsetMapperClass="org.apache.catalina.util.CharsetMapper"
>
>  cookies="true"
>  crossContext="true"
>  debug="5" docBase="TestDB"
>
>mapperClass="org.apache.catalina.core.StandardContextMapper"
>  path="/TestDB" privileged="false"
>  reloadable="true" swallowOutput="false"
>  useNaming="true"
>  wrapperClass="org.apache.catalina.core.StandardWrapper">
>  debug="0" directory="logs"
>   prefix="localhost_DBTest_log."
>   suffix=".txt" timestamp="true" verbosity="1"/>
>   type="java.sql.DataSource"/>
>   
> 
>   factory
>
org.apache.commons.dbcp.BasicDataSourceFactory
> 
> 
>   url
>   jdbc:oracle:thin:@127.0.0.1:1521:RHODES
> 
> 
>   password
>   tiger
> 
> 
>   maxActive
>   20
> 
> 
>   maxWait
>   10
> 
> 
>   driverClassName
>   oracle.jdbc.driver.OracleDriver
> 
> 
>   user
>   scott
> 
> 
>   maxIdle
>   10
> 
>   
> 
>
>
>And web.xml is as follows:
>
>   
> Oracle Datasource example
> jdbc/myoracle
> javax.sql.DataSource
> Container
>   
>
>
>
>I have a class as follows:
>
>package foo;
>
>import javax.naming.*;
>import javax.sql.*;
>import java.sql.*;
>
>public class DBTest
>{
>   String foo = "Not Connected";
>   int bar = -1;
>
> public void init()
> {
> try
> {
> Context ctx = new InitialContext();
> if(ctx == null )
> {
> throw new Exception("Boom - No Context");
> }
>
> Context envContext  =
>(Context)ctx.lookup("java:/comp/env");
> DataSource ds =
>(DataSource)envContext.lookup("jdbc/myoracle");
>
> if (ds != null)
> {
> Connection conn = ds.getConnection();
>
> if(conn != null)
> {
> foo = "Got Connection
>"+conn.toString();
> Statement stmt =
>conn.createStatement();
> ResultSet rst =
>stmt.executeQuery("select id, foo, bar from testdata");
>
>

RE: JNDI Datasource is null

2002-10-14 Thread James hughes

I changed the values, but still the Datasource is null :(

I find it strange that the JNDI name exists with no object - that is, I dont
get a NameNotFoundException.


-Original Message-
From: Jacob Kjome [mailto:[EMAIL PROTECTED]]
Sent: 14 October 2002 14:53
To: Tomcat Users List
Subject: Re: JNDI Datasource is null



2 things are possible culprits

The syntax for JNDI datasources changed slightly after moving from Tyrex as 
the default provider to DBCP.  Specifically, "user" should be 
"username".  The other thing is the .  That 
might be right, but I've never used it.  I use "Container" for that value.

Jake

At 02:07 PM 10/14/2002 +0100, you wrote:
>Hi there,
>
>I am using Oracle 9i, DBCP and Tomcat 4.1.12.  I am trying to configure a
>JNDI datasource that implements connection pooling.  I have been following
>the instructions in the JNDI how to, specifically the section for Oracle.
>
>My problem is that the JNDI Datasource is null when I try to get it from
the
>context.  I cant see any exceptions being thrown anywhere.
>
>Can anyone tell me what I have missed?
>
>My server.xml is as follows (this entry is in the HOST tag, after the
>/examples context):
>
>   cachingAllowed="true"
>
charsetMapperClass="org.apache.catalina.util.CharsetMapper"
>
>  cookies="true"
>  crossContext="true"
>  debug="5" docBase="TestDB"
>
>mapperClass="org.apache.catalina.core.StandardContextMapper"
>  path="/TestDB" privileged="false"
>  reloadable="true" swallowOutput="false"
>  useNaming="true"
>  wrapperClass="org.apache.catalina.core.StandardWrapper">
>  debug="0" directory="logs"
>   prefix="localhost_DBTest_log."
>   suffix=".txt" timestamp="true" verbosity="1"/>
>   type="java.sql.DataSource"/>
>   
> 
>   factory
>
org.apache.commons.dbcp.BasicDataSourceFactory
> 
> 
>   url
>   jdbc:oracle:thin:@127.0.0.1:1521:RHODES
> 
> 
>   password
>   tiger
> 
> 
>   maxActive
>   20
> 
> 
>   maxWait
>   10
> 
> 
>   driverClassName
>   oracle.jdbc.driver.OracleDriver
> 
> 
>   user
>   scott
> 
> 
>   maxIdle
>   10
> 
>   
> 
>
>
>And web.xml is as follows:
>
>   
> Oracle Datasource example
> jdbc/myoracle
> javax.sql.DataSource
> Container
>   
>
>
>
>I have a class as follows:
>
>package foo;
>
>import javax.naming.*;
>import javax.sql.*;
>import java.sql.*;
>
>public class DBTest
>{
>   String foo = "Not Connected";
>   int bar = -1;
>
> public void init()
> {
> try
> {
> Context ctx = new InitialContext();
> if(ctx == null )
> {
> throw new Exception("Boom - No Context");
> }
>
> Context envContext  =
>(Context)ctx.lookup("java:/comp/env");
> DataSource ds =
>(DataSource)envContext.lookup("jdbc/myoracle");
>
> if (ds != null)
> {
> Connection conn = ds.getConnection();
>
> if(conn != null)
> {
> foo = "Got Connection
>"+conn.toString();
> Statement stmt =
>conn.createStatement();
> ResultSet rst =
>stmt.executeQuery("select id, foo, bar from testdata");
>
> if(rst.next())
> {
> foo = rst.getString(2);
> bar = rst.getInt(3);
> }
>
> conn.close();
> }
> }
> else
> {
> System.out.println("DS was null!");
> }
> }
> catch(Exception e)
> {
> e.printStackTrace();
> }
> }
>
> public String getFoo() { return foo; }
> public int getBar() { return bar;}
>}
>
>
>
>And finally, a JSP as follows:
>
><% foo.DBTest tst = new foo.DBTest(); tst.init(); %>
>
>Results
>
>
>
>Foo <%= tst.getFoo() %> Bar <%= tst.getBar() %>
>
>-

JNDI Datasource is null

2002-10-14 Thread James hughes

Hi there,

I am using Oracle 9i, DBCP and Tomcat 4.1.12.  I am trying to configure a
JNDI datasource that implements connection pooling.  I have been following
the instructions in the JNDI how to, specifically the section for Oracle.

My problem is that the JNDI Datasource is null when I try to get it from the
context.  I cant see any exceptions being thrown anywhere.

Can anyone tell me what I have missed?

My server.xml is as follows (this entry is in the HOST tag, after the
/examples context):


  
  
  

  factory
  org.apache.commons.dbcp.BasicDataSourceFactory


  url
  jdbc:oracle:thin:@127.0.0.1:1521:RHODES


  password
  tiger


  maxActive
  20


  maxWait
  10


  driverClassName
  oracle.jdbc.driver.OracleDriver


  user
  scott


  maxIdle
  10

  



And web.xml is as follows:

  
Oracle Datasource example
jdbc/myoracle
javax.sql.DataSource
Container
  



I have a class as follows:

package foo;

import javax.naming.*;
import javax.sql.*;
import java.sql.*;

public class DBTest 
{
  String foo = "Not Connected";
  int bar = -1;

public void init() 
{
try
{
Context ctx = new InitialContext();
if(ctx == null ) 
{
throw new Exception("Boom - No Context");
}

Context envContext  =
(Context)ctx.lookup("java:/comp/env");
DataSource ds =
(DataSource)envContext.lookup("jdbc/myoracle");

if (ds != null)
{
Connection conn = ds.getConnection();

if(conn != null)
{
foo = "Got Connection
"+conn.toString();
Statement stmt =
conn.createStatement();
ResultSet rst =
stmt.executeQuery("select id, foo, bar from testdata");

if(rst.next())
{
foo = rst.getString(2);
bar = rst.getInt(3);
}

conn.close();
}
}
else
{
System.out.println("DS was null!");
}
}
catch(Exception e)
{
e.printStackTrace();
}
}

public String getFoo() { return foo; }
public int getBar() { return bar;}
}



And finally, a JSP as follows:


  
DB Test
  
  

  <%
foo.DBTest tst = new foo.DBTest();
tst.init();
  %>

  Results
Foo <%= tst.getFoo() %>
Bar <%= tst.getBar() %>

  



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




HTML compression

2002-02-25 Thread James Hughes

Hi All,
I'm looking for a little advice on some JSP server implementation. I want to
strip white space and comments (both HTML and JavaScript) from web pages at
compile time to minimize file sizes. I've poked around a bit and and all I
could find was "filters", but I'm not sure that's what I'm really looking
for. It seems that filters are best used dynamically to change incoming or
outgoing requests, but in my case, the pages are really just static and
precompiled.
Does anyone have any experience with this? or better yet, pointers to some
stable Java code to do it?

Thanks in advance,
James Hughes




--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>




Capturing all errors in Tomcat

2001-10-18 Thread James Hughes

Hi,

I am using tomcat 3.2.1 with apache 1.3.19

I want either tomcat (preferably) or apache to capture all my HTTP 500 and
404 errors and output a standard piece of html that I have.

I understand that for tomcat to do this i need the following in my web.xml:


  500
  mySpecialErrorPage.html


  404
  mySpecialErrorPage.html


I have this, but tomcat is not displaying my page when I type a non-existent
url into my browser.

Does anybody have any ideas what I am doing wrong or have at least the
definitive answer to error handling in tomcat 3.2.1?

Thanks in advance
J




Passing paramters to JSPs

2001-08-09 Thread James Hughes

Hi,

For my servlets I am using the web.xml file to provide (fairly static)
parameters for the servlets.

I now have some JSPs, and was wondering how to do similar parameter
passing - I cant find any cluse in the Servlet Specification - does anybody
know more about this?

Thanks,
J




Servlets in a JAR file in the lib directory of a WAR file

2001-07-27 Thread James Hughes

Is it valid to place servlets in a JAR file, and place them in the lib
directory (in WEB-INF dir of WAR file)?

Thanks,
J