RE: Has anyone used Tomcat 5.5.9 connecting to MS SQL Server usin g JNDI and Connection Pooling?

2005-08-24 Thread Wylie, Ian
Hi Allistair,

I just got the basic JNDI datasource working for MS SQL Server with Tomcat
5.5.

I tried using the ConnectionPoolDataSource instead of the standard
DataSource but I cannot get this working.

Not sure whether I need to replace the
res-typejavax.sql.DataSource/res-type with something else in the web.xml
file.

I changed the driverclass name from the standard datasource class of
com.microsoft.jdbc.sqlserver.SQLServerDriver - used with standard datasource
to the com.microsoft.jdbcx.sqlserver.SQLServerDataSource class used by MS
connection pooling in the TOMCAT_HOME/conf/Catalina/localhost/webappname.xml
file.  Also added the factory for PooledConnections -
factory=com.microsoft.jdbcx.sqlserver.SQLServerDataSourceFactory to the
TOMCAT_HOME/conf/Catalina/localhost/webappname.xml file. 

Any ideas to get the MS Connection Pooling working, or is there no need in
Tomcat 5.5  -   In aother words does Tomcat 5.5 automatically used Cnnection
Pooling with a datasource??

Many thanks for your help with this.

Best Regards,

Ian


-Original Message-
From: Allistair Crossley [mailto:[EMAIL PROTECTED]
Sent: 23 August 2005 16:05
To: Tomcat Users List; [EMAIL PROTECTED]
Subject: RE: Has anyone used Tomcat 5.5.9 connecting to MS SQL Server
usin g JNDI?


Hi Wade,

Can you perhaps resend the configuration files

server.xml
web.xml
yourapp.xml
listing of files in common/lib
listing of files in yourapp/WEB-INF/lib

Again?

Cheers, Allistair.

 -Original Message-
 From: Wade Chandler [mailto:[EMAIL PROTECTED]
 Sent: 22 August 2005 17:58
 To: Tomcat Users List
 Subject: RE: Has anyone used Tomcat 5.5.9 connecting to MS SQL Server
 usin g JNDI?
 
 
 --- Wylie, Ian [EMAIL PROTECTED] wrote:
 
  Allistair,
  
  My apologies for taking much longer than usual to
  get back to you but I had
  to finish some Java code that allowed us to upgrade
  our portal to PlumTree
  version 5.
  
  To clarify and answer your points below.
  
  1)  I have opted not to have a context.xml file in
  the META-INF directory
  but I am using the 
  TOMCAT_HOME/conf/Catalina/localhost/webappname.xml
  file
  instead.
  
  2)  I  have ensured that the 3 MS JAR files for the
  JDBC connection exist
  only in TOMCAT_HOME/common/lib and not in my webapp
  lib.
  
  3)  I have changed the java code to use a simple
  'DataSource' instead of a
  'ConnectionPoolDataSource' connection.  See Java
  code snippet below :-
  
  Unfortunately I still get the error below :-
  
  ERROR - NamingException - Config error with JNDI
  and
  datasource.javax.naming.NamingException: Cannot
  create resource instance
  ERROR com.webconnex.cognos.PORT.OMTLreport  : Cannot
  create resource
  instance
  
  I have attached my web.xml and
  TOMCAT_HOME/conf/Catalina/localhost/webappname.xml
  files for your perusal.
  
  
  I am of yet no further forward in solving my
  problem.
  
  Any further insight would be appreciated, as Tomcat
  5 allows me to do quite
  a few things better, not least of which is
  debugging!!
  
  
  Java Code snippet :-
  
 
 =
  
  logger.debug(Before
  InitialContext.) ;
  InitialContext ctx = new
  InitialContext();
  if (ctx == null) { 
  log(ERROR initialising
  InitialContext.) ;  
  logger.error(ERROR initialising
  InitialContext.) ;
  }
  log(Before Context.) ;
  ds = (DataSource)
  ctx.lookup(java:comp/env/jdbc/UKportalPool);
  
  log(Before initialising
  DataSource.) ;
  
  if(ds != null) {
  con = ds.getConnection();
  if (con != null) {
  
  if ((pType != null) 
  (!pType.equals()))
  {
  userDetails = new
  pfUsersBean(pType,
  posName, typeCD, firstLineProduct);
  userSessionDetails = new
  pfUserSessionBean();
  userDetails.getPrefix(con,
  userDetails);  // See if User is in database
  
  //userDetails.getPrefix(pCon,
  userDetails);  // See if User is in database
  
   
  ptpResponse.setSettingValue(SettingType.Portlet,
  SalesCubePrefix,
  userDetails.getSalesCubePrefix() ) ;
   
  ptpResponse.setSettingValue(SettingType.Portlet,
  description,
  userDetails.getGeographyID() ) ;
   
  ptpResponse.setSettingValue(SettingType.Portlet,
  TMTLdescription,
  userDetails.getGeographyID() ) ;
   
  ptpResponse.setSettingValue(SettingType.Portlet,
  MSOdescription,
  userDetails.getGeographyID() ) ;
  }
  
  }
  else {
  log(ERROR - DB
  Connection returned was null in
  PortletHelper

RE: Has anyone used Tomcat 5.5.9 connecting to MS SQL Server usin g JNDI and Connection Pooling?

2005-08-24 Thread Wylie, Ian
Hi Allistair,

The problem was that I had duplicated the
TOMCAT_HOME/conf/Catalina/localhost/webappname.xml entry in server.xml.  So
I removed the context element from server.xml.

Then, the basic datasource JNDI started working.

I will investigate the change you suggested for Connection Pooling as well
as have a look at jTDS.

I will report back after further investigations.

It is great to be able to use Tomcat 5.5 with the JVM 1.5.

I have just downloaded and installed Eclipse 3.1 which can compile using the
JVM 1.5 - as one of my other tasks currently is to call a .NET web service
from Java.  I am hoping to get this working using Apache SOAP.

Many thanks for your help with this.

Best Regards,

Ian


-Original Message-
From: Allistair Crossley [mailto:[EMAIL PROTECTED]
Sent: 24 August 2005 12:42
To: Tomcat Users List
Subject: RE: Has anyone used Tomcat 5.5.9 connecting to MS SQL Server
using JNDI and Connection Pooling?


Hi again,

By the way, you really ought to consider *not* using the MS drivers. jTDS at
jtds.sourceforge.net is more performant.

Cheers, Allistair

 -Original Message-
 From: Wylie, Ian [mailto:[EMAIL PROTECTED]
 Sent: 24 August 2005 12:33
 To: Tomcat Users List
 Subject: RE: Has anyone used Tomcat 5.5.9 connecting to MS SQL Server
 using JNDI and Connection Pooling?
 
 
 Hi Allistair,
 
 I just got the basic JNDI datasource working for MS SQL 
 Server with Tomcat
 5.5.
 
 I tried using the ConnectionPoolDataSource instead of the standard
 DataSource but I cannot get this working.
 
 Not sure whether I need to replace the
 res-typejavax.sql.DataSource/res-type with something else 
 in the web.xml
 file.
 
 I changed the driverclass name from the standard datasource class of
 com.microsoft.jdbc.sqlserver.SQLServerDriver - used with 
 standard datasource
 to the com.microsoft.jdbcx.sqlserver.SQLServerDataSource 
 class used by MS
 connection pooling in the 
 TOMCAT_HOME/conf/Catalina/localhost/webappname.xml
 file.  Also added the factory for PooledConnections -
 factory=com.microsoft.jdbcx.sqlserver.SQLServerDataSourceFact
 ory to the
 TOMCAT_HOME/conf/Catalina/localhost/webappname.xml file. 
 
 Any ideas to get the MS Connection Pooling working, or is 
 there no need in
 Tomcat 5.5  -   In aother words does Tomcat 5.5 automatically 
 used Cnnection
 Pooling with a datasource??
 
 Many thanks for your help with this.
 
 Best Regards,
 
 Ian
 
 
 -Original Message-
 From: Allistair Crossley [mailto:[EMAIL PROTECTED]
 Sent: 23 August 2005 16:05
 To: Tomcat Users List; [EMAIL PROTECTED]
 Subject: RE: Has anyone used Tomcat 5.5.9 connecting to MS SQL Server
 usin g JNDI?
 
 
 Hi Wade,
 
 Can you perhaps resend the configuration files
 
 server.xml
 web.xml
 yourapp.xml
 listing of files in common/lib
 listing of files in yourapp/WEB-INF/lib
 
 Again?
 
 Cheers, Allistair.
 
  -Original Message-
  From: Wade Chandler [mailto:[EMAIL PROTECTED]
  Sent: 22 August 2005 17:58
  To: Tomcat Users List
  Subject: RE: Has anyone used Tomcat 5.5.9 connecting to MS 
 SQL Server
  usin g JNDI?
  
  
  --- Wylie, Ian [EMAIL PROTECTED] wrote:
  
   Allistair,
   
   My apologies for taking much longer than usual to
   get back to you but I had
   to finish some Java code that allowed us to upgrade
   our portal to PlumTree
   version 5.
   
   To clarify and answer your points below.
   
   1)  I have opted not to have a context.xml file in
   the META-INF directory
   but I am using the 
   TOMCAT_HOME/conf/Catalina/localhost/webappname.xml
   file
   instead.
   
   2)  I  have ensured that the 3 MS JAR files for the
   JDBC connection exist
   only in TOMCAT_HOME/common/lib and not in my webapp
   lib.
   
   3)  I have changed the java code to use a simple
   'DataSource' instead of a
   'ConnectionPoolDataSource' connection.  See Java
   code snippet below :-
   
   Unfortunately I still get the error below :-
   
   ERROR - NamingException - Config error with JNDI
   and
   datasource.javax.naming.NamingException: Cannot
   create resource instance
   ERROR com.webconnex.cognos.PORT.OMTLreport  : Cannot
   create resource
   instance
   
   I have attached my web.xml and
   TOMCAT_HOME/conf/Catalina/localhost/webappname.xml
   files for your perusal.
   
   
   I am of yet no further forward in solving my
   problem.
   
   Any further insight would be appreciated, as Tomcat
   5 allows me to do quite
   a few things better, not least of which is
   debugging!!
   
   
   Java Code snippet :-
   
  
  =
   
   logger.debug(Before
   InitialContext.) ;
   InitialContext ctx = new
   InitialContext();
   if (ctx == null) { 
   log(ERROR initialising
   InitialContext.) ;  
   logger.error(ERROR initialising
   InitialContext.) ;
   }
   log(Before Context.) ;
   ds

RE: Has anyone used Tomcat 5.5.9 connecting to MS SQL Server usin g JNDI?

2005-08-23 Thread Allistair Crossley
Hi Wade,

Can you perhaps resend the configuration files

server.xml
web.xml
yourapp.xml
listing of files in common/lib
listing of files in yourapp/WEB-INF/lib

Again?

Cheers, Allistair.

 -Original Message-
 From: Wade Chandler [mailto:[EMAIL PROTECTED]
 Sent: 22 August 2005 17:58
 To: Tomcat Users List
 Subject: RE: Has anyone used Tomcat 5.5.9 connecting to MS SQL Server
 usin g JNDI?
 
 
 --- Wylie, Ian [EMAIL PROTECTED] wrote:
 
  Allistair,
  
  My apologies for taking much longer than usual to
  get back to you but I had
  to finish some Java code that allowed us to upgrade
  our portal to PlumTree
  version 5.
  
  To clarify and answer your points below.
  
  1)  I have opted not to have a context.xml file in
  the META-INF directory
  but I am using the 
  TOMCAT_HOME/conf/Catalina/localhost/webappname.xml
  file
  instead.
  
  2)  I  have ensured that the 3 MS JAR files for the
  JDBC connection exist
  only in TOMCAT_HOME/common/lib and not in my webapp
  lib.
  
  3)  I have changed the java code to use a simple
  'DataSource' instead of a
  'ConnectionPoolDataSource' connection.  See Java
  code snippet below :-
  
  Unfortunately I still get the error below :-
  
  ERROR - NamingException - Config error with JNDI
  and
  datasource.javax.naming.NamingException: Cannot
  create resource instance
  ERROR com.webconnex.cognos.PORT.OMTLreport  : Cannot
  create resource
  instance
  
  I have attached my web.xml and
  TOMCAT_HOME/conf/Catalina/localhost/webappname.xml
  files for your perusal.
  
  
  I am of yet no further forward in solving my
  problem.
  
  Any further insight would be appreciated, as Tomcat
  5 allows me to do quite
  a few things better, not least of which is
  debugging!!
  
  
  Java Code snippet :-
  
 
 =
  
  logger.debug(Before
  InitialContext.) ;
  InitialContext ctx = new
  InitialContext();
  if (ctx == null) { 
  log(ERROR initialising
  InitialContext.) ;  
  logger.error(ERROR initialising
  InitialContext.) ;
  }
  log(Before Context.) ;
  ds = (DataSource)
  ctx.lookup(java:comp/env/jdbc/UKportalPool);
  
  log(Before initialising
  DataSource.) ;
  
  if(ds != null) {
  con = ds.getConnection();
  if (con != null) {
  
  if ((pType != null) 
  (!pType.equals()))
  {
  userDetails = new
  pfUsersBean(pType,
  posName, typeCD, firstLineProduct);
  userSessionDetails = new
  pfUserSessionBean();
  userDetails.getPrefix(con,
  userDetails);  // See if User is in database
  
  //userDetails.getPrefix(pCon,
  userDetails);  // See if User is in database
  
   
  ptpResponse.setSettingValue(SettingType.Portlet,
  SalesCubePrefix,
  userDetails.getSalesCubePrefix() ) ;
   
  ptpResponse.setSettingValue(SettingType.Portlet,
  description,
  userDetails.getGeographyID() ) ;
   
  ptpResponse.setSettingValue(SettingType.Portlet,
  TMTLdescription,
  userDetails.getGeographyID() ) ;
   
  ptpResponse.setSettingValue(SettingType.Portlet,
  MSOdescription,
  userDetails.getGeographyID() ) ;
  }
  
  }
  else {
  log(ERROR - DB
  Connection returned was null in
  PortletHelper!) ;
  logger.error(ERROR - DB
  Connection returned was
  null in PortletHelper!) ;
  }
  }
  else {
  log(ERROR - Datasource
  returned was null in
  PortletHelper!) ;
  logger.error(ERROR -
  Datasource returned was null
  in PortletHelper!) ;
  }
  }
  
  catch (NamingException ex){
  log(ERROR - NamingException -
  Config error with JNDI and
  datasource. +ex);
  log(ex.getMessage());
  logger.error(ERROR -
  NamingException - Config error with
  JNDI and datasource. +ex);
  logger.error(ex.getMessage());
  } 
  catch (NullPointerException npE) {
log(npE.getMessage());
logger.error(ERROR - Null pointer
  exception.);
logger.error(npE.getMessage());
  }
  catch (SQLException ex ){
  log(Cannot get JNDI connection from
  datasource. +ex);
  logger.error(Cannot get JNDI
  connection from datasource.
  +ex);
  logger.error(ex.getMessage

RE: Has anyone used Tomcat 5.5.9 connecting to MS SQL Server usin g JNDI?

2005-08-23 Thread Wade Chandler
--- Allistair Crossley [EMAIL PROTECTED]
wrote:

 Hi Wade,
 
 Can you perhaps resend the configuration files
 
 server.xml
 web.xml
 yourapp.xml
 listing of files in common/lib
 listing of files in yourapp/WEB-INF/lib
 
 Again?
 

Allistair,

Sorry man, but I only wrote to you about reading up on
JDPA, setting up Tomcat debug, and using TCP/IP for
debugging instead of shared memory.  Other guy sent
info for the config files.

I have used MS SQL Server and a pooled data source
from inside of my web app before.  I created my own
datasource factory and didn't use context.xml for the
configuration of what I did, though the setup should
be about the same as far as where I had to put the
files.  I put the jdbc driver files in the common/lib
on one machine, and if I remember correctly on one
server for what ever reason it only seemed to work
correctly by putting the files in the common/endorsed
directoryI had to get someone to put files there
for this one machine, and I had not configured it, but
for what ever reason on this particular machine it was
the only directory the jdbc drivers would load
correctly.

I always use a context.xml file for the data source
configuration myself when I use the container managed
data sources.

Wade

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



RE: Has anyone used Tomcat 5.5.9 connecting to MS SQL Server usin g JNDI?

2005-08-22 Thread Wylie, Ian
Allistair,

My apologies for taking much longer than usual to get back to you but I had
to finish some Java code that allowed us to upgrade our portal to PlumTree
version 5.

To clarify and answer your points below.

1)  I have opted not to have a context.xml file in the META-INF directory
but I am using the  TOMCAT_HOME/conf/Catalina/localhost/webappname.xml file
instead.

2)  I  have ensured that the 3 MS JAR files for the JDBC connection exist
only in TOMCAT_HOME/common/lib and not in my webapp lib.

