Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java Open Source > Apache Tomcat
|
Apache Tomcat General discussion of the Apache Tomcat servlet container. For discussions specific to the Professional Apache Tomcat book, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Apache Tomcat section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 3rd, 2003, 07:13 PM
Registered User
 
Join Date: Dec 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to mowoski
Default Tomcat JNDI DataSource issues

Hello, I have followed the Book to the letter and I am getting a " Cannot create PoolableConnectionFactory" error when I run the JDBCTest.jsp.Based on what I am seeing it is when the connection in the jsp file is attempted. What am I doing wrong.I tested the Mysql empro user with the MySql client tools and it was able to get data.

I have RedHat 9.0
Tomcat 4.1.29
SunJava 1.4.1_06
MySQL 3.23.54
MySqlJConnector mysql-connector-java-3.0.9-stable in the <Tomcat_Home>/common/lib and Shared/lib
The dbcp,pool, and collection JARs are where they are supposed to be.
server.xml I had them in neater but the Admin tool rearanged it;
The Admin Tool did see the DefaultContext tags
<DefaultContext className="org.apache.catalina.core.StandardDefaul tContext" cookies="true" crossContext="true" name="defaultContext" reloadable="false" swallowOutput="false" useNaming="true" wrapperClass="org.apache.catalina.core.StandardWra pper">
          <Resource auth="Container" name="jdbc/WroxTC41" scope="Shareable" type="javax.sql.DataSource"/>
          <ResourceParams name="jdbc/WroxTC41">
            <parameter>
              <name>maxWait</name>
              <value>100</value>
            </parameter>
            <parameter>
              <name>maxActive</name>
              <value>20</value>
            </parameter>
            <parameter>
              <name>password</name>
              <value>empass</value>
            </parameter>
            <parameter>
              <name>driverClassName</name>
              <value>org.gjt.mm.mysql.Driver</value>
            </parameter>
            <parameter>
              <name>url</name>
              <value>jdbc:mysql://localhost/wroxtomcat</value>
            </parameter>
            <parameter>
              <name>maxIdle</name>
              <value>30000</value>
            </parameter>
             <parameter>
              <name>username</name>
              <value>empro</value>
            </parameter>
            <parameter>
              <name>debug</name>
              <value>0</value>
            </parameter>
          </ResourceParams>
        </DefaultContext>

web.xml
 <resource-ref>
      <res-ref-name>jdbc/WroxTC41</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
    </resource-ref>

I put part of the JDBCTest.jsp together looking for the fault
<HTML>
   <HEAD>
      <%@ page errorPage="errorpg.jsp"
               import="java.sql.*,
                       javax.sql.*,
                       java.io.*,
                       javax.naming.InitialContext" %>
   </HEAD>
<BODY>
<H1>JDBC JNDI Resources Test</H1>

<%
InitialContext initCtx = new InitialContext();
DataSource ds = (DataSource)initCtx.lookup("java:comp/env/jdbc/WroxTC41");
Connection conn = ds.getConnection();
conn.close();
initCtx.close();

%>
</Body>
</HTML>



 
Old December 4th, 2003, 03:29 PM
Registered User
 
Join Date: Dec 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to mowoski
Default

The user setup to access the wroxtomcat was empro at localhost. On Redhat you need to setup the user to wroxtomcat as user empro and localhost.domain. Go figure.

 
Old April 9th, 2004, 12:10 PM
Registered User
 
Join Date: Apr 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It looks like it has to do with the ordering in /etc/hosts. Have someone with super-user privileges reverse "localhost.localdomain localhost" to "localhost localhost.localdomain". The first name it sees is what it assumes for reverse lookup.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Not binding factory to JNDI, no JNDI name configur 4java EJB 0 August 13th, 2007 11:20 AM
JBuilder/Tomcat/JNDI/JDBC DataSource cac07 BOOK: Professional Apache Tomcat 0 January 26th, 2006 12:28 PM
jndi tomcat anandp Apache Tomcat 1 July 13th, 2005 05:39 AM
JNDI setup in Embedded Tomcat 5.0.19 Pretty Apache Tomcat 3 July 12th, 2005 06:55 AM
JNDI Error ofer_mizrahi J2EE 0 November 27th, 2003 08:37 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.