关于spring+hibernate配置jta事务提交后没有持久化到数据库(求大神帮忙看看) 30C

我的环境 spring 5.0+hibernate5.0+atomilkos 我想用二个数据库资源进行jta事物管理
一个mysql 一个oracle
这是我的配置文件:图片说明

https://img-ask.csdn.net/upload/201612/25/1482674803_698369.png

这是我的dao代码
https://img-ask.csdn.net/upload/201612/25/1482675145_855437.png

这是我的service代码
        https://img-ask.csdn.net/upload/201612/25/1482675038_683404.png

    这是单元测试
        https://img-ask.csdn.net/upload/201612/25/1482675110_107287.png

        控制台输出
        https://img-ask.csdn.net/upload/201612/25/1482675173_466045.png

        测试能通过中间没有异常抛出,是有事务参与其中。但是数据并未有持久化到数据库。看了spring 的官方文档,关于这快没有详细说明,与hibernate整合jta的详细细节。这里有个问题,配置jta事务是应该通过SessionFactory.getCurrentSession()获取Session,还是通过openSession()获取会话。但是2种方式都试过,没有提交。我单独用jdbc实现的方式,就能正常使用jta的提交与回滚功能。是不是我还有那个地方缺少配置。请大神指点一下!!

2个回答

这么多配置,我都看晕了,,你这个肯定是事物没有提交.....先尝试用单个数据库试试,看可不可撒.

u012930316
病毒先生 66666
大约 3 年之前 回复
perfectIdeal
触动心灵的旋律 一切都配置好了就是配置hibernate的时候差了一个 <prop key="hibernate.transaction.factory_class">org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorBuilderImpl</prop> 自己搞了好久终于解决
大约 3 年之前 回复

应该是atomilkos没有配置好

