After some more testing, I have determined that I can remove the user
name and password from context.xml in Tomcat 5.5.4, and it still
works. Removing the entire Resource tag, however, causes it to crash
out, as it should. This means that Tomcat 5.5.4 needs the connection
information in context.xml, but authenticates from elsewhere, probably
Active Directory, since I have to log on to my desktop workstation via
Active Directory.

Any idea why 5.5.9 will not authenticate this way, or more
importantly, how to cause it to authenticate this way?

On 7/8/05, Craig Dixon <[EMAIL PROTECTED]> wrote:
> I am encountering a very strange problem when trying to use a
> datasource in Tomcat. I got Tomcat 5.5.4 to access the datasource by
> using the following in
> <TomcatHome>\conf\Catalina\localhost\<webAppContext>.xml
> 
> <Context path="/appName" docBase="appName"
>     debug="5" reloadable="true" crossContext="true">
> 
>   <Resource name="jdbc/RDM" auth="Container" type="javax.sql.DataSource"
>         maxActive="100" maxIdle="30" maxWait="10000"
>         username="*hidden*" password="*hidden*"
> driverClassName="sun.jdbc.odbc.JdbcOdbcDriver"
>         url="jdbc:odbc:RDM_CURRENT_11"/>
> 
> </Context>
> 
> 
> 
> I use this in conjunction with the following in
> <TomcatHome>\webapps\<appName>\WEB-INF\web.xml:
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> 
> <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">
> 
>         <resource-ref>
>       <description>RDM</description>
>       <res-ref-name>jdbc/RDM</res-ref-name>
>       <res-type>javax.sql.DataSource</res-type>
>       <res-auth>Container</res-auth>
>         </resource-ref>
> 
> </web-app>
> 
> 
> 
> This works like a dream.
> 
> I tried upgrading to Tomcat 5.5.9. I downloaded and installed the
> admin add-on application, then added the datasource via the admin
> interface as follows:
> 
> JNDI Name: RDM
> Datasource URL: jdbc:odbc:RDM_CURRENT_11
> JDBC Driver Class: sun.jdbc.odbc.JdbcOdbcDriver
> Username: *hidden*
> Password: *hidden*
> MaxActiveConnections: 100
> MaxIdleConnections: 30
> MaxWaitForConnection: 10000
> Validation Query:
> 
> Now I get the following error:
> 
> HTTP Status 500 -
> 
> type Exception report
> 
> message
> 
> description The server encountered an internal error () that prevented
> it from fulfilling this request.
> 
> exception
> 
> javax.servlet.ServletException: Unable to get connection, DataSource
> invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot
> create PoolableConnectionFactory ([Microsoft][ODBC SQL Server
> Driver][SQL Server]Login failed for user 'NT AUTHORITY\ANONYMOUS
> LOGON'.)"
>         
> org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848)
>         
> org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
>         
> org.apache.jsp.gradprofile_jsp._jspService(org.apache.jsp.gradprofile_jsp:171)
>         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
>         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>         
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
>         
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
>         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
>         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> 
> root cause
> 
> javax.servlet.jsp.JspException: Unable to get connection, DataSource
> invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot
> create PoolableConnectionFactory ([Microsoft][ODBC SQL Server
> Driver][SQL Server]Login failed for user 'NT AUTHORITY\ANONYMOUS
> LOGON'.)"
>         
> org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:276)
>         
> org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:159)
>         
> org.apache.jsp.gradprofile_jsp._jspx_meth_sql_query_0(org.apache.jsp.gradprofile_jsp:190)
>         
> org.apache.jsp.gradprofile_jsp._jspService(org.apache.jsp.gradprofile_jsp:80)
>         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
>         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>         
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
>         
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
>         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
>         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> 
> note The full stack trace of the root cause is available in the Apache
> Tomcat/5.5.9 logs.
> Apache Tomcat/5.5.9
> 
> 
> 
> I still have 5.5.4 installed, and when I switch back to it, everything
> works fine. I'd like to work in the most current version, though.
> Anyone have any ideas about this?
>

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

Reply via email to