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 for now of;

1.

TOMCAT_HOME/webapps/webappname/META-INF/context.xml

or

2.

TOMCAT_HOME/conf/Catalina/localhost/webappname.xml

B) Ensure your database JAR(s) are in TOMCAT_HOME/common/lib (not in your
webapp lib).

C) Try something simpler ...

DataSource dataSource = null;
try {
  Context ctx = new InitialContext();
  dataSource = (DataSource) ctx.lookup("java:comp/env/jdbc/UKportalPool");
} catch (NamingException nE) {
  log.error(nE.getMessage());
} catch (NullPointerException npE) {
  log.error(npE.getMessage());
}

Allistair.

> -----Original Message-----
> From: Wylie, Ian [mailto:[EMAIL PROTECTED]
> Sent: 11 August 2005 12:02
> To: Tomcat Users List
> Subject: RE: Has anyone used Tomcat 5.5.9 connecting to MS SQL Server
> using JNDI?
> 
> 
> 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
> > aderFollowerWo
> > 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 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]
> > > 
> > > 
> > 
> > 
> > <FONT SIZE=1 FACE="VERDANA,ARIAL" COLOR=BLUE> 
> > -------------------------------------------------------
> > QAS Ltd.
> > Registered in England: No 2582055
> > Registered in Australia: No 082 851 474
> > -------------------------------------------------------
> > </FONT>
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > 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]
> 
> 
> 
> 
> ---------------------------------------------------------------------
> 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]



<web-app xmlns="http://java.sun.com/xml/ns/j2ee";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";
version="2.4">

	<display-name>Pfizer Online Reporting Tools</display-name>
	<description>
      This is version 2.0 of Pfizer Online Reporting Tools for Plumtree portal version 4.5 and 5.x.
      It was written by Igor Polyakov ([EMAIL PROTECTED]) of
      Quorum Webconnex, who should be contacted for more information.
   </description>

<resource-ref>
   <description>Connection to my DB.</description>
   <res-ref-name>jdbc/UKportalPool</res-ref-name>
   <res-type>javax.sql.DataSource</res-type>
   <res-auth>Container</res-auth>
</resource-ref>

	<servlet>
		<servlet-name>OMTLreport</servlet-name>
		<servlet-class>com.webconnex.cognos.PORT.OMTLreport</servlet-class>
	</servlet>
	<servlet>
		<servlet-name>OMTLprefs</servlet-name>
		<servlet-class>com.webconnex.cognos.PORT.OMTLprefs</servlet-class>
	</servlet>
	<servlet>
		<servlet-name>TMTLreport</servlet-name>
		<servlet-class>com.webconnex.cognos.PORT.TMTLreport</servlet-class>
	</servlet>
	<servlet>
		<servlet-name>TMTLprefs</servlet-name>
		<servlet-class>com.webconnex.cognos.PORT.TMTLprefs</servlet-class>
	</servlet>
	<servlet>
		<servlet-name>MSOreport</servlet-name>
		<servlet-class>com.webconnex.cognos.PORT.MSOreport</servlet-class>
	</servlet>
	<servlet>
		<servlet-name>MSOprefs</servlet-name>
		<servlet-class>com.webconnex.cognos.PORT.MSOprefs</servlet-class>
	</servlet>
	<servlet>
		<servlet-name>MSDreport</servlet-name>
		<servlet-class>com.webconnex.cognos.PORT.MSDreport</servlet-class>
	</servlet>
	<servlet>
		<servlet-name>MSDprefs</servlet-name>
		<servlet-class>com.webconnex.cognos.PORT.MSDprefs</servlet-class>
	</servlet>
	<servlet-mapping>
		<servlet-name>OMTLreport</servlet-name>
		<url-pattern>/OMTLreport</url-pattern>
	</servlet-mapping>
	<servlet-mapping>
		<servlet-name>OMTLprefs</servlet-name>
		<url-pattern>/OMTLprefs</url-pattern>
	</servlet-mapping>
	<servlet-mapping>
		<servlet-name>TMTLreport</servlet-name>
		<url-pattern>/TMTLreport</url-pattern>
	</servlet-mapping>
	<servlet-mapping>
		<servlet-name>TMTLprefs</servlet-name>
		<url-pattern>/TMTLprefs</url-pattern>
	</servlet-mapping>
	<servlet-mapping>
		<servlet-name>MSOreport</servlet-name>
		<url-pattern>/MSOreport</url-pattern>
	</servlet-mapping>
	<servlet-mapping>
		<servlet-name>MSOprefs</servlet-name>
		<url-pattern>/MSOprefs</url-pattern>
	</servlet-mapping>
	<servlet-mapping>
		<servlet-name>MSDreport</servlet-name>
		<url-pattern>/MSDreport</url-pattern>
	</servlet-mapping>
	<servlet-mapping>
		<servlet-name>MSDprefs</servlet-name>
		<url-pattern>/MSDprefs</url-pattern>
	</servlet-mapping>
	<session-config>
		<session-timeout>30</session-timeout>
	</session-config>
	<welcome-file-list>
		<welcome-file>index.jsp</welcome-file>
		<welcome-file>index.html</welcome-file>
		<welcome-file>index.htm</welcome-file>
	</welcome-file-list>
</web-app>
<Context path="/miniPCO-practise" docBase="F:/Webconnex-Igor/MINIPCO-PRACTISE/web" debug="0" priveleged="false" reloadable="true">
  <Resource name="jdbc/UKportalPool" auth="Container" type="javax.sql.DataSource"
   username="pfuser" password="pfizer" driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver"
   url="jdbc:microsoft:sqlserver://168.224.236.241:1433;DatabaseName=PfizerUsers;SelectMethod=cursor"
   maxActive="8" maxIdle="4" maxWait="10000" removeAbandoned="true" removeAbandonedTimeout="180"/>
</Context>


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

Reply via email to