Problema JSTL+PostgreSQL+Glassfish (resolvido)

1 resposta
Masami

Olá pessoal! ja encontrei muitas soluções para varios problemas q tive neste forum mas dessa vez ta complicado.
Se alguem puder me ajudar, segue o codigo:

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<sql:setDataSource var="con"
                   driver="org.postgresql.Driver"
                   url="jdbc:postgresql://localhost:5432/banco"
                   user="postgres"
                   password="postgres"
                   />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <sql:query var="rs" dataSource="${con}">
            select campo from tabela where data between '01-08-2009' and '23-08-2009'
        </sql:query>
        <c:forEach var='row' items='${rs.rowsByIndex}'>
            <c:out value='${rowData}'/>
        </c:forEach>
    </body>
</html>

executando ele tenho o seguinte erro:

HTTP Status 500 -

type Exception report

message

descriptionThe server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver found for jdbc:postgresql://localhost:5432/banco"

root cause

javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver found for jdbc:postgresql://localhost:5432/banco"

note The full stack traces of the exception and its root causes are available in the GlassFish/v3 logs.
GlassFish/v3

Ao que me parece não esta encontrando o driver, mas eu ja adicionei a biblioteca ao projeto,
nos servlets funciona tudo normal, mas gostaria de fazer com JSTL...

1 Resposta

Masami

eu colei o postgresql-8.4-701.jdbc4.jar na pasta do glassfish e criei um pool de conexões no glassfish tb.
não sei qual desses dois q resolveu, mas o q importa q esta funcionando agora.

Criado 23 de agosto de 2009
Ultima resposta 23 de ago. de 2009
Respostas 1
Participantes 1