3)  I have changed the java code to use a simple 'DataSource' instead of a
'ConnectionPoolDataSource' connection.  See Java code snippet below :-

Unfortunately I still get the error below :-

ERROR - NamingException - Config error with JNDI and
datasource.javax.naming.NamingException: Cannot create resource instance
ERROR com.webconnex.cognos.PORT.OMTLreport  : Cannot create resource
instance

I have attached my web.xml and
TOMCAT_HOME/conf/Catalina/localhost/webappname.xml files for your perusal.


I am of yet no further forward in solving my problem.

Any further insight would be appreciated, as Tomcat 5 allows me to do quite
a few things better, not least of which is debugging!!


Java Code snippet :-

=

logger.debug(Before InitialContext.) ;
InitialContext ctx = new InitialContext();
if (ctx == null) { 
log(ERROR initialising InitialContext.) ;  
logger.error(ERROR initialising InitialContext.) ;
}
log(Before Context.) ;
ds = (DataSource)
ctx.lookup(java:comp/env/jdbc/UKportalPool);

log(Before initialising DataSource.) ;

if(ds != null) {
con = ds.getConnection();
if (con != null) {

if ((pType != null)  (!pType.equals()))
{
userDetails = new pfUsersBean(pType,
posName, typeCD, firstLineProduct);
userSessionDetails = new
pfUserSessionBean();
userDetails.getPrefix(con,
userDetails);  // See if User is in database
//userDetails.getPrefix(pCon,
userDetails);  // See if User is in database

 
ptpResponse.setSettingValue(SettingType.Portlet, SalesCubePrefix,
userDetails.getSalesCubePrefix() ) ;
 
ptpResponse.setSettingValue(SettingType.Portlet, description,
userDetails.getGeographyID() ) ;
 
ptpResponse.setSettingValue(SettingType.Portlet, TMTLdescription,
userDetails.getGeographyID() ) ;
 
ptpResponse.setSettingValue(SettingType.Portlet, MSOdescription,
userDetails.getGeographyID() ) ;
}

}
else {
log(ERROR - DB Connection returned was null in
PortletHelper!) ;
logger.error(ERROR - DB Connection returned was
null in PortletHelper!) ;
}
}
else {
log(ERROR - Datasource returned was null in
PortletHelper!) ;
logger.error(ERROR - Datasource returned was null
in PortletHelper!) ;
}
}

