I'm trying to deploy an Spring web application that has as dependendy another Spring Application (in this case a jar) where this jar has all the domain definition and database connection info. The database that I'm using is postgresql with the driver:
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.3-1102-jdbc41</version>
</dependency>
in this context I'm having this error:
2014-08-05 11:33:52,463 [http-8082-4] DEBUG org.hibernate.util.JDBCExceptionReporter - Cannot open connection [???]
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Can not create PoolableConnectionFactory (Connection refused. Verify that the hostname and port are correct and that the postmaster is accepting TCP / IP connections.)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:71)
I dont know what happend with this error because before this change, the web application had all the domain and database connections info.
Other test that I made, how to encapsulate just the domain classes into a jar to be imported by the web application without the connection info but in that case the problem was that the entites doesn't found any transaction manager to execute even when the datasource was created in the same webapplication.
As you can see, the thing is I want to separate the domain model in a module which any other module or project can use it like a dependency.