atomikos 支持sqlsql server 停止支持吗

All feedback will be investigated, but priority support, confidential support, and product priority updates are reserved for customers. Interested in becoming a customer? ...
Only registered users can post ( is free). Problems registering? Send an email to
to get help.
Connection pool exhausted Exception
I am working on porting a working application into OSGi/Maven style bundles. This works in the original application, but in the new alternate version I get the exception at the bottom of this post.I have three databases that I am connecting to. 2 are MySQL, and 1 is SqlServer. The two MySQL work fine, the SqlServer one is the problem. The settings are the same, so why am I getting this exception?[code:title=SqlServer Bean]&&&&&bean id=&abstractSqlServerDatasource&&&&&class=&com.atomikos.jdbc.nonxa.AtomikosNonXADataSourceBean&&&&&&&&&&&property name=&driverClassName& value=&net.sourceforge.jtds.jdbc.Driver& /&&&&&&&&&&property name=&minPoolSize& value=&5& /&&&&&&&&&&property name=&maxPoolSize& value=&50& /&&&&&&&&&&property name=&borrowConnectionTimeout& value=&60& /&&&&&&&&&&property name=&testQuery& value = &select version()& /&&&&&&/bean&&&&&&&&&&bean id=&sqlserverDataSource& parent=&abstractSqlServerDatasource&&&&&init-method=&init& destroy-method=&close&&&&&&&&&&&property name=&uniqueResourceName& value=&sqlserver/db& /&&&&&&&&&&property name=&url&&&&&&&&&&&&&value=&jdbc:jtds:sqlserver://${db.host}:${db.port}/${db.schema}& /&&&&&&&&&&property name=&user& value=&${db.username}& /&&&&&&&&&&property name=&password& value=&${db.password}& /&&&&&&/bean&[code][code:title=Working MySQL Configuration]&&&&&bean id=&abstractMySQLDatasource& class=&com.atomikos.jdbc.nonxa.AtomikosNonXADataSourceBean&&&&&&&&&&&property name=&driverClassName& value=&com.mysql.jdbc.Driver& /&&&&&&&&&&property name=&minPoolSize& value=&5& /&&&&&&&&&&property name=&maxPoolSize& value=&50& /&&&&&&&&&&property name=&borrowConnectionTimeout& value=&60& /&&&&&&&&&&property name=&testQuery& value = &select version()& /&&&&&&/bean&&&&&&&&&&bean id=&mysqlDataSource& parent=&abstractMySQLDatasource&&&&&init-method=&init& destroy-method=&close&&&&&&&&&&&property name=&uniqueResourceName& value=&mySQL/db& /&&&&&&&&&&property name=&url&&&&&&&&&&&&&value=&jdbc:mysql://${mysqldb.host}:${mysqldb.port}/${dbmysql.schema}& /&&&&&&&&&&property name=&user&&&&&&&&&&&&&&&value&${mysqldb.user}&/value&&&&&&&&&&/property&&&&&&&&&&property name=&password&&&&&&&&&&&&&&&value&${mysqldb.passwd}&/value&&&&&&&&&&/property&&&&&&/bean&[code][code:title=Exception][ 16:44:30.985] aultQuartzScheduler_Worker-3 org.quartz.core.ErrorLogger& & & & & & & & & & & & & & & & & & &
Job (DEFAULT.serviceFetcherJobDetailBean threw an exception. org.quartz.SchedulerException: Job threw an unhandled exception.&&&&at org.quartz.core.JobRunShell.run(JobRunShell.java:213)&&&&at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC C nested exception is com.atomikos.jdbc.AtomikosSQLException: Connection pool exhausted - try increasing 'maxPoolSize' and/or 'borrowConnectionTimeout' on the DataSourceBean.&&&&at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:82)&&&&at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:381)&&&&at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:455)&&&&at org.springframework.jdbc.core.JdbcTemplate.queryForRowSet(JdbcTemplate.java:498)&&&&at mynamespace.service.dao.impl.mssql.DaoImpl.fetchAllTags(DaoImpl.java:46)&&&&at mynamespace.service.dao.impl.mssql.DaoImpl.fetchTagForDeviceId(DaoImpl.java:28)&&&&at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)&&&&at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)&&&&at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)&&&&at java.lang.reflect.Method.invoke(Method.java:616)&&&&at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)&&&&at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:58)&&&&at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:62)&&&&at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)&&&&at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)&&&&at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)&&&&at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)&&&&at org.springframework.osgi.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:59)&&&&at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)&&&&at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)&&&&at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)&&&&at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)&&&&at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)&&&&at $Proxy236.fetchTagForDeviceId(Unknown Source)&&&&at mynamespace.service.jobs.fetcher.Fetcher.fetch(Fetcher.java:103)&&&&at mynamespace.service.jobs.ServiceFetcherJob.fetch(ServiceFetcherJob.java:36)&&&&at mynamespace.service.jobs.ServiceFetcherJob.executeInternal(ServiceFetcherJob.java:26)&&&&at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86)&&&&at org.quartz.core.JobRunShell.run(JobRunShell.java:202)&&&&... 1 common frames omittedCaused by: com.atomikos.jdbc.AtomikosSQLException: Connection pool exhausted - try increasing 'maxPoolSize' and/or 'borrowConnectionTimeout' on the DataSourceBean.&&&&at com.atomikos.jdbc.AtomikosSQLException.throwAtomikosSQLException(AtomikosSQLException.java:19)&&&&at com.atomikos.jdbc.AbstractDataSourceBean.throwAtomikosSQLException(AbstractDataSourceBean.java:62)&&&&at com.atomikos.jdbc.AbstractDataSourceBean.throwAtomikosSQLException(AbstractDataSourceBean.java:57)&&&&at com.atomikos.jdbc.AbstractDataSourceBean.getConnection(AbstractDataSourceBean.java:294)&&&&at com.atomikos.jdbc.nonxa.AtomikosNonXADataSourceBean.getConnection(AtomikosNonXADataSourceBean.java:180)&&&&at com.atomikos.jdbc.AbstractDataSourceBean.getConnection(AbstractDataSourceBean.java:341)&&&&at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:113)&&&&at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:79)&&&&... 29 common frames omitted[code]
woensdag 22 september 2010
Hard to say without the tm.out logs...
Guy Pardon
woensdag 22 september 2010
I am using Eclipse Virgo (formerly Spring-DM Server), I do not see a tm.out file. What kind of information are you looking for? I don't actually know what tm.out is.
woensdag 22 september 2010
It's our dedicated log file (like log4j if you like) and contains all interactions that matter for the JTA/XA part.
Guy Pardon
woensdag 22 september 2010
I do not see such a file on my system, and tm.out was not found. I am using default properties, jta.properties does not exist if that makes a difference.I am obviously new with Atomikos, is there a default location that this would normally live? Or could it be called something different?
woensdag 22 september 2010
Default is the working dir of your application or JVM. If your datasource gets used by more client apps then you should increase the poolSize, BTW. Maybe that is the explanation. Guy
Guy Pardon
donderdag 23 september 2010
Right now my application looks something like this:A) Quartz Bundle, allows jobs to be hot deployed or removed from the schedulerB) SqlServer Bundle, Atomikos instanceC) Job BundleC depends on both A and B via OSGiNo other modules are using SqlServer at this time (although certainly more will be added eventually)So I would be surprised if the pool is actually getting too large as only the one client is accessing SqlServer and it is only making one call and then caching the results.I also tried increasing the max pool size, but that didn't help. I took the max from 50 to 100.As far as the working directory. I am not sure if that is going to be the Virgo working directory, or somehow specific to A, B, or C. Either way, I still cannot find tm.out on my server. Is there a way that I can force the log to generate at a location of my choosing?
donderdag 23 september 2010
I added jta.properties to src/main/resources/jta.properties for each bundle involved. jta.properties looks like this:[root@testserver current]# cat /home/user/jta.properties com.atomikos.icatch.log_base_dir = /opt/virgo/current/serviceability/atomikoscom.atomikos.icatch.output_dir = /opt/virgo/current/serviceability/atomikoscom.atomikos.icatch.tm_unique_name = [bundle_name]com.atomikos.icatch.console_log_level = DEBUGStill no logging for atomikos. Is there something else I could try?
donderdag 23 september 2010
OK regarding the logging: does startup of the app print the properties file to System.err? Does it pick up the properties file you want?
Guy Pardon
vrijdag 24 september 2010
I also started a topic over at the Virgo Forum:They are asking what logging mechanism Atomikos uses? It seems that it is possible that Virgo might be redirecting the logs somehow. Knowing what Atomikos is using might help them determine if Virgo is redirecting the logs.In the meantime, I will work on verifying if the jta.properties file is actually being loaded.Thanks,Dennis
vrijdag 24 september 2010
JDK logging by default plus log4j if you put slf4j-log4j jars in your classpath...
Guy Pardon
vrijdag 24 september 2010
&./bin/startup.sh & output 2&err&, produced no stderr logs.log4j is available on all my bundles.I unzipped one of my bundles to confirm jta.properties is physically located in the root of the classpath.Any other way I might be able to determine if jta.properties is being loaded? At this point I am wondering if it is not.
vrijdag 24 september 2010
So Atomikos expects that the jta.properties file will always be in the root of the application's classpath. For a normal Java application, this wouldn't be a problem. But in the case of OSGi, there is a root classpath for the bundle, but does that equate to the root classpath of the application?I wonder if Atomikos is looking at the Virgo root classpath instead of the bundle's? Is that possible? If so, then I would imagine default logging would be being utilized. So that still wouldn't explain why I am not getting any logs, but may explain why jta.properties is seemingly ignored.Thoughts?
vrijdag 24 september 2010
Hi,I'm the person who help atomikos into the OSGi fication of their (excellent) product.I need to say that the version you use is a very first try : next version will be far much better.Though the current version is usable and here is how I used It :I create a bundle () which holds the JTA configuration (see the module-context.xml) and export an OSGi service the implements Spring's org.springframework.transaction.PlatformTransactionManager as JTA Service. as you can notice, you can easily customize the trace level there.I create my DB config as decribe in this bundle ().I faced several classloading issues and that why I used &patch& the atomikos bunbles with fragment to allow them to access certain pakages of the JDBC driver ( and ). Hope this helps.
zondag 26 september 2010
Thank you! That was exactly what I needed.To get logging work, I basically just followed org.dynaresume.infrastructure.jtatransaction. I am not certain I fully understood the other modules, but the one was enough to get logging to work. Once I had logging, I quickly identified the trivial bug that was causing me headaches.Thank you for your help.
maandag 27 september 2010
This topic is archived. No further replies will be accepted.
Powered by温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!&&|&&
在这里是面向程序员的高品质IT技术学习社区,是程序员学习成长的地方。让我们更好地用技术改变世界。请关注新浪微博号: IT国子监(/itguozijian)
LOFTER精选
网易考拉推荐
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
Atomikos TransactionsEssentials 是一个可靠的库,可以加入到您的Java应用程序,也就是说为了使用这个产品,您必须添加一些jar文件(包括在dist和lib文件夹下)到您的应用程序或者应用程序服务器。起因:&小项目,没有用分布式,但要操作两个数据库。本以为随便用spring配置两个数据源就搞定,查询是没问题,问题是有一个数据库老是插不进数据。Google狂搜之后,大概了解到是事务控制的问题。我用的是spring的声明式事务管理(&tx:annotation-driven/&)。用一般的数据源配置,只有一个数据源的事务生效,其它数据源只能读不能写。&有帖子说,要支持多数据源的事务,只能用JTA事务管理(没用过 -_-||),而且应用服务器还不能是Tomcat(一直在用tomcat,不想换-_-!!),头疼了。幸亏后面还有说,有第三方的实现支持JTA事务管理,一是JOTM,一是Atomikos。只要用了其中一个,还能继续用Tomcat。因为名字短,先考虑用JOTM。到官网一看,最后更新日期是2010年。。呃。。转向Atomikos。在Atomikos的官网看看文档,看看例子,边做边调试,一个下午下来,总算有点成果,高兴之余做个记录。其中会涉及到一些概念,比如分布式事务、JTA、XA,我都有搜来了解一下,因理解肤浅没法做记录。下面只是记录&Atomikos TransactionsEssentials 是一个为Java平台提供增值服务的并且开源类事务管理器,以下是包括在这个开源版本中的一些功能:l& 全面崩溃 / 重启恢复l& 兼容标准的SUN公司JTA APIl& 嵌套事务l& 为XA和非XA提供内置的JDBC适配器注释:XA:XA协议由Tuxedo首先提出的,并交给X/Open组织,作为资源管理器(数据库)与事务管理器的接口标准。目前,Oracle、Informix、DB2和Sybase等各大数据库厂家都提供对XA的支持。XA协议采用两阶段提交方式来管理分布式事务。XA接口提供资源管理器与事务管理器之间进行通信的标准接口。XA协议包括两套函数,以xa_开头的及以ax_开头的。以下的函数使事务管理器可以对资源管理器进行的操作:  1)xa_open,xa_close:建立和关闭与资源管理器的连接。  2)xa_start,xa_end:开始和结束一个本地事务。  3)xa_prepare,xa_commit,xa_rollback:预提交、提交和回滚一个本地事务。  4)xa_recover:回滚一个已进行预提交的事务。  5)ax_开头的函数使资源管理器可以动态地在事务管理器中进行注册,并可以对XID(TRANSACTION IDS)进行操作。  6)ax_reg,ax_unreg;允许一个资源管理器在一个TMS(TRANSACTION MANAGER SERVER)中动态注册或撤消注册。l& 内置的JMS适配器XA-capable JMS队列连接器注释:JMS:jms即(Java Message Service)接口是一个中关于面向(MOM)的API,用于在两个应用程序之间,或中发送消息,进行异步通信。Java消息服务是一个与具体平台无关的API,绝大多数MOM提供对JMS提供支持。l& 通过XA API兼容第三方适配器l& 更好的整合您的项目l& 集成Hibernateatomikos配合spring的使用方法:&1、依赖包&Atomikos的:&transactions-jdbc&transactions-jta&transactions-api&transactions&atomikos-utils&还有一个不要忘了,是jta的包。&用maven要简单一点,只需要加入两个依赖:&Xml代码&&dependency&&&&&&&&groupId&com.atomikos&/groupId&&&&&&&&artifactId&transactions-jdbc&/artifactId&&&&&&&&version&3.7.0&/version&&&&/dependency&&&&dependency&&&&&&&&groupId&javax.transaction&/groupId&&&&&&&&artifactId&jta&/artifactId&&&&&&&&version&1.1&/version&&&&/dependency&&&2、配置数据源&&&& 这一步是比较重要的。要用AtomikosDataSourceBean,而不是以前用的连接池如dbcp。最好也用XA(这东西我还不太懂),注意jdbc的链接地址和登陆账号与普通连接池的配置的格式不一样。下面是一个mysql数据库的配置举例:&Xml代码&&bean&id="dataSource1"&class="com.atomikos.jdbc.AtomikosDataSourceBean"&init-method="init"&destroy-method="close"&&&&&&&&property&name="uniqueResourceName"&value="ds1"/&&&&&&&&property&name="xaDataSourceClassName"&value="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource"/&&&&&&&&property&name="xaProperties"&&&&&&&&&&&&props&&&&&&&&&&&&&&&&prop&key="url"&jdbc:mysql://localhost/test&/prop&&&&&&&&&&&&&&&&prop&key="user"&test&/prop&&&&&&&&&&&&&&&&prop&key="password"&test&/prop&&&&&&&&&&&&/props&&&&&&&&/property&&&&&&&&property&name="minPoolSize"&value="10"&/&&&&&&&&property&name="maxPoolSize"&value="100"&/&&&&&&&&property&name="borrowConnectionTimeout"&value="30"&/&&&&&&&&property&name="testQuery"&value="select&1"&/&&&&&&&&property&name="maintenanceInterval"&value="60"&/&&&&/bean&&&再来一个sybase的配置举例:&Xml代码&&bean&id="dataSource2"&class="com.atomikos.jdbc.AtomikosDataSourceBean"&init-method="init"&destroy-method="close"&&&&&&&&property&name="uniqueResourceName"&value="ds2"/&&&&&&&&property&name="xaDataSourceClassName"&value="com.sybase.jdbc3.jdbc.SybXADataSource"/&&&&&&&&property&name="xaProperties"&&&&&&&&&&&&props&&&&&&&&&&&&&&&&prop&key="serverName"&192.168.1.10&/prop&&&&&&&&&&&&&&&&&&&&&&&&&&&&prop&key="portNumber"&2638&/prop&&&&&&&&&&&&&&&&&&&&&&&&&&&&prop&key="databaseName"&test&/prop&&&&&&&&&&&&&&&&prop&key="user"&test&/prop&&&&&&&&&&&&&&&&prop&key="password"&test&/prop&&&&&&&&&&&&/props&&&&&&&&/property&&&&&&&&property&name="minPoolSize"&value="10"&/&&&&&&&&property&name="maxPoolSize"&value="100"&/&&&&&&&&property&name="borrowConnectionTimeout"&value="30"&/&&&&&&&&property&name="testQuery"&value="select&1"&/&&&&&&&&property&name="maintenanceInterval"&value="60"&/&&&&/bean&&&3、使用数据源&&&& 这一步与平时好像没什么不一样。我做例子的时候是用mybatis,配置如下:&Xml代码&&bean&id="sqlSessionFactory1"&class="org.mybatis.spring.SqlSessionFactoryBean"&&&&&&&&property&name="dataSource"&ref="dataSource1"/&&&&/bean&&&&bean&id="sqlSessionFactory2"&class="org.mybatis.spring.SqlSessionFactoryBean"&&&&&&&&property&name="dataSource"&ref="dataSource2"/&&&&/bean&&&当然,mybatis还要配置一下映射文件的自动扫描,这里与atomikos无关:&Xml代码&&bean&class="org.mybatis.spring.mapper.MapperScannerConfigurer"&&&&&&&&property&name="basePackage"&value="xx."&/&&&&&&&&property&name="sqlSessionFactory"&ref="sqlSessionFactory1"/&&&&/bean&&&&bean&class="org.mybatis.spring.mapper.MapperScannerConfigurer"&&&&&&&&property&name="basePackage"&value="yy."&/&&&&&&&&property&name="sqlSessionFactory"&ref="sqlSessionFactory2"/&&&&/bean&&&用spring JdbcTemplate应该与普通使用没什么不同,用hibernate可能会有点不一样,没测试过。&4、配置jta事务管理&&&& 这是很关键的一步。原理我不太懂,例子如下:&Xml代码&&bean&id="transactionManager"&class="org.springframework.transaction.jta.JtaTransactionManager"&&&&&&&&property&name="transactionManager"&&&&&&&&&&&&bean&class="com.atomikos.icatch.jta.UserTransactionManager"&init-method="init"&destroy-method="close"&&&&&&&&&&&&&&&&property&name="forceShutdown"&value="true"/&&&&&&&&&&&&/bean&&&&&&&&/property&&&&&&&&property&name="userTransaction"&&&&&&&&&&&&bean&class="com.atomikos.icatch.jta.UserTransactionImp"/&&&&&&&&/property&&&&/bean&&&当然,用spring的声明式事务配置,再加上一行:&Xml代码&&tx:annotation-driven/&&&(注意,本来要配置transaction-manager属性,如:&tx:annotation-driven&transaction-manager="transactionManager"/&。这里没有配置是因为它的默认值是transactionManager)&5、atomikos的配置文件jta.properties&&&& 这个文件一般放在根路径吧,与log4j.properties类似。jta.properties也可命名为transactions.properties。如果不配置这个文件,项目也能启动,因为几乎所有配置项都有默认值。最好还是配置了,详细配置信息请查看:/Documentation/JtaProperties。&6、不管是用JdbcTemplate、mybatis还是hibernate,应该都可以写代码来测试了。。。&(记得关注噢)&
阅读(13861)|
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
历史上的今天
loftPermalink:'',
id:'fks_',
blogTitle:'atomikos实现多数据源支持分布式事务管理(spring、tomcat、JTA)',
blogAbstract:'
{if x.moveFrom=='wap'}
{elseif x.moveFrom=='iphone'}
{elseif x.moveFrom=='android'}
{elseif x.moveFrom=='mobile'}
${a.selfIntro|escape}{if great260}${suplement}{/if}
{list a as x}
推荐过这篇日志的人:
{list a as x}
{if !!b&&b.length>0}
他们还推荐了:
{list b as y}
转载记录:
{list d as x}
{list a as x}
{list a as x}
{list a as x}
{list a as x}
{if x_index>4}{break}{/if}
${fn2(x.publishTime,'yyyy-MM-dd HH:mm:ss')}
{list a as x}
{if !!(blogDetail.preBlogPermalink)}
{if !!(blogDetail.nextBlogPermalink)}
{list a as x}
{if defined('newslist')&&newslist.length>0}
{list newslist as x}
{if x_index>7}{break}{/if}
{list a as x}
{var first_option =}
{list x.voteDetailList as voteToOption}
{if voteToOption==1}
{if first_option==false},{/if}&&“${b[voteToOption_index]}”&&
{if (x.role!="-1") },“我是${c[x.role]}”&&{/if}
&&&&&&&&${fn1(x.voteTime)}
{if x.userName==''}{/if}
网易公司版权所有&&
{list x.l as y}
{if defined('wl')}
{list wl as x}{/list}

我要回帖

更多关于 sql server 支持xp吗 的文章

 

随机推荐