catch (NamingException ex){
log(ERROR - NamingException - Config error with JNDI and
datasource. +ex);
log(ex.getMessage());
logger.error(ERROR - NamingException - Config error with
JNDI and datasource. +ex);
logger.error(ex.getMessage());
} 
catch (NullPointerException npE) {
  log(npE.getMessage());
  logger.error(ERROR - Null pointer exception.);
  logger.error(npE.getMessage());
}
catch (SQLException ex ){
log(Cannot get JNDI connection from datasource. +ex);
logger.error(Cannot get JNDI connection from datasource.
+ex);
logger.error(ex.getMessage());
}
catch(IOException IOe) {
 logger.error(ERROR - IOException occurred: +IOe) ;
 logger.error(IOe.getMessage()) ;
 }
catch(Exception e) {
log(ERROR - Exception occurred: +e) ;
logger.error(ERROR - Exception occurred: +e) ;
logger.error(e.getMessage()) ;
}
==

-Original Message-
From: Allistair Crossley [mailto:[EMAIL PROTECTED]
Sent: 11 August 2005 12:10
To: Tomcat Users List
Subject: RE: Has anyone used Tomcat 5.5.9 connecting to MS SQL Server
using JNDI?


Hi,

A) First, can you clarify which method you have opted 

RE: Has anyone used Tomcat 5.5.9 connecting to MS SQL Server usin g JNDI?

