You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Ryan Moquin <fr...@gmail.com> on 2007/08/01 22:46:42 UTC

Connection Pooling Configuration in Servicemix

Can someone point me to a resource explaining how to configure connection
pooling in servicemix?  I've been looking around and can't seem to find any
information on it.  I'm having problems with not being able to obtain
connections to the database, I'm assuming because the settings aren't
optimal.

Thanks!

Re: Connection Pooling Configuration in Servicemix

Posted by Bruce Snyder <br...@gmail.com>.
On 8/2/07, Ryan Moquin <fr...@gmail.com> wrote:
> I configured a JNDI Datasource for SQL Server.  It's basically just a
> standard definition and I'm able to look it up and perform a database
> operation.  So here's the situation and maybe you can help me figure out
> where my logic is flawed.  I'm deploying an SA to servicemix containing 1
> service.  When it starts up, it initializes itself, if there isn't anything
> in a specific table, and loads about 8500 into that table.
>
> Now, I was originally just letting hibernate handle all the connection
> pooling internally, and it worked great.  Absolutely NO problem whatsoever.
> I learned last week, that the hibernate team says that you shouldn't use the
> hibernate internal pool in production because it doesn't scale.  So, I
> decided to switch to using the pool in Servicemix and define a datasource in
> servicemix.

What do you mean defining a datasource in ServiceMix? Are you just
creating a JDBC connection pool in the conf/servicemix.xml file? If
so, what connection pool are you using?

> Ever since I did that, I've run into nothing but problems
> (other parts of our distributed application are now failing constantly in
> tomcat as well since I stopped letting hibernate manage the pooling).  When
> our service is in the middle of saving the 8500 records to the database, it
> will abort with the exception I will list below.  With hibernates internal
> pooling, all 8500 records will load with no problem.  With a configured data
> source in service mix, I now get between 1000 - 5000 before it will abort
> with the following exception.