perfectIdeal
触动心灵的旋律 一切都配置好了就是配置hibernate的时候差了一个 <prop key="hibernate.transaction.factory_class">org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorBuilderImpl</prop> 自己搞了好久终于解决
大约 3 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
关于spring+hibernate配置jta事务提交后没有持久化到数据库(求大神帮忙看看)
我的环境 spring 5.0+hibernate5.0+atomilkos 我想用二个数据库资源进行jta事物管理 一个mysql 一个oracle 这是我的配置文件:![图片说明](https://img-ask.csdn.net/upload/201612/25/1482674793_65910.png) https://img-ask.csdn.net/upload/201612/25/1482674803_698369.png 这是我的dao代码 https://img-ask.csdn.net/upload/201612/25/1482675145_855437.png 这是我的service代码 https://img-ask.csdn.net/upload/201612/25/1482675038_683404.png 这是单元测试 https://img-ask.csdn.net/upload/201612/25/1482675110_107287.png 控制台输出 https://img-ask.csdn.net/upload/201612/25/1482675173_466045.png 测试能通过中间没有异常抛出,是有事务参与其中。但是数据并未有持久化到数据库。看了spring 的官方文档,关于这快没有详细说明,与hibernate整合jta的详细细节。这里有个问题,配置jta事务是应该通过SessionFactory.getCurrentSession()获取Session,还是通过openSession()获取会话。但是2种方式都试过,没有提交。我单独用jdbc实现的方式,就能正常使用jta的提交与回滚功能。是不是我还有那个地方缺少配置。请大神指点一下!!
spring + hibernate +jta 事务不能回滚问题
[code="java"][/code] spring 配置文件 <bean id="idcJDBC" class="com.atomikos.jdbc.SimpleDataSourceBean"> <property name="uniqueResourceName"><value>db_idcbase</value></property> <property name="xaDataSourceClassName"><value>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</value></property> <property name="xaDataSourceProperties"> <value>URL=jdbc:mysql://127.0.0.1:3306/db_idcbase?useUnicode=true&amp;characterEncoding=gb2312;user=root;password=admin</value> </property> <property name="exclusiveConnectionMode"><value>true</value></property> <property name="connectionPoolSize"><value>3</value></property> <property name="validatingQuery"><value>SELECT 1</value></property> </bean> <!--sessionFactoryIdc --> <bean id="sessionFactoryIdc" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="idcJDBC" /> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> <prop key="hibernate.show_sql">true</prop> </props> </property> <property name="mappingResources"> <list> <value> com/yiwei/hibernate/bean/TblReportHosts.hbm.xml </value> <value> com/yiwei/hibernate/bean/TblRuleUrls.hbm.xml </value> <value> com/yiwei/hibernate/bean/TblRuleIps.hbm.xml </value> <value> com/yiwei/hibernate/bean/TblRuleTcps.hbm.xml </value> <value> com/yiwei/hibernate/bean/TblRuleUdps.hbm.xml </value> <value> com/yiwei/hibernate/bean/TblReportUrls.hbm.xml </value> <value> com/yiwei/hibernate/bean/TblReportKeys.hbm.xml </value> <value> com/yiwei/hibernate/bean/TblReportTcps.hbm.xml </value> <value> com/yiwei/hibernate/bean/TblReportUdps.hbm.xml </value> <value> com/yiwei/hibernate/bean/TblRuleKeys.hbm.xml </value> <value> com/yiwei/hibernate/bean/TblReportProbes.hbm.xml </value> <value> com/yiwei/hibernate/bean/TblReportVhosts.hbm.xml </value> <value> com/yiwei/hibernate/bean/TblRuleConfs.hbm.xml </value> <value> com/yiwei/hibernate/bean/TblRuleType.hbm.xml </value> </list> </property></bean> <!--isp鏁版嵁搴? --> <bean id="ispJDBC" class="com.atomikos.jdbc.SimpleDataSourceBean"> <property name="uniqueResourceName"><value>isp</value></property> <property name="xaDataSourceClassName"><value>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</value></property> <property name="xaDataSourceProperties"> <value>URL=jdbc:mysql://127.0.0.1:3306/isp?useUnicode=true&amp;characterEncoding=gb2312;user=root;password=admin</value> </property> <property name="exclusiveConnectionMode"><value>true</value></property> <property name="connectionPoolSize"><value>3</value></property> <property name="validatingQuery"><value>SELECT 1</value></property> </bean> <bean id="sessionFactoryIsp" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="ispJDBC"/> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> <prop key="hibernate.show_sql">true</prop> </props> </property> <property name="mappingResources"> <list> <value> com/yiwei/hibernate/bean/Carrier.hbm.xml </value> <value> com/yiwei/hibernate/bean/UbietyDrawer.hbm.xml </value> <value>com/yiwei/hibernate/bean/UbietyRoom.hbm.xml</value> <value>com/yiwei/hibernate/bean/User.hbm.xml</value> <value>com/yiwei/hibernate/bean/Host.hbm.xml</value> <value>com/yiwei/hibernate/bean/Proxyer.hbm.xml</value> <value>com/yiwei/hibernate/bean/Region.hbm.xml</value> <value>com/yiwei/hibernate/bean/Role.hbm.xml</value> <value> com/yiwei/hibernate/bean/SysPrincipal.hbm.xml </value> <value> com/yiwei/hibernate/bean/SysRolePrincipal.hbm.xml </value> <value> com/yiwei/hibernate/bean/SysUserRole.hbm.xml </value> <value>com/yiwei/hibernate/bean/Log.hbm.xml</value> <value>com/yiwei/hibernate/bean/Vhost.hbm.xml</value> <value>com/yiwei/hibernate/bean/TblProxyerService.hbm.xml</value> </list> </property></bean> <!-- jta事务 --> <bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager" init-method="init" destroy-method="close"> <property name="forceShutdown"><value>true</value></property> </bean> <bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.UserTransactionImp"> <property name="transactionTimeout"><value>300</value></property> </bean> <bean id="hibernateTransactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"> <property name="transactionManager"> <ref local="atomikosTransactionManager"/> </property> <property name="userTransaction"> <ref local="atomikosUserTransaction"/> </property> </bean> <!-- TblRuleUrlsDAO --> <bean id="TblRuleUrlsDAO" class="com.yiwei.hibernate.bean.TblRuleUrlsDAO"> <property name="sessionFactory"> <ref local="sessionFactoryIdc" /> </property> </bean> <bean id="ruleUrlsServiceTarget" class="com.yiwei.business.service.RuleUrlsServiceImp"> <property name="logDAO"> <ref local="LogDAO" /> </property> <property name="ruleConfsDAO"> <ref local="TblRuleConfsDAO" /> </property> <property name="ruleUrlsDAO"> <ref local="TblRuleUrlsDAO" /> </property> </bean> <bean id="ruleUrlsService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"> <ref local="hibernateTransactionManager"/> </property> <property name="target"> <ref local="ruleUrlsServiceTarget"/> </property> <property name="transactionAttributes"> <props> <prop key="get*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="find*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="insert*">PROPAGATION_REQUIRED,-Exception </prop><prop key="save*">PROPAGATION_REQUIRED,,-Exception </prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="update">PROPAGATION_REQUIRED</prop> <prop key="attachDirty">PROPAGATION_REQUIRED</prop> </props> </property> </bean> 相关代码 public class TblRuleUrlsDAO extends HibernateDaoSupport implements IRuleUrlsDAO public void save(TblRuleUrls transientInstance) { log.debug("saving TblRuleUrls instance"); try { getHibernateTemplate().save(transientInstance); log.debug("save successful"); } catch (DataAccessException re) { log.error("save failed", re); throw re; } } class LogDAO extends HibernateDaoSupport implements ILogDAO{ public void save(Log transientInstance) { log.debug("saving Log instance"); try { getHibernateTemplate().save(transientInstance); log.debug("save successful"); } catch (DataAccessException re) { log.error("save failed", re); throw re; } } public class RuleUrlsServiceImp implements IRuleUrlsService { private IRuleUrlsDAO ruleUrlsDAO; private IRuleConfsDAO ruleConfsDAO; private ILogDAO logDAO; public IRuleUrlsDAO getRuleUrlsDAO() { return ruleUrlsDAO; } public void setRuleUrlsDAO(IRuleUrlsDAO ruleUrlsDAO) { this.ruleUrlsDAO = ruleUrlsDAO; } public void delete(TblRuleUrls persistentInstance) { // TODO Auto-generated method stub this.ruleUrlsDAO.delete(persistentInstance); } public TblRuleUrls findById(Integer id) { // TODO Auto-generated method stub return this.ruleUrlsDAO.findById(id); } public void insertUser(TblRuleUrls transientInstance,User u) { // TODO Auto-generated method stub try{ this.ruleUrlsDAO.save(transientInstance); Log log = new Log(); log.setCarrierId(transientInstance.getIspID()); log.setDtime(transientInstance.getDtime()); log.setProxyerId(transientInstance.getProxyId()); String ip = transientInstance.getAssignIp().split(" ")[0]; log.setIp(ip); log.setMessage("用户  部署了url规则 "+transientInstance.getHurl()); log.setUser(u); log.setDtime("zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"); //ILogService logService = (ILogService)AppContext.getInstance().getAppContext().getBean("logService"); logDAO.save(log); } catch(DataAccessException e){ System.err.println("service 抛出异常"); throw e; } } action */ public ActionForward ruleUrlsAdd(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { RuleUrlsForm ruleUrlsForm = (RuleUrlsForm) form;// TODO Auto-generated // method stub try{ User u = (User) request.getSession().getAttribute("u"); TblRuleUrls url = new TblRuleUrls(); PropertyUtils.copyProperties(url, ruleUrlsForm); url.setAction(ruleUrlsForm.getAct()); url.setAssignIp(request.getRemoteAddr() + " " + u.getRealName()); url.setDtime(Conversion.getDate(new Date())); String hurl = ruleUrlsForm.getHurl(); if (ruleUrlsForm.getAct().equals("redi")||ruleUrlsForm.getAct().equals("rredi")) { hurl = hurl + " " + ruleUrlsForm.getThurl(); } url.setHurl(hurl); url.setUserID(u.getId()); url.setIspID(u.getCarrierId()); url.setProxyId(u.getProxyerId()); this.getRuleUrlsService().insertUser(url,u); }catch(DataAccessException e) { System.err.println("action 执行中发生异常"); } 小第 是按照 http://momoko8443.iteye.com/blog/190994 一个可以运行的例子 我的和这个列子差不多 这个可以回滚 但是我的不能 什么原因 已经三天了 我把仅有的分数都散了 再做不出来要下岗了 各位大哥帮帮忙啊 [b]问题补充:[/b] 大家帮帮忙 我 用的是mysql 5.02
spring+hibernate+atomikos 实现JTA分布式事务时自定义事务隔离级别无效
因为需要对两个数据库同时操作并且放在同一个事务中,所以采用了atomikos去实现JTA分布式事务。数据库用的是SQL Server2014 . 现在的问题是,事务提交回滚,一切都正常,但是没有按照设定好的事务隔离级别给数据库表加锁。比如service中的save方法 设定的是SERIALIZABLE隔离级别,测试时查询数据库表隔离级别,并未按照预期加锁。 以下是配置文件,请大神给解惑一下。 ``` <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd"> <!-- 修改 --> <!-- 1.扫描包 --> <!--context:component-scan base-package=""></context:component-scan--> <!--context:component-scan base-package="wms.*"> <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/> </context:component-scan--> <context:component-scan base-package="com.baoJian.wmsBasic.*.dao"> <context:include-filter type="annotation" expression="org.springframework.stereotype.Repository"/> </context:component-scan> <context:component-scan base-package="com.baoJian.wmsBasic.*.service"> <context:include-filter type="annotation" expression="org.springframework.stereotype.Service"/> </context:component-scan> <!-- 2.加载属性文件 --> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="location" value="classpath:jdbc.properties"></property> </bean> <!--develop开发环境配置,测试环境配置 对应web.xml中也有相关设置--> <!--beans profile="develop"> <context:property-placeholder location="classpath:jdbc.properties"/> </beans> <beans profile="product"> <context:property-placeholder location="classpath:jdbc_product.properties"/> </beans--> <beans> <!-- 修改 --> <!-- 3.配置数据库连接池 更改为JTA--> <bean class="com.atomikos.jdbc.AtomikosDataSourceBean" init-method="init" destroy-method="close" id="dataSource"> <!-- Set unique name for this DataSource --> <property name="uniqueResourceName"><value>dataSource_main</value></property> <!-- Set XADatasource class name --> <property name="xaDataSourceClassName" value="com.microsoft.sqlserver.jdbc.SQLServerXADataSource" /> <property name="xaProperties"> <props> <prop key="URL">${jdbcUrl}</prop> </props> </property> <!-- set properties for datasource connection pool --> <property name="poolSize" value="3" /> <!-- timeout after 20000 seconds --> <property name="minPoolSize" value="3" /> <property name="maxPoolSize" value="6" /> <property name="borrowConnectionTimeout" value="60" /> <property name="reapTimeout"><value>300</value></property> <property name="loginTimeout" value="40" /> <property name="testQuery"> <value>select 1</value> </property> </bean> <bean class="com.atomikos.jdbc.AtomikosDataSourceBean" init-method="init" destroy-method="close" id="dataSource_erp"> <!-- Set unique name for this DataSource --> <property name="uniqueResourceName"><value>dataSource_erp</value></property> <!-- Set XADatasource class name --> <property name="xaDataSourceClassName" value="oracle.jdbc.xa.client.OracleXADataSource" /> <property name="xaProperties"> <props> <!--prop key="URL">jdbc:oracle:thin:@erptest.baojian.com:1541:DEV2</prop--> <prop key="URL">${oraJdbcUrl}</prop> <prop key="user">${oraUser}</prop> <prop key="password">${oraPassword}</prop> </props> </property> <!-- set properties for datasource connection pool --> <property name="poolSize" value="3" /> <!-- timeout after 20000 seconds --> <property name="reapTimeout"><value>300</value></property> </bean> <!-- 修改 --> <!-- 4.Hibernate的相关信息 --> <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource"></property> <property name="configLocation" value="classpath:hibernate.cfg.xml"/> </bean> <bean id="sessionFactory_erp" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource_erp"></property> <property name="configLocation" value="classpath:hibernate_erp.cfg.xml"/> </bean> <!-- 分布式事务 --> <bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager" init-method="init" destroy-method="close"> <property name="forceShutdown" value="true"/> </bean> <bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.UserTransactionImp"> <property name="transactionTimeout" value="50000"/> </bean> <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"> <property name="transactionManager" ref="atomikosTransactionManager"/> <property name="userTransaction" ref="atomikosUserTransaction"/> <property name="allowCustomIsolationLevels" value="true"/> </bean> <!--<bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory"/> </bean> --> <!-- 6.开启事务注解 --> <!--tx:annotation-driven transaction-manager="transactionManager"/--> <tx:advice id="txAdvice" transaction-manager="transactionManager" > <tx:attributes> <!--init初始化操作 calculate计算类操作 save保存操作 remove删除操作 update更新操作--> <tx:method name="init*" propagation="REQUIRED" rollback-for="Exception"></tx:method> <tx:method name="calculate*" propagation="REQUIRED" rollback-for="Exception"></tx:method> <tx:method name="save*" propagation="REQUIRED" isolation="SERIALIZABLE" rollback-for="Exception"></tx:method> <tx:method name="*" read-only="true"></tx:method> </tx:attributes> </tx:advice> <!--定义哪些类的哪些方法参与事务 --> <aop:config> <!-- <aop:pointcut id="allManagerMethod" expression="execution(* com.baojian.demo.service.*.*(..))"/> --> <aop:pointcut id="allServiceMethod" expression="execution(* *..service.*.*(..))"/> <aop:advisor pointcut-ref="allServiceMethod" advice-ref="txAdvice"/> </aop:config> </beans> ``` 测试例子 server中的一个方法 ``` public void saveTestHeader() throws InventoryServiceException, ReceiptServiceException { System.out.println("------------------TransactionSynchronizationManager"+TransactionSynchronizationManager.getCurrentTransactionIsolationLevel()); //查询并锁定 TestHeader testHeader = this.testDao.findOneByHQL("from TestHeader where id=160"); Thread.sleep(30000); } ```
SSH 中 用了atomikos集成JTA 事务后,hibernate执行任何操作失败后都不抛异常
在项目中, 用了atomikos集成JTA 事务后,hibernate执行任何操作失败后都不抛异常 比如,我用getHibernateTemplate().load方法加载一个不存在的数据都不抛出异常,或者我删除一个不存在的记录也不抛异常,谁知道这是什么原因啊??????????
多数据源配置与JTA事务问题
项目中使用两个dataSourc,两个sessionFactory.由于业务变化,需要在项目中切换数据源,单独配置多数据源以及单独配置JTA都能成功,将多数据与JTA整合之后,项目启动总是抛出异常。 异常如下: ``` org.springframework.transaction.IllegalTransactionStateException: Pre-bound JDBC Connection found! HibernateTransactionManager does not support running within DataSourceTransactionManager if told to manage the DataSource itself. It is recommended to use a single HibernateTransactionManager for all transactions on a single DataSource, no matter whether Hibernate or JDBC access. ``` 网上说是jdbc的事务与hibernate的事务起冲突了,但没有找到解决办法,求大神指点。 ``` 1 <!-- atomikos事务管理器 --> 2 <bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager" 3 init-method="init" destroy-method="close"> 4 <description>UserTransactionManager</description> 5 <property name="forceShutdown"><value>true</value></property> 6 </bean> 7 8 <bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.UserTransactionImp"> 9 <property name="transactionTimeout" value="300" /> 10 </bean> 11 12 <!-- spring 事务管理器 --> 13 <bean id="springTransactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"> 14 <property name="transactionManager" ref="atomikosTransactionManager"/> 15 <property name="userTransaction" ref="atomikosUserTransaction"/> 16 </bean> ``` AOP配置: ``` 1 <aop:aspectj-autoproxy /> 2 <aop:config proxy-target-class="true"> 3 <aop:advisor pointcut="execution(* com.animoor.m2.application..*.*(..))" advice-ref="txAdvice" /> 4 </aop:config> 5 6 <tx:advice id="txAdvice" transaction-manager="springTransactionManager"> 7 <tx:attributes> 8 <tx:method name="get*" read-only="true" /> 9 <tx:method name="find*" read-only="true" /> 10 <tx:method name="insert*" propagation="REQUIRED"/> 11 <tx:method name="update*" propagation="REQUIRED" /> 12 <tx:method name="add*" propagation="REQUIRED" /> 13 <tx:method name="delete*" propagation="REQUIRED" /> 14 <tx:method name="update*" propagation="REQUIRED" /> 15 16 <tx:method name="save*" propagation="REQUIRED" /> 17 <tx:method name="do*" propagation="REQUIRED" /> 18 .... 19 </tx:attributes> 20 </tx:advice> ``` 加入多数据源配置: ``` 1 <bean id="multipleDataSource" class="com.animoor.m2.sys.MultipleDataSource"> 2 <property name="defaultTargetDataSource" ref="dataSourceMes129"/> 3 <property name="targetDataSources"> 4 <map key-type="java.lang.String"> 5 <!--注意这里的value是和上面的DataSource的id对应,key要和下面的CustomerContextHolder中的常量对应 --> 6 <entry key="dataSourceMes129" value-ref="dataSourceMes129" /> 7 <entry key="dataSourceFgms129" value-ref="dataSourceFgms129"/> 8 <entry key="dataSourceMes168" value-ref="dataSourceMes168" /> 9 <entry key="dataSourceFgms168" value-ref="dataSourceFgms168"/> 10 </map> 11 </property> 12 </bean> ``` 项目加载时调用的方法含get*,find*,将这些get去掉则不会抛出异常,但是去掉之后事务应该没有作用了吧。 请各位大神指点 谢谢 小弟没有金币悬赏,谢谢各位了。
为什么在JMS中使用JTA事务控制全局事务失效
package cn.producer; import java.util.Properties; import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.Destination; import javax.jms.ExceptionListener; import javax.jms.JMSException; import javax.jms.MessageProducer; import javax.jms.Session; import javax.jms.TextMessage; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.transaction.HeuristicMixedException; import javax.transaction.HeuristicRollbackException; import javax.transaction.NotSupportedException; import javax.transaction.RollbackException; import javax.transaction.SystemException; import javax.transaction.UserTransaction; public class ExceptionMessageSender { /** * 本地获取Context * 需要添加wlclient.jar , webservices.jar , wljmsclient.jar * @return */ private Context getInitialContext(){ Context context = null; final String INIT_FACTORY = "weblogic.jndi.WLInitialContextFactory"; final String SERVER_URL = "t3://localhost:7001"; Properties props = new Properties(); props.put(Context.INITIAL_CONTEXT_FACTORY, INIT_FACTORY); props.put(Context.PROVIDER_URL, SERVER_URL); try { context = new InitialContext(props); } catch (NamingException e) { e.printStackTrace(); } return context; } public void sendMessage() throws NamingException, JMSException, NotSupportedException, SystemException, SecurityException, IllegalStateException, RollbackException, HeuristicMixedException, HeuristicRollbackException{ //定义默认的weblogic的JNDI final String CONNECTION_FACTORY_JNDI = "weblogic.jms.ConnectionFactory"; //获取Context Context context = getInitialContext(); //获取连接工厂 ConnectionFactory cf = (ConnectionFactory) context.lookup(CONNECTION_FACTORY_JNDI); //获取连接 Connection conn = cf.createConnection(); //监听JMS服务器异常情况(只有当JMS服务器运行时发生的异常才会触发异常监听器) conn.setExceptionListener(new ExceptionListener(){ @Override public void onException(JMSException e) { System.out.println("JMS服务器发生异常,异常信息如下:"); e.printStackTrace(); } }); //获取JTA事务 UserTransaction tx = (UserTransaction) context.lookup("javax.transaction.UserTransaction"); tx.begin(); //获取会话,如果设置为事务性会话,那么JTA不起作用 Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); //获取消息目的 Destination dest = (Destination) context.lookup("MessageQueue"); //通过会话获取消息生产者 MessageProducer sender = session.createProducer(dest); //通过会话创建一个空格JMS消息 TextMessage msg = session.createTextMessage(); msg.setText("你好,我是路人甲!"); //通过消息生产者发送消息 sender.send(msg); try{ int num = 4/0;//-----------这里会抛出异常,引发JTA全局事务回滚 msg.setText(num+":number"); sender.send(msg); tx.commit(); }catch(Exception e){ tx.rollback(); }finally{ //关闭资源 session.close(); conn.close(); } } } package cn.consumer; import java.util.Properties; import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.Destination; import javax.jms.ExceptionListener; import javax.jms.JMSException; import javax.jms.MessageConsumer; import javax.jms.Session; import javax.jms.TextMessage; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.transaction.HeuristicMixedException; import javax.transaction.HeuristicRollbackException; import javax.transaction.NotSupportedException; import javax.transaction.RollbackException; import javax.transaction.SystemException; import javax.transaction.UserTransaction; public class ExceptionConsumer { /** * 本地获取Context * 需要添加wlclient.jar , webservices.jar , wljmsclient.jar * @return */ private Context getInitialContext(){ Context context = null; final String INIT_FACTORY = "weblogic.jndi.WLInitialContextFactory"; final String SERVER_URL = "t3://localhost:7001"; Properties props = new Properties(); props.put(Context.INITIAL_CONTEXT_FACTORY, INIT_FACTORY); props.put(Context.PROVIDER_URL, SERVER_URL); try { context = new InitialContext(props); } catch (NamingException e) { e.printStackTrace(); } return context; } public void receiveMessage() throws NamingException, JMSException, NotSupportedException, SystemException, SecurityException, IllegalStateException, RollbackException, HeuristicMixedException, HeuristicRollbackException{ //定义默认的weblogic连接工程的JNDI final String CONNECTION_FACTORY_JNDI = "weblogic.jms.ConnectionFactory"; //获取Context Context context = getInitialContext(); //通过JNDI获取连接工厂 ConnectionFactory cf = (ConnectionFactory) context.lookup(CONNECTION_FACTORY_JNDI); //通过连接工厂获取连接 Connection conn = cf.createConnection(); //开始JMS传输 conn.start(); //设置异常监听器,监听JMS服务器上的异常 conn.setExceptionListener(new ExceptionListener(){ public void onException(JMSException e){ System.out.println("JMS服务器发生异常,异常信息如下:"); e.printStackTrace(); } }); //打开全局事务 UserTransaction tx = (UserTransaction) context.lookup("javax.transaction.UserTransaction"); tx.begin(); //通过连接获取会话,使用全局事务了,就不应该设置为事务性会话,否则全局事务会失效,使用的事务还是事务性会话的事务 Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); //获取消息目的(消息队列) Destination dest = (Destination) context.lookup("MessageQueue"); //创建消息消费者 MessageConsumer receiver = session.createConsumer(dest); //消息消费者同步接收消息 TextMessage msg = (TextMessage) receiver.receiveNoWait(); System.out.println(msg); if(msg != null){ System.out.println("同步接收到信息:"+msg.getText()); } //确认事务 tx.commit(); //关闭资源 session.close(); conn.close(); } } package cn.test; import javax.jms.JMSException; import javax.naming.NamingException; import javax.transaction.HeuristicMixedException; import javax.transaction.HeuristicRollbackException; import javax.transaction.NotSupportedException; import javax.transaction.RollbackException; import javax.transaction.SystemException; import cn.producer.ExceptionMessageSender; public class TestExceptionProducer { public static void main(String[] args) { ExceptionMessageSender ems = new ExceptionMessageSender(); try { ems.sendMessage(); } catch (SecurityException e) { e.printStackTrace(); } catch (IllegalStateException e) { e.printStackTrace(); } catch (NamingException e) { e.printStackTrace(); } catch (JMSException e) { e.printStackTrace(); } catch (NotSupportedException e) { e.printStackTrace(); } catch (SystemException e) { e.printStackTrace(); } catch (RollbackException e) { e.printStackTrace(); } catch (HeuristicMixedException e) { e.printStackTrace(); } catch (HeuristicRollbackException e) { e.printStackTrace(); } } } ``` ``` 代码贴在上面,我的意思就是不用JMS自带的事务,而用JTA来控制全局事务。但是没找到失效的原因。
mybatis+spring的事务@Transactional的NOT_SUPPORTED无效
method1方法有事务,method2不需要事务(设置为NOT_SUPPORTED),但是在执行的时候method2还是用到了事务。 求大神指导,, ``` @Transactional public void method1(HtYbnsrDab htYbnsrDab) { // .....业务逻辑 method2(); } @Transactional(propagation = Propagation.NOT_SUPPORTED) public void method2(HtYbnsrDab htYbnsrDab) { // .....业务逻辑 } ``` 使用的是jta事务,web容器是weblogic,spring配置如下: ``` <jee:jndi-lookup id="htssDS" jndi-name="htssDS"/> <tx:jta-transaction-manager/> <tx:annotation-driven proxy-target-class="true"/> ```
atomikos jta事务异常
最近使用atomikos进行分布式事务开发,遇到以下问题:com.atomikos.datasource.ResourceException: XA resource 'ds': resume for XID '31302E3131362E3134302E3231352E746D313439373430373435373030313134323636:31302E3131362E3134302E3231352E746D353639303533' raised -9: the XA resource is currently involved in a local (non-XA) transaction。 这个异常是从一个hibernate查询中报出来的,不是每次查询都会报异常,偶尔会报,事务管理器使用的是JtaTransactionManager,基本代码如下: ``` @Service("groundQuartzMonitorBiz") @Transactional public class QuartzMonitorBiz extends BaseBiz implements IQuartzMonitorBiz { private @Autowired IQuartzMonitorDao quartzMonitorDao; @Override @Transactional(readOnly = true) public Map<?,?> loadQuartzMonitor(String jobCode) { if (jobCode == null || "".equals(jobCode.trim())) { return null; } List<Map<?,?>> rets = quartzMonitorDao.loadQuartzMonitor(jobCode); if (null == rets || rets.isEmpty()) { return null; } return rets.iterator().next(); } } ``` ``` @Repository("groundQuartzMonitorDao") public class QuartzMonitorDao extends CommonDao implements IQuartzMonitorDao { @Override @SuppressWarnings("unchecked") public List<Map<?, ?>> loadQuartzMonitor(String jobCode) { Query query = this.getCurrentSession().createSQLQuery( select id,job_code,startup_flg,cron_expression_flg,cron_expression,comments from ts_quartz_monitor t where t.job_code=:jobcode); query.setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP); query.setString("jobcode", jobCode); return query.list(); } } ``` 哪位大神遇到过这种情况的请分享一下,不胜感激。
全局事务(JTA事务)的原子性
现有两个事务资源datasource1,datasource2假如我不采用XA规范而是简单的[code="java"] try{ do transaction 1; do transaction 2; commit transaction 1;//① commit transaction 2;//② }catch(exception){ rollback transaction 1; rollback transaction 2; } [/code] 这样做是管理两个事务 和通过X/OPEN XA(JTA)的两阶段提交有何区别。 是不是JTA可以在①②处保证原子性,而管理两个事务则不能?
JTA使用Propagation.NESTED事务传播方式报错
# JTA使用Propagation.NESTED事务传播方式报错 spring boot配置JTA后,使用Propagation.NESTED事务传播方式,出现异常,切换其他传播方式代码正常。 <br/> 事务配置: A service: @Transactional @Override public void saveOrUpdate(Msg msg) { msgJDBCDAO.save(msg); MsgReceiver msgReceiver = new MsgReceiver(); msgReceiver.setId(msg.getMsgId()); msgReceiver.setMsgId(msg.getMsgId()); msgReceiver.setUserId(1000L); msgReceiver.setReadFlag(0); msgReceiver.setDeleteFlag(0); msgReceiverJDBCService.save(msgReceiver); } B service: @Transactional(propagation = Propagation.NESTED) @Override public void save(MsgReceiver msgReceiver) { msgReceiverJDBCDAO.save(msgReceiver); } <br/> <br/><br/><br/> ## 报错信息如下: org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [insert into t_msg_receiver values (?, ?, ?, ?, ?)]; SQL state [null]; error code [0]; Failed to suspend branch: XAResourceTransaction: 3139322E3136382E3232372E322E746D313537343036303233343835373030303031:3139322E3136382E3232372E322E746D31; nested exception is com.atomikos.jdbc.AtomikosSQLException: Failed to suspend branch: XAResourceTransaction: 3139322E3136382E3232372E322E746D313537343036303233343835373030303031:3139322E3136382E3232372E322E746D31 at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:89) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81) at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1442) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:632) at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:861) at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:916) at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:926) at com.spring.boot.example.dao.jdbc.MsgReceiverJDBCDAO.save(MsgReceiverJDBCDAO.java:16) at com.spring.boot.example.dao.jdbc.MsgReceiverJDBCDAO$$FastClassBySpringCGLIB$$bdb85c72.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688) at com.spring.boot.example.dao.jdbc.MsgReceiverJDBCDAO$$EnhancerBySpringCGLIB$$6e56ffb6.save(<generated>) at com.spring.boot.example.service.jdbc.impl.MsgReceiverJDBCServiceImpl.save(MsgReceiverJDBCServiceImpl.java:21) at com.spring.boot.example.service.jdbc.impl.MsgReceiverJDBCServiceImpl$$FastClassBySpringCGLIB$$a40f40ea.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:295) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688) at com.spring.boot.example.service.jdbc.impl.MsgReceiverJDBCServiceImpl$$EnhancerBySpringCGLIB$$65349f92.save(<generated>) at com.spring.boot.example.service.jdbc.impl.MsgJDBCServiceImpl.saveOrUpdate(MsgJDBCServiceImpl.java:46) at com.spring.boot.example.service.jdbc.impl.MsgJDBCServiceImpl$$FastClassBySpringCGLIB$$a07b1dd9.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:295) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688) at com.spring.boot.example.service.jdbc.impl.MsgJDBCServiceImpl$$EnhancerBySpringCGLIB$$ecf643bf.saveOrUpdate(<generated>) at com.spring.boot.example.service.MsgJDBCServiceTest.test(MsgJDBCServiceTest.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74) at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70) Caused by: com.atomikos.jdbc.AtomikosSQLException: Failed to suspend branch: XAResourceTransaction: 3139322E3136382E3232372E322E746D313537343036303233343835373030303031:3139322E3136382E3232372E322E746D31 at com.atomikos.jdbc.AtomikosSQLException.throwAtomikosSQLException(AtomikosSQLException.java:29) at com.atomikos.jdbc.AtomikosConnectionProxy.enlist(AtomikosConnectionProxy.java:217) at com.atomikos.jdbc.AtomikosConnectionProxy.invoke(AtomikosConnectionProxy.java:122) at com.sun.proxy.$Proxy98.prepareStatement(Unknown Source) at org.springframework.jdbc.core.JdbcTemplate$SimplePreparedStatementCreator.createPreparedStatement(JdbcTemplate.java:1555) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:614) ... 63 more Caused by: com.atomikos.datasource.xa.session.InvalidSessionHandleStateException: Failed to suspend branch: XAResourceTransaction: 3139322E3136382E3232372E322E746D313537343036303233343835373030303031:3139322E3136382E3232372E322E746D31 at com.atomikos.datasource.xa.session.BranchEnlistedStateHandler.transactionSuspended(BranchEnlistedStateHandler.java:98) at com.atomikos.datasource.xa.session.TransactionContext.transactionSuspended(TransactionContext.java:94) at com.atomikos.datasource.xa.session.SessionHandleState.notifyBeforeUse(SessionHandleState.java:165) at com.atomikos.jdbc.AtomikosConnectionProxy.enlist(AtomikosConnectionProxy.java:207) ... 67 more Caused by: com.mysql.cj.jdbc.MysqlXAException: XAER_INVAL: Invalid arguments (or unsupported command) at com.mysql.cj.jdbc.MysqlXAConnection.mapXAExceptionFromSQLException(MysqlXAConnection.java:344) at com.mysql.cj.jdbc.MysqlXAConnection.dispatchCommand(MysqlXAConnection.java:329) at com.mysql.cj.jdbc.MysqlXAConnection.end(MysqlXAConnection.java:267) at com.atomikos.datasource.xa.XAResourceTransaction.xaSuspend(XAResourceTransaction.java:700) at com.atomikos.datasource.xa.session.BranchEnlistedStateHandler.transactionSuspended(BranchEnlistedStateHandler.java:94) ... 70 more Caused by: java.sql.SQLException: XAER_INVAL: Invalid arguments (or unsupported command) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) at com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:764) at com.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:648) at
Spring hibernate 整合问题
2009-3-17 14:24:38 org.apache.catalina.core.AprLifecycleListener init 信息: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\Program Files\Java\jre1.6.0_04\bin;D:\Program Files\MyEclipse 6.0\eclipse\plugins\com.genuitec.eclipse.easie.tomcat.myeclipse_6.0.1.zmyeclipse601200710\tomcat\bin 2009-3-17 14:24:38 org.apache.coyote.http11.Http11Protocol init 信息: Initializing Coyote HTTP/1.1 on http-8080 2009-3-17 14:24:38 org.apache.catalina.startup.Catalina load 信息: Initialization processed in 994 ms 2009-3-17 14:24:38 org.apache.catalina.core.StandardService start 信息: Starting service Catalina 2009-3-17 14:24:38 org.apache.catalina.core.StandardEngine start 信息: Starting Servlet Engine: Apache Tomcat/6.0.13 log4j:WARN No such property [conversionPattern] in org.apache.log4j.TTCCLayout. 2009-3-17 14:24:40 org.apache.catalina.core.ApplicationContext log 信息: Initializing Spring root WebApplicationContext 2009-03-17 14:24:40 [org.springframework.web.context.ContextLoader]-[INFO] Root WebApplicationContext: initialization started 2009-03-17 14:24:41 [org.springframework.web.context.support.XmlWebApplicationContext]-[INFO] Refreshing org.springframework.web.context.support.XmlWebApplicationContext@1d0e2c9: display name [Root WebApplicationContext]; startup date [Tue Mar 17 14:24:41 CST 2009]; root of context hierarchy 2009-03-17 14:24:41 [org.springframework.beans.factory.xml.XmlBeanDefinitionReader]-[INFO] Loading XML bean definitions from URL [file:/E:/Test/workspace/.metadata/.plugins/com.genuitec.eclipse.easie.tomcat.myeclipse/tomcat/webapps/supermarket/WEB-INF/classes/config/spring/applicationContext.xml] 2009-03-17 14:24:42 [org.springframework.web.context.support.XmlWebApplicationContext]-[INFO] Bean factory for application context [org.springframework.web.context.support.XmlWebApplicationContext@1d0e2c9]: org.springframework.beans.factory.support.DefaultListableBeanFactory@5e7663 2009-03-17 14:24:42 [org.springframework.beans.factory.support.DefaultListableBeanFactory]-[INFO] Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@5e7663: defining beans [sessionFactorys,registerOperatorDAO,registerOperatorService,registerOperatorAction]; root of factory hierarchy 2009-03-17 14:24:42 [org.springframework.beans.factory.support.DefaultListableBeanFactory]-[INFO] Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@5e7663: defining beans [sessionFactorys,registerOperatorDAO,registerOperatorService,registerOperatorAction]; root of factory hierarchy 2009-03-17 14:24:42 [org.springframework.web.context.ContextLoader]-[ERROR] Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactorys' defined in URL [file:/E:/Test/workspace/.metadata/.plugins/com.genuitec.eclipse.easie.tomcat.myeclipse/tomcat/webapps/supermarket/WEB-INF/classes/config/spring/applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/dom4j/DocumentException at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:883) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:839) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4334) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:566) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/dom4j/DocumentException at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:115) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:61) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:877) ... 40 more Caused by: java.lang.NoClassDefFoundError: org/dom4j/DocumentException at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.class$(LocalSessionFactoryBean.java:174) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.<init>(LocalSessionFactoryBean.java:174) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:100) ... 42 more Caused by: java.lang.ClassNotFoundException: org.dom4j.DocumentException at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204) at java.lang.ClassLoader.loadClassInternal(Unknown Source) ... 51 more 2009-3-17 14:24:42 org.apache.catalina.core.StandardContext listenerStart 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactorys' defined in URL [file:/E:/Test/workspace/.metadata/.plugins/com.genuitec.eclipse.easie.tomcat.myeclipse/tomcat/webapps/supermarket/WEB-INF/classes/config/spring/applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/dom4j/DocumentException at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:883) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:839) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4334) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:566) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/dom4j/DocumentException at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:115) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:61) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:877) ... 40 more Caused by: java.lang.NoClassDefFoundError: org/dom4j/DocumentException at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.class$(LocalSessionFactoryBean.java:174) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.<init>(LocalSessionFactoryBean.java:174) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:100) ... 42 more Caused by: java.lang.ClassNotFoundException: org.dom4j.DocumentException at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204) at java.lang.ClassLoader.loadClassInternal(Unknown Source) ... 51 more 2009-3-17 14:24:42 org.apache.catalina.core.StandardContext start 严重: Error listenerStart 2009-3-17 14:24:42 org.apache.catalina.core.StandardContext start 严重: Context [/supermarket] startup failed due to previous errors 2009-3-17 14:24:42 org.apache.catalina.core.ApplicationContext log 信息: Closing Spring root WebApplicationContext 2009-3-17 14:24:43 org.apache.coyote.http11.Http11Protocol start 信息: Starting Coyote HTTP/1.1 on http-8080 2009-3-17 14:24:43 org.apache.jk.common.ChannelSocket init 信息: JK: ajp13 listening on /0.0.0.0:8009 2009-3-17 14:24:43 org.apache.jk.server.JkMain start 信息: Jk running ID=0 time=0/47 config=null 2009-3-17 14:24:43 org.apache.catalina.startup.Catalina start 信息: Server startup in 4940 ms 配置文件如下 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd" default-autowire="byName"> <bean name="sessionFactorys" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="configLocation" value="classpath:hibernate.cfg.xml"> </property> </bean> <bean name="registerOperatorDAO" class="org.xsd.supermarket.system.operator.operator.impl.OperatorDAOImpl"> <property name="sessionFactorys" ref="sessionFactorys"></property> </bean> <bean name="registerOperatorService" class="org.xsd.supermarket.system.operator.operator.impl.OperatorServicesImpl"> <property name="registerOperatorDAO" ref="registerOperatorDAO"></property> </bean> <bean name="registerOperatorAction" class="org.xsd.supermarket.system.operator.operator.OperatorAction"> <property name="registerOperatorService" ref="registerOperatorService"></property> </bean> </beans> 用到的JAR包如下: <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/hibernate/hibernate3.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring/spring.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/struts/commons-logging-1.0.4.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/struts/freemarker-2.3.13.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/struts/ognl-2.6.11.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/struts/struts2-core-2.1.6.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/struts/struts2-spring-plugin-2.1.6.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/struts/xwork-2.1.2.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/tools/log4j-1.2.14.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/tools/mysql-connector-java-5.0.5-bin.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/tools/commons-beanutils.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/tools/dom4j-1.6.1.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/tools/jaxen-1.1-beta-7.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/tools/cglib-nodep-2.1_3.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/tools/asm-2.2.3.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/tools/asm-commons-2.2.3.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/tools/asm-util-2.2.3.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/tools/jta.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/tools/aspectjweaver.jar"/>
SSH 中 atomikos集成JTA 事务无法回滚
applicationContext.xml配置文件如下 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd"> <bean id="dataSource" class="com.atomikos.jdbc.AtomikosDataSourceBean" init-method="init" destroy-method="close"> <description>oracle xa datasource</description> <property name="uniqueResourceName"> <value>oracle1</value> </property> <property name="xaDataSourceClassName"> <value>oracle.jdbc.xa.client.OracleXADataSource</value> </property> <property name="xaProperties"> <props> <prop key="user">test</prop> <prop key="password">test</prop> <prop key="URL">jdbc:oracle:thin:@192.168.0.28:1521:test</prop> </props> </property> </bean> <bean id="dataSourceOracle" class="com.atomikos.jdbc.AtomikosDataSourceBean" init-method="init" destroy-method="close"> <property name="uniqueResourceName"> <value>oracle2</value> </property> <property name="xaDataSourceClassName"> <value>oracle.jdbc.xa.client.OracleXADataSource</value> </property> <property name="xaProperties"> <props> <prop key="user">test1</prop> <prop key="password">test1</prop> <prop key="URL">jdbc:oracle:thin:@192.168.0.28:1521:test</prop> </props> </property> </bean> <bean id="sessionFactory1" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="dataSource" /> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect"> org.hibernate.dialect.Oracle9Dialect </prop> <prop key="hibernate .show_sql">true</prop> <prop key="hibernate.max_fetch_depth">1</prop> <prop key="hibernate.jdbc.fetch_size">20</prop> <prop key="hibernate.query.factory_class"> org.hibernate.hql.ast.ASTQueryTranslatorFactory </prop> </props> </property> <property name="jtaTransactionManager" ref="atomikosTransactionManager" /> <property name="mappingDirectoryLocations"> <list> <value> classpath*:com/yappam/model/ </value> </list> </property> </bean> <bean id="sessionFactory2" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="dataSourceOracle" /> </property> <property name="hibernateProperties"> <props>[b][/b] <prop key="hibernate.dialect"> org.hibernate.dialect.Oracle9Dialect </prop> <prop key="hibernate .show_sql">true</prop> <prop key="hibernate.max_fetch_depth">1</prop> <prop key="hibernate.jdbc.fetch_size">20</prop> <prop key="hibernate.query.factory_class"> org.hibernate.hql.ast.ASTQueryTranslatorFactory </prop> </props> </property> <property name="jtaTransactionManager" ref="atomikosTransactionManager" /> <property name="mappingLocations"> <list> <value> classpath*:com/yappam/model/oracle/*.hbm.xml </value> </list> </property> </bean> <bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager" init-method="init" destroy-method="close"> <property name="forceShutdown"> <value>true</value> </property> </bean> <bean id="txManager" class="org.springframework.transaction.jta.JtaTransactionManager"> <property name="userTransaction" ref="atomikosUserTransaction" /> <property name="transactionManager" ref="atomikosTransactionManager"> </property> </bean> <bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.UserTransactionImp"> <property name="transactionTimeout"> <value>240</value> </property> </bean> <tx:advice id="txAdvice" transaction-manager="txManager"> <tx:attributes> <tx:method name="save*" propagation="REQUIRED" rollback-for="Exception" /> <tx:method name="delete*" propagation="REQUIRED" rollback-for="Exception" /> <tx:method name="update*" propagation="REQUIRED" rollback-for="Exception" /> <tx:method name="*" propagation="REQUIRED" /> </tx:attributes> </tx:advice> <aop:config proxy-target-class="true"> <aop:pointcut id="iPointCuts" expression="execution(* com.yappam.service.impl..*(..))" /> <aop:advisor advice-ref="txAdvice" pointcut-ref="iPointCuts" /> </aop:config> </beans> 如果将事务的隔离界别设置成 read-only="true",则两个数据库都才、不能插入数据, 但是我现在 User user=new User(); user.setId("0000000000128359568004600001372");//不存在数据 userDao.delete(user); Test t=new Test(); t.setId(IDGenerator.getId()); t.setUsername("222"); testDao.save(t); 我先删除一条不存在信息抛出异常,但是事务却不回滚,任然可以有一个数据库插入成功? 请大家帮忙解决下!谢谢
spring+hibernate游标不释放问题
系统使用spring+hibernate连接池与spring事务设置如下: [code="java"] <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass"> <value>oracle.jdbc.driver.OracleDriver</value> </property> <property name="jdbcUrl"> <value>jdbc:oracle:thin:@192.168.1.106:1521:orcl</value> </property> <property name="user"> <value>wjcx</value> </property> <property name="password"> <value>wjcx</value> </property> <!--连接池中保留的最小连接数。--> <property name="minPoolSize"> <value>5</value> </property> <!--连接池中保留的最大连接数。Default: 15 --> <property name="maxPoolSize"> <value>30</value> </property> <!--初始化时获取的连接数,取值应在minPoolSize与maxPoolSize之间。Default: 3 --> <property name="initialPoolSize"> <value>10</value> </property> <!--最大空闲时间,60秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 --> <property name="maxIdleTime"> <value>60</value> </property> <!--当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 3 --> <property name="acquireIncrement"> <value>5</value> </property> <!--JDBC的标准参数,用以控制数据源内加载的PreparedStatements数量。但由于预缓存的statements 属于单个connection而不是整个连接池。所以设置这个参数需要考虑到多方面的因素。 如果maxStatements与maxStatementsPerConnection均为0,则缓存被关闭。Default: 0--> <property name="maxStatements"> <value>0</value> </property> <!--每60秒检查所有连接池中的空闲连接。Default: 0 --> <property name="idleConnectionTestPeriod"> <value>60</value> </property> <!--定义在从数据库获取新连接失败后重复尝试的次数。Default: 30 --> <property name="acquireRetryAttempts"> <value>30</value> </property> <!--获取连接失败将会引起所有等待连接池来获取连接的线程抛出异常。但是数据源仍有效 保留,并在下次调用getConnection()的时候继续尝试获取连接。如果设为true,那么在尝试 获取连接失败后该数据源将申明已断开并永久关闭。Default: false--> <property name="breakAfterAcquireFailure"> <value>true</value> </property> <!--因性能消耗大请只在需要的时候使用它。如果设为true那么在每个connection提交的 时候都将校验其有效性。建议使用idleConnectionTestPeriod或automaticTestTable 等方法来提升连接测试的性能。Default: false --> <property name="testConnectionOnCheckout"> <value>false</value> </property> </bean> <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"> <property name="dataSource"> <ref bean="dataSource" /> </property> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="configLocation"> <value>classpath:hibernate.cfg.xml</value> </property> <property name="dataSource"> <ref bean="dataSource" /> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.cache.provider_class">com.jweb.common.cache.OSCacheProvider</prop> <prop key="hibernate.cache.use_query_cache">false</prop> </props> </property> </bean> <!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) --> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory"> <ref bean="sessionFactory" /> </property> </bean> <bean id="baseTxProxy" abstract="true" lazy-init="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"> <ref bean="transactionManager" /> </property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="list*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="add*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="edit*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="save*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="insert*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="create*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="update*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="remove*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="find*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="load*">PROPAGATION_REQUIRED,readOnly</prop> </props> </property> </bean> [/code] dao中的代码如下 [code="java"] public List getListByArticle(ArticleModel article, String orderby, int firstResult, int maxResults,String tid) { String hql = "from UserModel"; Session session = this.getSession(); Query query = session.createQuery(hql); query.setFirstResult(firstResult); query.setMaxResults(maxResults); return query.list(); } [/code] 里面有很多如上面的方法:但系统运行一段时间后总是游标超出最大值!因为用了spring事务,service类中没有关闭连接.但不知道为什么游标老是超出,希望有人解答! [b]问题补充:[/b] 程序有些地方使用了HibernateTemplate这个,但因为存在一些复杂SQL的组装只想知道上面这种写法会不会关掉游标的. [b]问题补充:[/b] 不是使用spring的事务管理就不用关连接吗 [b]问题补充:[/b] 发现添加了session.close();系统后就会报得不到session了!象上面这种写法有什么补求的办法吗?因为代码已经写了很多了!
hibernate4为什么在执行save ()后直接查询直接查询不到数据?
![图片说明](https://img-ask.csdn.net/upload/201511/18/1447830636_399666.png)hibernate4为什么在执行save ()后直接查询直接查询不到数据 同样的配置在hibernate3这样是能查询到数据的,换到hibernate4就是查不到, 就像save()操作没有把对象缓存一样,这样是为什么呀?下面是配置 <property name="dialect"> org.hibernate.dialect.MySQL5InnoDBDialect </property> <property name="current_session_context_class">jta</property> <property name="hibernate.transaction.factory_class"> org.hibernate.transaction.JTATransactionFactory </property> <property name="hibernate.transaction.manager_lookup_class"> com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup </property> <property name="connection.release_mode">auto</property> <property name="hibernate.transaction.flush_before_completion"> true </property> <property name="hibernate.transaction.auto_close_session"> true </property> 事务用的JTA java代码时在同一个事务里添加和查询的: User user = new User() user.setOid("123"); ... Dao.save(user); list lst = Dao.query("User","where oid='123'"); 结果lst为空 理论上save后对象应该缓存在Session里的吧,查询的话也应该查询到缓存里对象吧,可是为什么查询不到呢? 经过验证,对象确实在session里,但是在同一个事务内就是查询不到,为什么呢?
springboot+jpa+jta-atomikos多数据源事务异常
springboot + jpa配置jta事务,出现第一个数据源可以正常使用,但第二个只能查询,不能CRUD操作,求大神指点 第一个数据源如下: @Configuration @EnableTransactionManagement @EnableJpaRepositories(basePackages = "com.saxon.primary.dao", entityManagerFactoryRef = "primaryEntityManagerFactory", transactionManagerRef = "jtaTransactionManager") public class PrimaryDataSourceConfig { @Bean @Primary @ConfigurationProperties("spring.primary.datasource") public DataSourceProperties primaryProperties(){ return new DataSourceProperties(); } @Bean @Primary @ConfigurationProperties("spring.primary.datasource") public DataSource primaryDataSource(){ return primaryProperties().initializeDataSourceBuilder().build(); } @Bean @Primary public LocalContainerEntityManagerFactoryBean primaryEntityManagerFactory(EntityManagerFactoryBuilder builder){ return builder .dataSource(primaryDataSource()) .persistenceUnit("primary") .packages("com.saxon.primary.entity") .build(); } } 第二个数据源: @Configuration @EnableTransactionManagement @EnableJpaRepositories(basePackages = "com.saxon.others.dao", entityManagerFactoryRef = "othersEntityManagerFactory", transactionManagerRef = "jtaTransactionManager") public class OthersDataSourceConfig { @Bean @ConfigurationProperties("spring.others.datasource") public DataSourceProperties othersProperties(){ return new DataSourceProperties(); } @Bean @ConfigurationProperties("spring.others.datasource") public DataSource othersDataSource(){ return othersProperties().initializeDataSourceBuilder().build(); } @Bean public LocalContainerEntityManagerFactoryBean othersEntityManagerFactory(EntityManagerFactoryBuilder builder){ return builder .dataSource(othersDataSource()) .persistenceUnit("others") .packages("com.saxon.others.entity") .build(); } } jta事务配置: @Configuration @EnableTransactionManagement public class TransactionManagerConfig { @Bean(destroyMethod = "close", initMethod = "init") public UserTransactionManager userTransactionManager() { UserTransactionManager userTransactionManager = new UserTransactionManager(); userTransactionManager.setForceShutdown(false); return userTransactionManager; } public @Bean UserTransaction userTransaction() throws Throwable { UserTransactionImp userTransactionImp = new UserTransactionImp(); userTransactionImp.setTransactionTimeout(300); return userTransactionImp; } public @Bean PlatformTransactionManager jtaTransactionManager() throws Throwable { JtaTransactionManager jtaTransactionManager = new JtaTransactionManager(); jtaTransactionManager.setTransactionManager(userTransactionManager()); jtaTransactionManager.setUserTransaction(userTransaction()); return jtaTransactionManager; } } 但执行第二个数据源的crud操作,报如下异常: 2017-07-20 18:00:43.131 ERROR 46084 --- [nio-9008-exec-3] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessApiUsageException: no transaction is in progress; nested exception is javax.persistence.TransactionRequiredException: no transaction is in progress] with root cause javax.persistence.TransactionRequiredException: no transaction is in progress at org.hibernate.jpa.spi.AbstractEntityManagerImpl.checkTransactionNeeded(AbstractEntityManagerImpl.java:1136) ~[hibernate-entitymanager-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.jpa.spi.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:1297) ~[hibernate-entitymanager-5.0.12.Final.jar:5.0.12.Final] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121] at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:347) ~[spring-orm-4.3.9.RELEASE.jar:4.3.9.RELEASE] at com.sun.proxy.$Proxy76.flush(Unknown Source) ~[na:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]
jta事务异常回滚时报错
在进行频繁更新数据库后出现如下错误: ![图片说明](https://img-ask.csdn.net/upload/201612/26/1482732197_497827.png) 事务配置如下: <tx:method name="update*" propagation="REQUIRES_NEW" rollback-for="Exception"/> <tx:method name="sel*" propagation="REQUIRES_NEW" rollback-for="Exception"/> 请问各位大神这是什么原因 紧急
hibernate解压后的geronimo-jta_1.1_spec-1.1.1.jar
我怎么在最新版本的hibernate下找不到这个包了,请问集成到哪个包里了,我的hibernate 的版本是 hibernate-release-5.2.11.Final
spring4.x对JOTM的支持
今天突然兴起,想测试下Spring的JTA,百度查看到spring使用JTOM对分布式事务进行控制, 准备配置beanx.xml文件, bean id="jotm" class="org.springframework.transaction.jta.JotmFactoryBean" spring4.1.7怎么查也查不到这个类,2.5.6中有,这意味着这玩意儿过时了? 可否有大拿提供对应的解决方案?基于4.x
相见恨晚的超实用网站
搞学习 知乎:www.zhihu.com 简答题:http://www.jiandati.com/ 网易公开课:https://open.163.com/ted/ 网易云课堂:https://study.163.com/ 中国大学MOOC:www.icourse163.org 网易云课堂:study.163.com 哔哩哔哩弹幕网:www.bilibili.com 我要自学网:www.51zxw
花了20分钟,给女朋友们写了一个web版群聊程序
参考博客 [1]https://www.byteslounge.com/tutorials/java-ee-html5-websocket-example
爬虫福利二 之 妹子图网MM批量下载
爬虫福利一:27报网MM批量下载    点击 看了本文,相信大家对爬虫一定会产生强烈的兴趣,激励自己去学习爬虫,在这里提前祝:大家学有所成! 目标网站:妹子图网 环境:Python3.x 相关第三方模块:requests、beautifulsoup4 Re:各位在测试时只需要将代码里的变量 path 指定为你当前系统要保存的路径,使用 python xxx.py 或IDE运行即可。
字节跳动视频编解码面经
引言 本文主要是记录一下面试字节跳动的经历。 三四月份投了字节跳动的实习(图形图像岗位),然后hr打电话过来问了一下会不会opengl,c++,shador,当时只会一点c++,其他两个都不会,也就直接被拒了。 七月初内推了字节跳动的提前批,因为内推没有具体的岗位,hr又打电话问要不要考虑一下图形图像岗,我说实习投过这个岗位不合适,不会opengl和shador,然后hr就说秋招更看重基础。我当时
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 顺便拉下票,我在参加csdn博客之星竞选,欢迎投票支持,每个QQ或者微信每天都可以投5票,扫二维码即可,http://m234140.nofollow.ax.
比特币原理详解
一、什么是比特币 比特币是一种电子货币,是一种基于密码学的货币,在2008年11月1日由中本聪发表比特币白皮书,文中提出了一种去中心化的电子记账系统,我们平时的电子现金是银行来记账,因为银行的背后是国家信用。去中心化电子记账系统是参与者共同记账。比特币可以防止主权危机、信用风险。其好处不多做赘述,这一层面介绍的文章很多,本文主要从更深层的技术原理角度进行介绍。 二、问题引入 假设现有4个人...
Python 基础(一):入门必备知识
目录1 标识符2 关键字3 引号4 编码5 输入输出6 缩进7 多行8 注释9 数据类型10 运算符10.1 常用运算符10.2 运算符优先级 1 标识符 标识符是编程时使用的名字,用于给变量、函数、语句块等命名,Python 中标识符由字母、数字、下划线组成,不能以数字开头,区分大小写。 以下划线开头的标识符有特殊含义,单下划线开头的标识符,如:_xxx ,表示不能直接访问的类属性,需通过类提供
这30个CSS选择器,你必须熟记(上)
关注前端达人,与你共同进步CSS的魅力就是让我们前端工程师像设计师一样进行网页的设计,我们能轻而易举的改变颜色、布局、制作出漂亮的影音效果等等,我们只需要改几行代码,不需...
国产开源API网关项目进入Apache孵化器:APISIX
点击蓝色“程序猿DD”关注我回复“资源”获取独家整理的学习资料!近日,又有一个开源项目加入了这个Java开源界大名鼎鼎的Apache基金会,开始进行孵化器。项目名称:AP...
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发
网页实现一个简单的音乐播放器(大佬别看。(⊙﹏⊙))
今天闲着无事,就想写点东西。然后听了下歌,就打算写个播放器。 于是乎用h5 audio的加上js简单的播放器完工了。 欢迎 改进 留言。 演示地点跳到演示地点 html代码如下`&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;music&lt;/title&gt; &lt;meta charset="utf-8"&gt
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。 1. for - else 什么?不是 if 和 else 才
数据库优化 - SQL优化
前面一篇文章从实例的角度进行数据库优化,通过配置一些参数让数据库性能达到最优。但是一些“不好”的SQL也会导致数据库查询变慢,影响业务流程。本文从SQL角度进行数据库优化,提升SQL运行效率。 判断问题SQL 判断SQL是否有问题时可以通过两个表象进行判断: 系统级别表象 CPU消耗严重 IO等待严重 页面响应时间过长
2019年11月中国大陆编程语言排行榜
2019年11月2日,我统计了某招聘网站,获得有效程序员招聘数据9万条。针对招聘信息,提取编程语言关键字,并统计如下: 编程语言比例 rank pl_ percentage 1 java 33.62% 2 c/c++ 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7
通俗易懂地给女朋友讲:线程池的内部原理
餐厅的约会 餐盘在灯光的照耀下格外晶莹洁白,女朋友拿起红酒杯轻轻地抿了一小口,对我说:“经常听你说线程池,到底线程池到底是个什么原理?”我楞了一下,心里想女朋友今天是怎么了,怎么突然问出这么专业的问题,但做为一个专业人士在女朋友面前也不能露怯啊,想了一下便说:“我先给你讲讲我前同事老王的故事吧!” 大龄程序员老王 老王是一个已经北漂十多年的程序员,岁数大了,加班加不动了,升迁也无望,于是拿着手里
经典算法(5)杨辉三角
杨辉三角 是经典算法,这篇博客对它的算法思想进行了讲解,并有完整的代码实现。
编写Spring MVC控制器的14个技巧
本期目录 1.使用@Controller构造型 2.实现控制器接口 3.扩展AbstractController类 4.为处理程序方法指定URL映射 5.为处理程序方法指定HTTP请求方法 6.将请求参数映射到处理程序方法 7.返回模型和视图 8.将对象放入模型 9.处理程序方法中的重定向 10.处理表格提交和表格验证 11.处理文件上传 12.在控制器中自动装配业务类 ...
腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹?
昨天,有网友私信我,说去阿里面试,彻底的被打击到了。问了为什么网上大量使用ThreadLocal的源码都会加上private static?他被难住了,因为他从来都没有考虑过这个问题。无独有偶,今天笔者又发现有网友吐槽了一道腾讯的面试题,我们一起来看看。 腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹? 在互联网职场论坛,一名程序员发帖求助到。二面腾讯,其中一个算法题:64匹
面试官:你连RESTful都不知道我怎么敢要你?
面试官:了解RESTful吗? 我:听说过。 面试官:那什么是RESTful? 我:就是用起来很规范,挺好的 面试官:是RESTful挺好的,还是自我感觉挺好的 我:都挺好的。 面试官:… 把门关上。 我:… 要干嘛?先关上再说。 面试官:我说出去把门关上。 我:what ?,夺门而去 文章目录01 前言02 RESTful的来源03 RESTful6大原则1. C-S架构2. 无状态3.统一的接
求小姐姐抠图竟遭白眼?痛定思痛,我决定用 Python 自力更生!
点击蓝色“Python空间”关注我丫加个“星标”,每天一起快乐的学习大家好,我是 Rocky0429,一个刚恰完午饭,正在用刷网页浪费生命的蒟蒻...一堆堆无聊八卦信息的网页内容慢慢使我的双眼模糊,一个哈欠打出了三斤老泪,就在此时我看到了一张图片:是谁!是谁把我女朋友的照片放出来的!awsl!太好看了叭...等等,那个背景上的一堆鬼画符是什么鬼?!真是看不下去!叔叔婶婶能忍,隔壁老王的三姨妈的四表...
为啥国人偏爱Mybatis,而老外喜欢Hibernate/JPA呢?
关于SQL和ORM的争论,永远都不会终止,我也一直在思考这个问题。昨天又跟群里的小伙伴进行了一番讨论,感触还是有一些,于是就有了今天这篇文。 声明:本文不会下关于Mybatis和JPA两个持久层框架哪个更好这样的结论。只是摆事实,讲道理,所以,请各位看官勿喷。 一、事件起因 关于Mybatis和JPA孰优孰劣的问题,争论已经很多年了。一直也没有结论,毕竟每个人的喜好和习惯是大不相同的。我也看
SQL-小白最佳入门sql查询一
不要偷偷的查询我的个人资料,即使你再喜欢我,也不要这样,真的不好;
项目中的if else太多了,该怎么重构?
介绍 最近跟着公司的大佬开发了一款IM系统,类似QQ和微信哈,就是聊天软件。我们有一部分业务逻辑是这样的 if (msgType = "文本") { // dosomething } else if(msgType = "图片") { // doshomething } else if(msgType = "视频") { // doshomething } else { // doshom...
致 Python 初学者
欢迎来到“Python进阶”专栏!来到这里的每一位同学,应该大致上学习了很多 Python 的基础知识,正在努力成长的过程中。在此期间,一定遇到了很多的困惑,对未来的学习方向感到迷茫。我非常理解你们所面临的处境。我从2007年开始接触 python 这门编程语言,从2009年开始单一使用 python 应对所有的开发工作,直至今天。回顾自己的学习过程,也曾经遇到过无数的困难,也曾经迷茫过、困惑过。开办这个专栏,正是为了帮助像我当年一样困惑的 Python 初学者走出困境、快速成长。希望我的经验能真正帮到你
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,...
程序员:我终于知道post和get的区别
是一个老生常谈的话题,然而随着不断的学习,对于以前的认识有很多误区,所以还是需要不断地总结的,学而时习之,不亦说乎
《程序人生》系列-这个程序员只用了20行代码就拿了冠军
你知道的越多,你不知道的越多 点赞再看,养成习惯GitHub上已经开源https://github.com/JavaFamily,有一线大厂面试点脑图,欢迎Star和完善 前言 这一期不算《吊打面试官》系列的,所有没前言我直接开始。 絮叨 本来应该是没有这期的,看过我上期的小伙伴应该是知道的嘛,双十一比较忙嘛,要值班又要去帮忙拍摄年会的视频素材,还得搞个程序员一天的Vlog,还要写BU...
加快推动区块链技术和产业创新发展,2019可信区块链峰会在京召开
11月8日,由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办,科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。   区块链技术被认为是继蒸汽机、电力、互联网之后,下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力,电力解决了人类基本的生活需求,互联网彻底改变了信息传递的方式,区块链作为构造信任的技术有重要的价值。   1...
程序员把地府后台管理系统做出来了,还有3.0版本!12月7号最新消息:已在开发中有github地址
第一幕:缘起 听说阎王爷要做个生死簿后台管理系统,我们派去了一个程序员…… 996程序员做的梦: 第一场:团队招募 为了应对地府管理危机,阎王打算找“人”开发一套地府后台管理系统,于是就在地府总经办群中发了项目需求。 话说还是中国电信的信号好,地府都是满格,哈哈!!! 经常会有外行朋友问:看某网站做的不错,功能也简单,你帮忙做一下? 而这次,面对这样的需求,这个程序员...
相关热词 c# 二进制截断字符串 c#实现窗体设计器 c#检测是否为微信 c# plc s1200 c#里氏转换原则 c# 主界面 c# do loop c#存为组套 模板 c# 停掉协程 c# rgb 读取图片
立即提问