2005-08-22 Thread Wade Chandler
--- Wylie, Ian [EMAIL PROTECTED] wrote:

 Allistair,
 
 My apologies for taking much longer than usual to
 get back to you but I had
 to finish some Java code that allowed us to upgrade
 our portal to PlumTree
 version 5.
 
 To clarify and answer your points below.
 
 1)  I have opted not to have a context.xml file in
 the META-INF directory
 but I am using the 
 TOMCAT_HOME/conf/Catalina/localhost/webappname.xml
 file
 instead.
 
 2)  I  have ensured that the 3 MS JAR files for the
 JDBC connection exist
 only in TOMCAT_HOME/common/lib and not in my webapp
 lib.
 
 3)  I have changed the java code to use a simple
 'DataSource' instead of a
 'ConnectionPoolDataSource' connection.  See Java
 code snippet below :-
 
 Unfortunately I still get the error below :-
 
 ERROR - NamingException - Config error with JNDI
 and
 datasource.javax.naming.NamingException: Cannot
 create resource instance
 ERROR com.webconnex.cognos.PORT.OMTLreport  : Cannot
 create resource
 instance
 
 I have attached my web.xml and
 TOMCAT_HOME/conf/Catalina/localhost/webappname.xml
 files for your perusal.
 
 
 I am of yet no further forward in solving my
 problem.
 
 Any further insight would be appreciated, as Tomcat
 5 allows me to do quite
 a few things better, not least of which is
 debugging!!
 
 
 Java Code snippet :-
 

