wood burning stoves 2.0*
The moose likes Tomcat and the fly likes Update -- Trying to get JNDI working with Tomcat 6 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Update -- Trying to get JNDI working with Tomcat 6" Watch "Update -- Trying to get JNDI working with Tomcat 6" New topic

Update -- Trying to get JNDI working with Tomcat 6

Steve Nelligan

Joined: Nov 09, 2010
Posts: 10
I finally got the Oracle database connections working with JNDI.

I still can not get connected to SQL-2005 with JNDI

I have tried sqljdbc4.jar, sqljdbc4-2.0.jar, and jtds.jar but none are able to connect to SQL-2005.

Has anyone gotten connected to SQL-2005 using JNDI and Tomcat 6?

If so, could you describe:
1. which driver you used (which jar)
2. the driver class
3. the driver url
4. context.xml resource block
5. web.xml resource-ref block.

The following is the exception I am getting:
Nov 10, 2010 9:45:07 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
javax.naming.NamingException: Cannot create resource instance
at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:143)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
at org.apache.jsp.jtdsTest2_jsp._jspService(jtdsTest2_jsp.java:70)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)

Any information would help

Thanks in advance
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019

Always a bad thing when I see a thread with 0 response and "Update" in the header. It's usually better just to update the original thread.

Microsoft SQL server 2005/2008 work just find with Tomcat6. I've had that configuration running for quite a long time now.

Microsoft provides a SQL Server jdbc driver jar, but there are several others, including a very good one on Sourceforge.net. I ended up using that one because one project was written by people who went absolutely insane with stored procedures using nested transactions and the Microsoft-supplied driver couldn't handle it.

Customer surveys are for companies who didn't pay proper attention to begin with.
Steve Nelligan

Joined: Nov 09, 2010
Posts: 10
I finally got it working.

Turns out that in the resource name tag the type had a space within the quotes. Once I fixed this, everything fell into place.
I agree. Here's the link: http://aspose.com/file-tools
subject: Update -- Trying to get JNDI working with Tomcat 6