Probando JSF dataTable

View: New views
2 Messages — Rating Filter:   Alert me  

Probando JSF dataTable

by estaisaderezados :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Estoy tratando de mostrar una consulta a una tabla de base de datos en un dataTable usando JSF.

Pero me da el siguiente error:

Cannot get value for expression '#{user.all}'

Caused by:
java.sql.SQLException - No suitable driver
cannot create JDBC driver of class '' for connect URL 'null'

Este el código de la conexión en el Bean:

public void open() throws SQLException, NamingException {
 if (conn != null) return;
  Context ctx = new InitialContext();
  DataSource ds = (DataSource) ctx.lookup("java:comp/env /jdbc/jpr_agenda");
  conn = ds.getConnection();
}

Este es el web.xml:

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

jpr_agenda es el nombre de la base de datos en mysql

¿Podrían ayudarme a resolver el problema? Gracias


Re: Probando JSF dataTable

by Sebastian Gurin-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

No conozco jsf, pero igual este problema me suena a que te faltó poner el .jar de mysql (el driver) en el classpath...

On Thu, 17 Sep 2009 11:52:04 -0000
"estaisaderezados" <estaisaderezados@...> wrote:

> Estoy tratando de mostrar una consulta a una tabla de base de datos en un dataTable usando JSF.
>
> Pero me da el siguiente error:
>
> Cannot get value for expression '#{user.all}'
>
> Caused by:
> java.sql.SQLException - No suitable driver
> cannot create JDBC driver of class '' for connect URL 'null'
>
> Este el código de la conexión en el Bean:
>
> public void open() throws SQLException, NamingException {
>  if (conn != null) return;
>   Context ctx = new InitialContext();
>   DataSource ds = (DataSource) ctx.lookup("java:comp/env /jdbc/jpr_agenda");
>   conn = ds.getConnection();
> }
>
> Este es el web.xml:
>
> <resource-ref>
> <res-ref-name>jdbc/jpr_agenda</res-ref-name>
> <res-type>javax.sql.DataSource</res-type>
> <res-auth>Container</res-auth>
> </resource-ref>
>
> jpr_agenda es el nombre de la base de datos en mysql
>
> ¿Podrían ayudarme a resolver el problema? Gracias
>
>


--
Sebastian Gurin <sgurin@...>