=
 
 logger.debug(Before
 InitialContext.) ;
 InitialContext ctx = new
 InitialContext();
 if (ctx == null) { 
 log(ERROR initialising
 InitialContext.) ;  
 logger.error(ERROR initialising
 InitialContext.) ;
 }
 log(Before Context.) ;
 ds = (DataSource)
 ctx.lookup(java:comp/env/jdbc/UKportalPool);
 
 log(Before initialising
 DataSource.) ;
 
 if(ds != null) {
 con = ds.getConnection();
 if (con != null) {
   
   if ((pType != null) 
 (!pType.equals()))
 {
   userDetails = new
 pfUsersBean(pType,
 posName, typeCD, firstLineProduct);
   userSessionDetails = new
 pfUserSessionBean();
   userDetails.getPrefix(con,
 userDetails);  // See if User is in database
   
 //userDetails.getPrefix(pCon,
 userDetails);  // See if User is in database
   
  
 ptpResponse.setSettingValue(SettingType.Portlet,
 SalesCubePrefix,
 userDetails.getSalesCubePrefix() ) ;
  
 ptpResponse.setSettingValue(SettingType.Portlet,
 description,
 userDetails.getGeographyID() ) ;
  
 ptpResponse.setSettingValue(SettingType.Portlet,
 TMTLdescription,
 userDetails.getGeographyID() ) ;
  
 ptpResponse.setSettingValue(SettingType.Portlet,
 MSOdescription,
 userDetails.getGeographyID() ) ;
   }
 
 }
 else {
 log(ERROR - DB
 Connection returned was null in
 PortletHelper!) ;
 logger.error(ERROR - DB
 Connection returned was
 null in PortletHelper!) ;
 }
 }
 else {
 log(ERROR - Datasource
 returned was null in
 PortletHelper!) ;
 logger.error(ERROR -
 Datasource returned was null
 in PortletHelper!) ;
 }
 }
 
 catch (NamingException ex){
 log(ERROR - NamingException -
 Config error with JNDI and
 datasource. +ex);
 log(ex.getMessage());
 logger.error(ERROR -
 NamingException - Config error with
 JNDI and datasource. +ex);
 logger.error(ex.getMessage());
 } 
 catch (NullPointerException npE) {
 log(npE.getMessage());
 logger.error(ERROR - Null pointer
 exception.);
 logger.error(npE.getMessage());
   }
 catch (SQLException ex ){
 log(Cannot get JNDI connection from
 datasource. +ex);
 logger.error(Cannot get JNDI
 connection from datasource.
 +ex);
 logger.error(ex.getMessage());
 }
 catch(IOException IOe) {
  logger.error(ERROR - IOException
 occurred: +IOe) ;
  logger.error(IOe.getMessage()) ;
  }
 catch(Exception e) {
 log(ERROR - Exception occurred:
 +e) ;
 logger.error(ERROR - Exception
 occurred: +e) ;
 logger.error(e.getMessage()) ;  
  
 }
 ==
 
 -Original Message-
 From: Allistair Crossley
 [mailto:[EMAIL PROTECTED]
 Sent: 11 

RE: Has anyone used Tomcat 5.5.9 connecting to MS SQL Server usin g JNDI?

2005-08-11 Thread Wylie, Ian
David,

Thanks for the link.   I have followed the instructions but unfortunately
get similar errors to what I had previously I am afraid.

In a situation like this I am sure I could get the company to pay for some
support for this type of problem, but I am unsure who would be best to help
with this.

Without further help, I will have to sideline the upgrade to 5.5, until
there is more info out there for the connecting using JNDI with a MS SQL
Server example.  

In my opinion the people who develop Tomcat should provide an example of
JNDI for ALL major databases.  This is one of the things that makes the
Tomcat offering lacking somewhat in maturity.  It seems to me it is
relatively easy to get the basic JSP / Servlet stuff up and running in no
time, but it has always been a hassle to get JNDI to work in Tomcat.  The
Tomcat folks provide MySQL and an Oracle example but they need to provide
examples for MS SQL Server, DB2 and Sybase.

Thanks for your help though - as it may have worked...  :-)

