Hibernate não encontra DataSource

0 respostas
fredaguiar

Hibernate não encontra DataSource

Já estou na metado do segundo dia tentando resolver isso.

Caused by: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial

at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)

at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)

at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)

at javax.naming.InitialContext.lookup(Unknown Source)

at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:52)

… 9 more

META-INF/context.xml

<Context>
<Resource name="jdbc/TesteDS"
global="jdbc/TesteDS"
auth="Container"
type="javax.sql.DataSource"
username="monty"
password="some_pass"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/test?autoReconnect=true"
maxActive="8"
maxIdle=“4”/>
</Context>

WEB-INF/web.xml

&lt;resource-ref&gt;
  &lt;description&gt;DB Connection&lt;/description&gt;
  &lt;res-ref-name&gt;jdbc/TesteDS&lt;/res-ref-name&gt;
  &lt;res-type&gt;javax.sql.DataSource&lt;/res-type&gt;
  &lt;res-auth&gt;Container&lt;/res-auth&gt;
  &lt;res-sharing-scope&gt;Shareable&lt;/res-sharing-scope&gt; 
&lt;/resource-ref&gt;

hibernate.cfg.xml
<property name=“connection.datasource”>java:comp/env/jdbc/TesteDS</property>

Criado 2 de outubro de 2009
Respostas 0
Participantes 1