-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: test environment configuration disaster! please help!!!
PostPosted: Tue Feb 27, 2007 1:45 am 
Newbie

Joined: Tue Feb 27, 2007 1:16 am
Posts: 1
We are using Hibernate 3.1.3 and all is well in the build environment and the live application environment, but the testing environment is broken and I can't figure out why.

I use a MySQL database and both the build, and the live app hit the database correctly. (We run HibernateToolsTask in the build to drop tables and recreate tables) However, when I try to run the functional tests, I get connection exceptions that state that Hibernate is trying to connect to a PostgreSQL database. I have searched my computer, in every corner I can think of, to find a stray configuration file (hibernate.cfg.xml or hibernte.properties or databaseContext.xml) and cannot find any stray files. Plus, the configuration files that are located where I think they should be have the correct configuration data. When I turn on logging - the cfg.Environment prints out a correct configuration that should point to the MySQL database that the HibernateToolsTask in the build correctly hits, and that the live application correctly hits. Nevertheless, I end up with the same postgres connection error. I have even tried installing PostgreSQL and I get the same exact problems with the test environment, while the build and live app environment work just fine.

Clearly, something somewhere is telling the HibernateSession in the test environment to point to a stray PostgreSQL database, but I can't find where. Are there defaults for Hibernate that it resolves to as a last resort?

I also have ran the tests in a shell after unsetting the CLASSPATH to make sure that nothing is getting in the way. And I get the exact same errors.

Does anyone have any ideas about what's going on?!!!????!!! I am getting desparate and have run out of options of what to do.

Thank you,

Tony

The following is a shortened version of the stack trace:

Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection
[junit] org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection
[junit] Caused by: org.hibernate.exception.GenericJDBCException: Cannot open connection
[junit] at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
[junit] at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
[junit] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
[junit] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
[junit] at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:420)
[junit] at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
[junit] at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:129)
[junit] at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:57)
[junit] at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1290)
[junit] at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:494)
[junit] at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:315)
[junit] at org.springframework.test.AbstractTransactionalSpringContextTests.startNewTransaction(AbstractTransactionalSpringContextTests.java:304)
[junit] at org.springframework.test.AbstractTransactionalSpringContextTests.onSetUp(AbstractTransactionalSpringContextTests.java:168)
[junit] at org.springframework.test.AbstractSingleSpringContextTests.setUp(AbstractSingleSpringContextTests.java:77)
[junit] at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69)
[junit] Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.)
[junit] at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:855)
[junit] at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
[junit] at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81)
[junit] at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:417)
[junit] ... 20 more
[junit] Caused by: org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
[junit] at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:122)
[junit] at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:65)
[junit] at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:116)
[junit] at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)
[junit] at org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
[junit] at org.postgresql.Driver.makeConnection(Driver.java:369)
[junit] at org.postgresql.Driver.connect(Driver.java:245)
[junit] at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:37)
[junit] at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:290)
[junit] at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:877)
[junit] at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:851)
[junit] ... 23 more
[junit] Caused by: java.net.ConnectException: Operation timed out
[junit] at java.net.PlainSocketImpl.socketConnect(Native Method)
[junit] at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
[junit] at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
[junit] at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
[junit] at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:430)
[junit] at java.net.Socket.connect(Socket.java:516)
[junit] at java.net.Socket.connect(Socket.java:466)
[junit] at java.net.Socket.<init>(Socket.java:366)
[junit] at java.net.Socket.<init>(Socket.java:179)
[junit] at org.postgresql.core.PGStream.<init>(PGStream.java:60)
[junit] at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:77)
[junit] ... 33 more hiber


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.