Best Regards,

Ian

Ian Wylie
Business Intelligence Architect
Business Information  Technology (BIT)
Pfizer Global Pharmaceuticals (PGP)


-Original Message-
From: David Thielen [mailto:[EMAIL PROTECTED]
Sent: 10 August 2005 14:56
To: Tomcat Users List
Subject: RE: Has anyone used Tomcat 5.5.9 connecting to MS SQL Server
using JNDI?


http://thielen.typepad.com/programming/2005/07/hibernate_on_to.html


David Thielen
303-499-2544
www.windwardreports.com


-Original Message-
From: Wylie, Ian [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 10, 2005 4:37 AM
To: tomcat-user@jakarta.apache.org
Subject: Has anyone used Tomcat 5.5.9 connecting to MS SQL Server using
JNDI?

Hi All,
 
I have just installed Tomcat 5.5.9 on our Dev Server.  I managed with a bit
of work and a few searches on the web to get Tomcat 4.1.x working with MS
SQL Server using JNDI and database pooled connections to work.  This has
been working well for some time now.  However, there is quite a few
advantages for upgrading the current system to Tomcat 5.5, not least of
which, is improvements to the list and functionality of tools that aid with
Java debugging!
 
I cannot get Tomcat 5.5.9 working with JNDI and MS SQL Server at the moment.
 
I have already read all the various official docs on JNDI how-to and
searched the web but even after all that and changing various things that
others have recommended, I cannot get the JNDI to work.
 
Has anyone out there successfully using JNDI with Tomcat and MS SQL Server?
 
If so please can you put another professional out of there misery!
 
Many thanks,

Best Regards,

  _  

 http://www.pfizer.co.uk/Ian Wylie - [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] 
  Business Intelligence Architect
  Business Information  Technology (BIT)
  Pfizer Global Pharmaceuticals (PGP)
  Direct: +44 (0)1737 330422
  Address: Pfizer Ltd, Walton Oaks (IPC 2G), Dorking Road, Tadworth, Surrey,
KT20 7NS.

LEGAL NOTICE 
Unless expressly stated otherwise, this message is confidential and may be
privileged. It is intended for the addressee(s) only. Access to this e-mail
by anyone else is unauthorised. If you are not an addressee, any disclosure
or copying of the contents of this e-mail or any action taken (or not taken)
in reliance on it is unauthorised and may be unlawful. If you are not an
addressee, please inform the sender immediately. 

Pfizer Limited is registered in England under No. 526209 with its registered
office at Ramsgate Road, Sandwich, Kent CT13 9NJ

  _  

 


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




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



RE: Has anyone used Tomcat 5.5.9 connecting to MS SQL Server usin g JNDI?

2005-08-11 Thread Wylie, Ian
Alistair,

For configuration purposes I attach the Context.xml, web.xml and
mininPCO-practise.xml - which is the web application file which resides in
TOMCAT_HOME\conf\Catalina\localhost directory.


The error message is basically Cannot create resource instance.  (Full
Error message attached below.)


The Java code above works in 4.1.31, so I am not really worried about this,
unless Tomcat 5.5.9 works differently.



Here is the code snippet from the java class PortletHelper that is being
executed which produces the error at the end of this email.

Well I think that is all that anyone needs to check out my app.

If anyone can offer some good advice on this, it would be much appreciated.

Best Regards,

Ian


===
JAVA CODE SNIPPET START

logger.debug(Before InitialContext.) ;
InitialContext ctx = new InitialContext();
if (ctx == null) { 
log(ERROR initialising InitialContext.) ;  
logger.error(ERROR initialising InitialContext.) ;
}
log(Before Context.) ;
Context envCtx = (Context) ctx.lookup(java:comp/env);

if (envCtx != null) {
log(Before initialising DataSource.) ;
ConnectionPoolDataSource ds = 
 
(ConnectionPoolDataSource)envCtx.lookup(jdbc/UKportalPool);

if(ds != null) {

pCon = ds.getPooledConnection(); 

JAVA CODE SNIPPET END



==

ERROR MESSAGE START

10-Aug-2005 15:26:56 org.apache.catalina.core.ApplicationContext log
INFO: OMTLreport: Before Context.
10-Aug-2005 15:26:56 org.apache.catalina.core.ApplicationContext log
INFO: OMTLreport: Before initialising DataSource.
10-Aug-2005 15:26:56 org.apache.catalina.core.ApplicationContext log
INFO: OMTLreport: ERROR - NamingException - Config error with JNDI and
datasource.javax.naming.NamingException: Cannot create resource instance
10-Aug-2005 15:26:56 org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet OMTLreport threw exception
java.lang.NullPointerException
at
com.webconnex.portal.PortletHelper.initPortlet(PortletHelper.java:230)
at
com.webconnex.cognos.PORT.OMTLreport.processRequest(OMTLreport.java:243)
at com.webconnex.portal.PortletHelper.doGet(PortletHelper.java:321)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:252)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:213)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:178)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126
)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105
)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:107)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
ction(Http11Protocol.java:744)
at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.jav
a:527)
at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWo
rkerThread.java:80)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:684)
at java.lang.Thread.run(Unknown Source)
10-Aug-2005 15:30:09 org.apache.catalina.core.ApplicationContext log