Can you provide the configuration you're using? Without more detail
about what exactly you are doing, I can't really even speculate. I'm a
bit confused as it sounds like you're defining a JDBC connection pool
(maybe using c3p0 or Commons DBCP I'm guessing) but an application
running in Tomcat is using the pool. I'm not sure why there appears to
be this separation by defining the connection pool in the
conf/servicemix.xml file instead somewhere in the application running
in Tomcat? Or maybe the whole thing is running in Tomcat including
ServiceMix??? Please provide some details on this.

> Am I misunderstanding something about
> connection pooling?  I'm guessing I have to tweak some parameters.  I
> watched the connection usage in SQL Server, there was only ever 1 connection
> made by our service application during all the database operations before it
> aborted.  Any help will be appreciated, I've been banging my head on why
> external connection pooling won't work this whole week.  Here is the
> exception:
...
> Caused by: org.hibernate.exception.JDBCConnectionException: Cannot open
> connection
...
> 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

I'm still not sure how your app is configured and running, but I
notice that the two errors above indicate a possible port conflict.

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.org/
Apache ServiceMix - http://servicemix.org/
Apache Geronimo - http://geronimo.apache.org/
Castor - http://castor.org/

Re: Connection Pooling Configuration in Servicemix

Posted by Ryan Moquin <fr...@gmail.com>.
I configured a JNDI Datasource for SQL Server.  It's basically just a
standard definition and I'm able to look it up and perform a database
operation.  So here's the situation and maybe you can help me figure out
where my logic is flawed.  I'm deploying an SA to servicemix containing 1
service.  When it starts up, it initializes itself, if there isn't anything
in a specific table, and loads about 8500 into that table.

Now, I was originally just letting hibernate handle all the connection
pooling internally, and it worked great.  Absolutely NO problem whatsoever.
I learned last week, that the hibernate team says that you shouldn't use the
hibernate internal pool in production because it doesn't scale.  So, I
decided to switch to using the pool in Servicemix and define a datasource in
servicemix.  Ever since I did that, I've run into nothing but problems
(other parts of our distributed application are now failing constantly in
tomcat as well since I stopped letting hibernate manage the pooling).  When
our service is in the middle of saving the 8500 records to the database, it
will abort with the exception I will list below.  With hibernates internal
pooling, all 8500 records will load with no problem.  With a configured data
source in service mix, I now get between 1000 - 5000 before it will abort
with the following exception.  Am I misunderstanding something about
connection pooling?  I'm guessing I have to tweak some parameters.  I
watched the connection usage in SQL Server, there was only ever 1 connection
made by our service application during all the database operations before it
aborted.  Any help will be appreciated, I've been banging my head on why
external connection pooling won't work this whole week.  Here is the
exception:

WARN  - JDBCExceptionReporter          - SQL Error: 0, SQLState: 08S01
ERROR - JDBCExceptionReporter          - The TCP/IP connection to the host
has failed. java.net.BindException: Address a
lready in use: connect
WARN  - WaterGaugeServiceImpl          - Couldn't load USGS feeds into
database, this means those feeds won't be availabl
e.
javax.persistence.PersistenceException:
org.hibernate.exception.JDBCConnectionException: Cannot open connection
        at
org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(
AbstractEntityManagerImpl.java:647)
        at org.hibernate.ejb.TransactionImpl.begin(TransactionImpl.java:40)
        at com.bae.gse.flare.hibernate.AuditFacadeImpl.saveAuditBean(
AuditFacadeImpl.java:22)
        at com.bae.gse.flare.hibernate.FeedInfoFacadeImpl.save(
FeedInfoFacadeImpl.java:40)
        at com.bae.gse.flare.service.watergauge.WaterGaugeServiceImpl
.<init>(WaterGaugeServiceImpl.java:100)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(
NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
        at java.lang.Class.newInstance0(Class.java:350)
        at java.lang.Class.newInstance(Class.java:303)
        at org.apache.servicemix.jsr181.Jsr181Endpoint.registerService(
Jsr181Endpoint.java:232)
        at org.apache.servicemix.jsr181.Jsr181Endpoint.validate(
Jsr181Endpoint.java:216)
        at org.apache.servicemix.common.AbstractDeployer.validate(
AbstractDeployer.java:58)
        at org.apache.servicemix.common.xbean.BaseXBeanDeployer.validate(
BaseXBeanDeployer.java:55)
        at org.apache.servicemix.common.xbean.AbstractXBeanDeployer.deploy(
AbstractXBeanDeployer.java:92)
        at org.apache.servicemix.common.BaseServiceUnitManager.doDeploy(
BaseServiceUnitManager.java:88)
        at org.apache.servicemix.common.BaseServiceUnitManager.init(
BaseServiceUnitManager.java:107)
        at org.apache.servicemix.jbi.framework.ServiceUnitLifeCycle.init(
ServiceUnitLifeCycle.java:85)
        at
org.apache.servicemix.jbi.framework.ServiceAssemblyLifeCycle.start(
ServiceAssemblyLifeCycle.java:121)
        at
org.apache.servicemix.jbi.framework.ServiceAssemblyLifeCycle.restore(
ServiceAssemblyLifeCycle.java:328)
        at org.apache.servicemix.jbi.framework.DeploymentService.start(
DeploymentService.java:97)
        at org.apache.servicemix.jbi.container.JBIContainer.start(
JBIContainer.java:606)
        at
org.apache.servicemix.jbi.container.SpringJBIContainer.afterPropertiesSet(
SpringJBIContainer.java:79)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods
(AbstractAutowir
eCapableBeanFactory.java:1057)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean
(AbstractAutowireCa
pableBeanFactory.java:1024)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean
(AbstractAutowireCapabl
eBeanFactory.java:421)
        at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(
AbstractBeanFactory.java:245)
        at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton
(DefaultSingletonBeanRegist
ry.java:140)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(
AbstractBeanFactory.java:242)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(
AbstractBeanFactory.java:156)
        at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons
(DefaultListableB
eanFactory.java:273)
        at
org.springframework.context.support.AbstractApplicationContext.refresh(
AbstractApplicationContext.java:346)
        at org.apache.xbean.spring.context.ClassPathXmlApplicationContext
.<init>(ClassPathXmlApplicationContext.java:161)

        at org.apache.xbean.spring.context.ClassPathXmlApplicationContext
.<init>(ClassPathXmlApplicationContext.java:51)
        at org.apache.servicemix.Main.main(Main.java:51)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.codehaus.classworlds.Launcher.launchStandard(Launcher.java
:410)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:344)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:461)
Caused by: org.hibernate.exception.JDBCConnectionException: Cannot open
connection
        at org.hibernate.exception.SQLStateConverter.convert(
SQLStateConverter.java:74)
        at org.hibernate.exception.JDBCExceptionHelper.convert(
JDBCExceptionHelper.java:43)
        at org.hibernate.exception.JDBCExceptionHelper.convert(
JDBCExceptionHelper.java:29)
        at org.hibernate.jdbc.ConnectionManager.openConnection(
ConnectionManager.java:420)
        at org.hibernate.jdbc.ConnectionManager.getConnection(
ConnectionManager.java:144)
        at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:119)
        at org.hibernate.transaction.JDBCTransaction.begin(
JDBCTransaction.java:57)
        at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java
