Pessoal,
estou recebendo o seguinte erro:
DBCP borrowObject failed: java.sql.SQLException: Access denied for user: 'digo@localhost' (Using password: YES)
Bem, minha solução está baseada no tomcat e hibernate.
Este erro foi gerado devido a minha app estar usando jndi p/ localizar os datasources.
minha configuração está a seguinte:
tomcat_home-conf-Catalina-localhost->minhaapp.xml
onde o arquivo minhaapp.xml está da seguinte forma:
<Context path="/monitor" docBase="monitor">
<Resource name="jdbc/test" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/test">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<!-- DBCP database connection settings -->
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost:3306/test</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>com.mysql.jdbc.Driver</value>
</parameter>
<parameter>
<name>username</name>
<value>digo</value>
</parameter>
<parameter>
<name>password</name>
<value>digo1234</value>
</parameter>
<!-- DBCP connection pooling options -->
<parameter>
<name>maxWait</name>
<value>3000</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>100</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>10</value>
</parameter>
</ResourceParams>
</Context>
continuando...
tomcat_home-webapps-minhapp-WEB-INF-classes-hibernate.cfg.xml
onde o meu arquivo hibernate.cfg.xml está seguinte forma:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.datasource">java:comp/env/jdbc/test</property>
<property name="show_sql">false</property>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<!-- Mapping files -->
<mapping resource="br/com/rti/monitoring/bo/AccountBO.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Ao executar a minha aplicação eu recebo o seguinte argumento:
aqui está o load do hibernate no console:
98071 [http-8080-Processor25] INFO cfg.Environment - Hibernate 2.1 final
98081 [http-8080-Processor25] INFO cfg.Environment - hibernate.properties not found
98101 [http-8080-Processor25] INFO cfg.Environment - using CGLIB reflection optimizer
98121 [http-8080-Processor25] INFO cfg.Configuration - configuring from resource: /hibernate.cfg.xml
98121 [http-8080-Processor25] INFO cfg.Configuration - Configuration resource: /hibernate.cfg.xml
99193 [http-8080-Processor25] INFO cfg.Configuration - Mapping resource: br/com/rti/monitoring/bo/AccountBO.hbm.xml
100204 [http-8080-Processor25] INFO cfg.Binder - Mapping class: br.com.rti.monitoring.bo.AccountBO -> account
101396 [http-8080-Processor25] INFO cfg.Configuration - Configured SessionFactory: null
101406 [http-8080-Processor25] INFO cfg.Configuration - processing one-to-many association mappings
101406 [http-8080-Processor25] INFO cfg.Configuration - processing one-to-one association property references
101406 [http-8080-Processor25] INFO cfg.Configuration - processing foreign key constraints
101686 [http-8080-Processor25] INFO dialect.Dialect - Using dialect: net.sf.hibernate.dialect.MySQLDialect
101686 [http-8080-Processor25] INFO cfg.SettingsFactory - Use outer join fetching: true
101746 [http-8080-Processor25] INFO util.NamingHelper - JNDI InitialContext properties:{}
101957 [http-8080-Processor25] INFO connection.DatasourceConnectionProvider - Using datasource: java:comp/env/jdbc/test
102057 [http-8080-Processor25] INFO transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
DBCP borrowObject failed: java.sql.SQLException: Access denied for user: 'digo@localhost' (Using password: YES)
O que pode estar equivocado?
Eu fiz um teste com hiberante.cfg.xml sem jndi da seguinte forma:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/test</property>
<property name="show_sql">false</property>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<!-- Mapping files -->
<mapping resource="br/com/rti/monitoring/bo/AccountBO.hbm.xml"/>
</session-factory>
</hibernate-configuration>
E FUNCIONOU.
Grato pela atenção pessoal.