tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Riegel <stefan.rie...@telig.de>
Subject Re: Cannot create PoolableConnectionFactory (Unexpected exception encountered during query.)
Date Tue, 30 Dec 2008 13:21:26 GMT
Thanks a lot David, everything works fine for the moment. The latest, 
original tomcat 6 did the trick. This resolved also some other issues 
with autoexpanding WAR files and with logging. On the other hand, I have 
to figure out writing the init script and installing tomcat as a unix 
daemon. Hopefully this will be painless.

Thanks again
Stefan


David Smith schrieb:
> Thanks ... the config in your context.xml and web.xml look normal
> enough.  I would recommend you change your JDK from OpenJDK to Sun's JDK
> though.
> 
> Also was this installed from a Ubuntu's package or installed from a
> tomcat.apache.org download?  If installed from Ubuntu, do a search of
> Ubuntu's docs on tomcat for how to configure database pooling.   Each
> packager does little things different from the main tomcat distribution
> that may affect how you need to configure things.  One last possibility,
> repackaged versions have a tendency to split things out into a gazillion
> different little pieces and you may be missing a package containing the
> tomcat dbcp jar.  If that's the case, the logs should have something to
> the effect of "ClassNotFound" when you start the service.
> 
> --David
> 
> 
> Stefan Riegel wrote:
>> Here it comes:
>>
>> -----------------------
>> context.xml in META-INF
>> -----------------------
>>
>> <Context unpackWAR="true" debug="5" reloadable="true"
>>     crossContext="true">
>>
>>     <Logger className="org.apache.catalina.logger.FileLogger"
>>         prefix="localhost_DBTest_log." suffix=".log" timestamp="true" />
>>
>>     <!-- Default set of monitored resources -->
>>     <WatchedResource>WEB-INF/web.xml</WatchedResource>
>>
>>     <Resource name="jdbc/TestDB" auth="Container"
>> type="javax.sql.DataSource"
>>         maxActive="100" maxIdle="30" maxWait="10000" username="correct"
>>         password="also-correct"
>> driverClassName="com.mysql.jdbc.Driver"
>> url="jdbc:mysql://localhost:3306/swex-products" />
>> </Context>
>>
>> ------------------
>> web.xml in WEB-INF
>> ------------------
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <web-app id="WebApp_ID" version="2.4"
>> 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">
>>     <display-name>
>>     swex-v2009.01</display-name>
>>     <welcome-file-list>
>>         <welcome-file>index.html</welcome-file>
>>         <welcome-file>index.htm</welcome-file>
>>         <welcome-file>index.jsp</welcome-file>
>>         <welcome-file>default.html</welcome-file>
>>         <welcome-file>default.htm</welcome-file>
>>         <welcome-file>default.jsp</welcome-file>
>>     </welcome-file-list>
>>     
>>      <resource-ref>
>>       <description>DB Connection</description>
>>       <res-ref-name>jdbc/TestDB</res-ref-name>
>>       <res-type>javax.sql.DataSource</res-type>
>>       <res-auth>Container</res-auth>
>>       </resource-ref>
>>     
>> </web-app>
>>
>> ---------
>> index.jsp
>> ---------
>>
>> <?xml version="1.0" encoding="UTF-8" ?>
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>> <%@ page language="java" contentType="text/html; charset=UTF-8"
>>     pageEncoding="UTF-8"%>
>> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
>> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
>> <html xmlns="http://www.w3.org/1999/xhtml">
>> <head>
>> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
>> <title>Insert title here</title>
>> </head>
>> <body>
>> <h1>${7+7}ÄÖ</h1>
>>
>> <sql:query var="rs" dataSource="jdbc/TestDB">
>> select * from base LIMIT 30
>> </sql:query>
>>
>> <html>
>>   <head>
>>     <title>DB Test</title>
>>   </head>
>>   <body>
>>
>>   <h2>Results</h2>
>>
>> <c:forEach var="row" items="${rs.rows}">
>>     Name ${row.name}<br/>
>> </c:forEach>
>>
>>   </body>
>> </html>
>>
>> </body>
>> </html>
>>
>> ---
>> JDK
>> ---
>>
>> OpenJDK  Runtime Environment (build 1.6.0_0-b11)
>> OpenJDK 64-Bit Server VM (build 1.6.0_0-b11, mixed mode)
>>
>> Do You need any more information?
>>
>> I have no problems connecting to mysql (same database, same user, same
>> passwd, same port) on localhost with other clients. I use the latest,
>> fresh, stable mysql Connector/J.
>>
>>
>> David Smith schrieb:
>>> Can you post relevant parts of your config?  Replace the username,
>>> password and hostnames with fakes, but otherwise post exactly what you
>>> have in your specific environment.
>>>
>>> --David
>>>
>>> Stefan Riegel wrote:
>>>> Hi all,
>>>>
>>>> I'm trying to connect to a MySQL database based on the Tomcat Docs
>>>> example. See the error message below.
>>>>
>>>> Similar to the Problem from Krapacs Ambrose, I'm using a standard
>>>> configured Ubuntu 8.04 Server with Tomcat 5.5. I did follow all hints
>>>> in the whole thread and reproduced exactly the example from the Tomcat
>>>> Docs.
>>>>
>>>> http://marc.info/?l=tomcat-user&m=122701096423437&w=2
>>>>
>>>> http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
>>>>
>>>>
>>>>
>>>> but did not succeed. My security manager is disabled.
>>>>
>>>> Hopefully someone can help me. I have spend a complete day without any
>>>> result. Very frustrating :-(
>>>>
>>>> -----------------------------------------------
>>>> ---- error messages shown up in the browser ---
>>>> -----------------------------------------------
>>>>
>>>> type Exception report
>>>>
>>>> message
>>>>
>>>> description The server encountered an internal error () that prevented
>>>> it from fulfilling this request.
>>>>
>>>> exception
>>>>
>>>> org.apache.jasper.JasperException: Exception in JSP: /index.jsp:15
>>>>
>>>> 12: <body>
>>>> 13: <h1>${7+7}ÄÖ</h1>
>>>> 14:
>>>> 15: <sql:query var="rs" dataSource="jdbc/TestDB">
>>>> 16: select * from base LIMIT 30;
>>>> 17: </sql:query>
>>>> 18:
>>>>
>>>>
>>>> Stacktrace:
>>>>    
>>>> org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
>>>>
>>>>
>>>>    
>>>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
>>>>
>>>>
>>>>    
>>>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
>>>>
>>>>
>>>>     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
>>>>     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>>>>
>>>> root cause
>>>>
>>>> javax.servlet.ServletException: Unable to get connection, DataSource
>>>> invalid: "org.apache.commons.dbcp.SQLNestedException: Cannot create
>>>> PoolableConnectionFactory (Unexpected exception encountered during
>>>> query.)"
>>>>    
>>>> org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
>>>>
>>>>
>>>>    
>>>> org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
>>>>
>>>>
>>>>     org.apache.jsp.index_jsp._jspService(index_jsp.java:96)
>>>>     org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
>>>>     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>>>>    
>>>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
>>>>
>>>>
>>>>    
>>>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
>>>>
>>>>
>>>>     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
>>>>     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>>>>
>>>> root cause
>>>>
>>>> javax.servlet.jsp.JspException: Unable to get connection, DataSource
>>>> invalid: "org.apache.commons.dbcp.SQLNestedException: Cannot create
>>>> PoolableConnectionFactory (Unexpected exception encountered during
>>>> query.)"
>>>>    
>>>> 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.index_jsp._jspx_meth_sql_005fquery_005f0(index_jsp.java:115)
>>>>
>>>>
>>>>     org.apache.jsp.index_jsp._jspService(index_jsp.java:70)
>>>>     org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
>>>>     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>>>>    
>>>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
>>>>
>>>>
>>>>    
>>>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
>>>>
>>>>
>>>>     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
>>>>     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 logs.
>>>>
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
> 
> 


-- 
Stefan

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


Mime
View raw message