I'm having some trouble with my Maven2 build (using hibernate, jpa and
spring) recently where all of a sudden I'm starting to get this error
sporadically:

...
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP
connection to the host  has failed. java.net.BindE
xception: Address already in use: connect

...

This happens when running my unit tests against SQL Server.  Up until a few
days ago, I wasn't getting this error and I thought my configuration for
hibernate was perfectly fine.  I've added a lot more code and database tests
recently so I'm assuming that my configuration is somehow not fine and I'm
not running out of connections. I've tried using connection pooling for my
unit tests, but then my test database will stay in use between subproject
builds causing other problems.  I have a heck of a time finding a way to get
my Maven2 build to run all the way through due to problems with connections
not being closed.

So basically, my question is this:

Is anyone using any fairly intensive unit tests against a database from a
multiproject maven2 build using hibernate, spring and jpa?   If so, do you
run into resource problems with connections?  If not, are you using any
specific configuration to make sure connections are disposed of properly
after the unit tests are run?  Am I making a mistake by running my unit
tests again SQL Server and instead I should run against something like HSQL
(in other words, is impossible to not run out of connections when running a
lot of database unit tests)?

I don't want to be vague, but I could probably triple this email with
configuration settings which is not my goal.  I'm not even sure what really
is the problem (maven, hibernate, spring, or my configuration), I'm just
hoping maybe I can get some general advice about unit testing, maven2 and
hibernate from someone doing something similar.

Thanks!

Reply via email to