[HIBERNATE + SPRING] - Could not configure datastore from input stream

5 respostas
M

Olá, estou tentando rodar um Junit test case utilizando spring + hibernate estou recebendo o seguinte erro.

2005-07-12 11:37:07,750 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - 
<Loading XML bean definitions from class path resource 
[META-INF/applicationContext.xml]>

2005-07-12 11:37:08,906 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - 
<Loading XML bean definitions from class path resource 
[META-INF/applicationContext-hibernate.xml]>

2005-07-12 11:37:09,656 INFO [org.springframework.beans.factory.xml.XmlBeanFactory] - <Creating 
shared instance of singleton bean 'manterAreaInteresse'>

2005-07-12 11:37:10,031 INFO [org.springframework.beans.factory.xml.XmlBeanFactory] - <Creating 
shared instance of singleton bean 'areaInteresseDao'>

2005-07-12 11:37:10,156 INFO [org.springframework.beans.factory.xml.XmlBeanFactory] - <Creating 
shared instance of singleton bean 'sessionFactory'>

2005-07-12 11:37:10,437 INFO [org.springframework.beans.factory.xml.XmlBeanFactory] - <Creating 
shared instance of singleton bean 'dataSource'>

2005-07-12 11:37:10,531 INFO [org.springframework.jdbc.datasource.DriverManagerDataSource] - 
<Loaded JDBC driver: com.mysql.jdbc.Driver>

2005-07-12 11:37:10,734 INFO [net.sf.hibernate.cfg.Environment] - <Hibernate 2.1.7>

2005-07-12 11:37:10,765 INFO [net.sf.hibernate.cfg.Environment] - 
<loaded properties from resource hibernate.properties: 
{hibernate.connection.driver_class=com.mysql.jdbc.Driver, 
hibernate.cglib.use_reflection_optimizer=true, 
hibernate.cache.provider_class=net.sf.hibernate.cache.EhCacheProvider, 
hibernate.cache.use_query_cache=true, hibernate.max_fetch_depth=1, 
hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect, 
hibernate.jdbc.use_streams_for_binary=true, 
hibernate.jdbc.batch_size=0, hibernate.query.substitutions=true 1, false 0, 
yes 'Y', no 'N', hibernate.proxool.pool_alias=pool1, 
hibernate.connection.username=syndeo, 
hibernate.cache.region_prefix=hibernate.test, 
hibernate.connection.url=jdbc:mysql://192.168.0.80:3306/dmsdb, 
hibernate.connection.password=syndeo, 
hibernate.jdbc.batch_versioned_data=true, 
hibernate.connection.pool_size=1}>

2005-07-12 11:37:10,812 INFO [net.sf.hibernate.cfg.Environment] - <using java.io streams to persist binary types>

2005-07-12 11:37:10,812 INFO [net.sf.hibernate.cfg.Environment] - <using CGLIB reflection optimizer>

2005-07-12 11:37:10,843 INFO [net.sf.hibernate.cfg.Environment] - <using JDK 1.4 java.sql.Timestamp handling>

2005-07-12 11:37:33,000 ERROR [net.sf.hibernate.cfg.Configuration] - <Could not configure datastore from input stream>

org.dom4j.DocumentException: Connection timed out: connect Nested exception: Connection timed out: connect

      at org.dom4j.io.SAXReader.read(SAXReader.java:358)

      at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:286)

      at org.springframework.orm.hibernate.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:448)

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1075)

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:349)

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:257)

      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:222)

      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:146)

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveReference(AbstractAutowireCapableBeanFactory.java:982)

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveValueIfNecessary(AbstractAutowireCapableBeanFactory.java:905)

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:846)

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:675)

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:331)

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:257)

      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:222)

      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:146)

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveReference(AbstractAutowireCapableBeanFactory.java:982)

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveValueIfNecessary(AbstractAutowireCapableBeanFactory.java:905)

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:846)

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:675)

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:331)

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:257)

      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:222)

      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:146)

      at br.syndeo.dms.test.service.pessoa.ManterAreaInteresseTest.setUp(ManterAreaInteresseTest.java:21)

      at junit.framework.TestCase.runBare(TestCase.java:125)

      at junit.framework.TestResult$1.protect(TestResult.java:106)

      at junit.framework.TestResult.runProtected(TestResult.java:124)

      at junit.framework.TestResult.run(TestResult.java:109)

      at junit.framework.TestCase.run(TestCase.java:118)

      at junit.framework.TestSuite.runTest(TestSuite.java:208)

      at junit.framework.TestSuite.run(TestSuite.java:203)

      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:474)

      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:342)

      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:194)

Alguem se habilita?


[color=red]Por favor, quando colar o código, tente quebrar
as linhas grandes para não exceder o tamanho da tela ;) -> Shoes[/color]

5 Respostas

Rodrigo_Carvalho_Aul

O Hibernate não conseguiu acessar o banco de dados. Ele tá funcionando? Tem permissão pra acessar? Tenta acessar com um client qualquer pra ver se está tudo ok…

[]'s

Rodrigo

M

Já testei a conexão e não houve problemas.
Abaixo segue a configuração do meu spring applicationContext.xml, com a configuração do acesso ao banco de dados.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<!--
  - Application context definition for DMS on Hibernate.
	-->
<beans>

	<!-- ========================= RESOURCE DEFINITIONS ========================= -->
  
    <!-- Local DataSource that works in any environment. Just use for testes-->
	<!-- Note that DriverManagerDataSource does not pool; it is not intended for production -->	
	 
	<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
		<property name="driverClassName"><value>com.mysql.jdbc.Driver</value></property>
		<property name="url"><value>jdbc:mysql://192.168.0.167:3306/dmsdb</value></property>
		<property name="username"><value>xxxxxxxx</value></property>
		<property name="password"><value>xxxxxxxxx</value></property>
	</bean>
    
  
	<!-- JNDI DataSource for J2EE environments -->
	
	<!-- bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
		<property name="jndiName"><value>java:myDS</value></property>
	</bean-->
	

	<!-- Hibernate SessionFactory -->
	<bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
		<property name="dataSource"><ref local="dataSource"/></property> 

...
M

Solução em http://www.guj.com.br/posts/list/27421.java

Luca

Olá

Moacir, não faz mais assim. Coloca tudo dentro do mesmo tópico.

[]s
Luca

M

Olá Luca,

Realmente peço desculpas.
Vacilei e quando fui ver já não tinha mais jeito.
Prometo não cometer o mesmo erro.

Até.

Criado 12 de julho de 2005
Ultima resposta 13 de jul. de 2005
Respostas 5
Participantes 3