tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Allistair Crossley" <Allistair.Cross...@QAS.com>
Subject RE: Has anyone used Tomcat 5.5.9 connecting to MS SQL Server using JNDI?
Date Thu, 11 Aug 2005 11:09:38 GMT
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:Ian.Wylie@Pfizer.com]
> 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:Allistair.Crossley@QAS.com]
> 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:Ian.Wylie@Pfizer.com]
> > 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:Allistair.Crossley@QAS.com]
> > 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:Ian.Wylie@Pfizer.com]
> > > 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:david@windward.net]
> > > 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:Ian.Wylie@Pfizer.com] 
> > > 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 - ian.wylie@pfizer.com
> > > <mailto:ian.wylie@pfizer.com> 
> > >   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: tomcat-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: 
> tomcat-user-help@jakarta.apache.org
> > > 
> > > 
> > > 
> > > 
> > > 
> > 
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: 
> tomcat-user-help@jakarta.apache.org
> > > 
> > > 
> > 
> > 
> > <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: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > 
> > 
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message