ERROR MESSAGE END

=

-Original Message-
From: Allistair Crossley [mailto:[EMAIL PROTECTED]
Sent: 11 August 2005 10:38
To: Tomcat Users List
Subject: RE: Has anyone used Tomcat 5.5.9 connecting to MS SQL Server
using JNDI?


Hi,

Can you please send more information, such as error messages, stdout logging
and the configuration for your pool.

Cheers, Allistair.

 -Original Message-
 From: Wylie, Ian [mailto:[EMAIL PROTECTED]
 Sent: 11 August 2005 10:28
 To: Tomcat Users List
 Subject: RE: Has anyone used Tomcat 5.5.9 connecting to MS SQL Server
 using JNDI?
 
 
 David,
 
 Thanks for the link.   I have followed the instructions but 
 unfortunately
 get similar errors to what I had previously I am afraid.
 
 In a situation like this I am sure I could get the company to 
 pay for some
 support 

RE: Has anyone used Tomcat 5.5.9 connecting to MS SQL Server usin g JNDI?

2005-08-11 Thread Wylie, Ian
Alistair,

Well I have learned something that I was doing wrong, but after removing the
webappname.xml I get the same error.

Any more ideas?

Thanks,

Ian

-Original Message-
From: Allistair Crossley [mailto:[EMAIL PROTECTED]
Sent: 11 August 2005 11:53
To: Tomcat Users List
Subject: RE: Has anyone used Tomcat 5.5.9 connecting to MS SQL Server
using JNDI?


Hi,

You can only configure a web application in 1 place. You can't use *both*
context.xml AND a webappname.xml. I think the
TOMCAT_HOME\conf\Catalina\localhost method is tried first, and because this
does not have any of your datasources in it you get your problems. Decide on
either TOMCAT_HOME\conf\Catalina\localhost\webappname.xml or
META-INF/context.xml and see if you get any further first.

Cheers, Allistair

 -Original Message-
 From: Wylie, Ian [mailto:[EMAIL PROTECTED]
 Sent: 11 August 2005 11:47
 To: Tomcat Users List
 Subject: RE: Has anyone used Tomcat 5.5.9 connecting to MS SQL Server
 using JNDI?
 
 
 Alistair,
 
 For configuration purposes I attach the Context.xml, web.xml and
 mininPCO-practise.xml - which is the web application file 
 which resides in
 TOMCAT_HOME\conf\Catalina\localhost directory.
 
 
 The error message is basically Cannot create resource 
 instance.  (Full
 Error message attached below.)
 
 
 The Java code above works in 4.1.31, so I am not really 
 worried about this,
 unless Tomcat 5.5.9 works differently.
 
 
 
 Here is the code snippet from the java class PortletHelper 
 that is being
 executed which produces the error at the end of this email.
 
 Well I think that is all that anyone needs to check out my app.
 
 If anyone can offer some good advice on this, it would be 
 much appreciated.
 
 Best Regards,
 
 Ian
 
 
 ==
 =
 JAVA CODE SNIPPET START
 
 logger.debug(Before InitialContext.) ;
 InitialContext ctx = new InitialContext();
 if (ctx == null) { 
 log(ERROR initialising InitialContext.) ;  
 logger.error(ERROR initialising 
 InitialContext.) ;
 }
 log(Before Context.) ;
 Context envCtx = (Context) 
 ctx.lookup(java:comp/env);
 
 if (envCtx != null) {
 log(Before initialising DataSource.) ;
 ConnectionPoolDataSource ds = 
  
 (ConnectionPoolDataSource)envCtx.lookup(jdbc/UKportalPool);
 
 if(ds != null) {
 
 pCon = ds.getPooledConnection(); 
 
 JAVA CODE SNIPPET END
 
 
 
 ==
 
 ERROR MESSAGE START
 
 10-Aug-2005 15:26:56 org.apache.catalina.core.ApplicationContext log
 INFO: OMTLreport: Before Context.
 10-Aug-2005 15:26:56 org.apache.catalina.core.ApplicationContext log
 INFO: OMTLreport: Before initialising DataSource.
 10-Aug-2005 15:26:56 org.apache.catalina.core.ApplicationContext log
 INFO: OMTLreport: ERROR - NamingException - Config error with JNDI and
 datasource.javax.naming.NamingException: Cannot create 
 resource instance
 10-Aug-2005 15:26:56 
 org.apache.catalina.core.StandardWrapperValve invoke
 SEVERE: Servlet.service() for servlet OMTLreport threw exception
 java.lang.NullPointerException
   at
 com.webconnex.portal.PortletHelper.initPortlet(PortletHelper.java:230)
   at
 com.webconnex.cognos.PORT.OMTLreport.processRequest(OMTLreport
 .java:243)
   at 
 com.webconnex.portal.PortletHelper.doGet(PortletHelper.java:321)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   at
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilt
 er(Application
 FilterChain.java:252)
   at
 org.apache.catalina.core.ApplicationFilterChain.doFilter(Appli
 cationFilterCh
 ain.java:173)
   at
 org.apache.catalina.core.StandardWrapperValve.invoke(StandardW
 rapperValve.ja
 va:213)
   at
 org.apache.catalina.core.StandardContextValve.invoke(StandardC
 ontextValve.ja
 va:178)
   at
 org.apache.catalina.core.StandardHostValve.invoke(StandardHost
 Valve.java:126
 )
   at
 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReport
 Valve.java:105
 )
   at
 org.apache.catalina.core.StandardEngineValve.invoke(StandardEn
 gineValve.java
 :107)
   at
 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdap
 ter.java:148)
   at
 org.apache.coyote.http11.Http11Processor.process(Http11Process
 or.java:856)
   at
 org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandle
 r.processConne
 ction(Http11Protocol.java:744)
   at
 org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolT
 cpEndpoint.jav
 a:527)
   at
 org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(Le