:1326)
        at org.hibernate.ejb.TransactionImpl.begin(TransactionImpl.java:37)
        ... 41 more
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
        at
com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown
Source)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(Unknown
Source)
        at
com.microsoft.sqlserver.jdbc.SQLServerConnection.loginWithoutFailover(Unknown
Source)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(Unknown
Source)
        at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown
Source)
        at java.sql.DriverManager.getConnection(DriverManager.java:525)
        at java.sql.DriverManager.getConnection(DriverManager.java:140)
        at
org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager
(DriverManagerDataSo
urce.java:291)
        at
org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager
(DriverManagerDataSo
urce.java:277)
        at
org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager
(DriverManagerDataSo
urce.java:259)
        at
org.springframework.jdbc.datasource.DriverManagerDataSource.getConnection(
DriverManagerDataSource.java:240)
        at
org.hibernate.connection.DatasourceConnectionProvider.getConnection(
DatasourceConnectionProvider.java:69)
        at org.hibernate.jdbc.ConnectionManager.openConnection(
ConnectionManager.java:417)
        ... 46 more

On 8/2/07, Bruce Snyder <br...@gmail.com> wrote:
>
> On 8/1/07, Ryan Moquin <fr...@gmail.com> wrote:
> > Can someone point me to a resource explaining how to configure
> connection
> > pooling in servicemix?  I've been looking around and can't seem to find
> any
> > information on it.  I'm having problems with not being able to obtain
> > connections to the database, I'm assuming because the settings aren't
> > optimal.
>
> Are you trying to get a connection to the Derby database used to store
> message exchanges? What configuration are you using to connect? What
> kind of problems are you having exactly?
>
> Bruce
> --
> perl -e 'print
> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> );'
>
> Apache Geronimo - http://geronimo.apache.org/
> Apache ActiveMQ - http://activemq.org/
> Apache ServiceMix - http://servicemix.org/
> Castor - http://castor.org/
>

Re: Connection Pooling Configuration in Servicemix

Posted by Bruce Snyder <br...@gmail.com>.
On 8/1/07, Ryan Moquin <fr...@gmail.com> wrote:
> Can someone point me to a resource explaining how to configure connection
> pooling in servicemix?  I've been looking around and can't seem to find any
> information on it.  I'm having problems with not being able to obtain
> connections to the database, I'm assuming because the settings aren't
> optimal.

Are you trying to get a connection to the Derby database used to store
message exchanges? What configuration are you using to connect? What
kind of problems are you having exactly?

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache Geronimo - http://geronimo.apache.org/
Apache ActiveMQ - http://activemq.org/
Apache ServiceMix - http://servicemix.org/
Castor - http://castor.org/