jboss eap解决方法默认设置连接:autocommit = true [英] jboss eap workaround default setting connection: autocommit = true

查看:177
本文介绍了jboss eap解决方法默认设置连接:autocommit = true的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将Websphere 6.1迁移到jboss EAP 6.3.我发现在jboss内容中部署过程非常简单,我的旧服务器仅包含wars.

I'm working on a websphere 6.1 migration to jboss EAP 6.3. I find that the deployment process is very simple in jboss content that my old server contains only wars.

共享库的配置已顺利通过,但是问题在于数据源的配置出现java.sql.SQLException错误:您不能使用自动提交集来提交!阻止通过.

the configuration of shared libraries has passed without problem, but the problem is with the configuration of datasources a java.sql.SQLException error: You can not commit with autocommit set! block passage.

我在google上搜索时最多说这是标准,我们必须将代码更改为setAutoCommit(Fasle).

I searched on google most say that this is the standard, and that we must change the code to setAutoCommit (Fasle).

但就我而言,为了使这段话对开发人员透明或进行最少的更改,我无法改变战争.我的干预区域仅是应用程序服务器.

But in my case, in order that this passage is transparent for developers or with minimal change, I can't change the war. The area of my intervention are application server only.

在配置文件standalone.xml下面:

Below configuration file standalone.xml:

如果另一个问题处理相同的问题,我还没有找到类似的问题,谢谢您的指导.即使我认为这很基本!!

thank you for guiding me if another issue that deals with the same problem, I have not found a similar problem. even if it is something elementary in my opinion !!

类似的问题,但需要更多详细信息

请问有什么想法吗?

<datasource jta="true" jndi-name="java:/jdbc/XXXXPool" pool-name="XXXXPool" enabled="true" use-ccm="true">
    <connection-url>jdbc:oracle:thin:@xxxxxxxxx:1521:xxx</connection-url>
    <driver-class>oracle.jdbc.OracleDriver</driver-class>
    <datasource-class>oracle.jdbc.pool.OracleConnectionPoolDataSource</datasource-class>
    <connection-property name="autoCommit"> <!-- not working -->
        false
    </connection-property>
    <driver>OracleJDBCDriver</driver>
    <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
    <security>
        <user-name>xx</user-name>
        <password></password>
    </security>
    <validation>
        <validate-on-match>false</validate-on-match>
        <background-validation>false</background-validation>
    </validation>
    <timeout>
        <set-tx-query-timeout>false</set-tx-query-timeout>
        <blocking-timeout-millis>0</blocking-timeout-millis>
        <idle-timeout-minutes>0</idle-timeout-minutes>
        <query-timeout>0</query-timeout>
        <use-try-lock>0</use-try-lock>
        <allocation-retry>0</allocation-retry>
       <allocation-retry-wait-millis>0</allocation-retry-wait-millis>
    </timeout>
    <statement>
        <share-prepared-statements>false</share-prepared-statements>
    </statement>
</datasource>
<drivers>
    <driver name="OracleJDBCDriver" module="oracle.jdbc"/>
    <driver name="h2" module="com.h2database.h2">
        <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
    </driver>
</drivers>

错误:

java.sql.SQLException: You cannot commit with autocommit set!

16:38:40,205 ERROR [stderr] (http-/xxx.xx.xx.xx:8080-1)         at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection.jdbcCommit(BaseWrapperManagedConnection.java:1071)

16:38:40,206 ERROR [stderr] (http-/xxx.xx.xx.xx:8080-1)         at org.jboss.jca.adapters.jdbc.WrappedConnection.commit(WrappedConnection.java:758)

16:38:40,206 ERROR [stderr] (http-/xxx.xx.xx.xx:8080-1)         at com.client.Series.utiles.UserUtilesClass.checkUser(UserUtilesClass.java:370)

16:38:40,206 ERROR [stderr] (http-/xxx.xx.xx.xx:8080-1)         at com.client.Series.form.LoginForm.validate(LoginForm.java:65)

16:38:40,206 ERROR [stderr] (http-/xxx.xx.xx.xx:8080-1)         at org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:942)

16:38:40,206 ERROR [stderr] (http-/xxx.xx.xx.xx:8080-1)         at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:255)

16:38:40,207 ERROR [stderr] (http-/xxx.xx.xx.xx:8080-1)         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)

16:38:40,207 ERROR [stderr] (http-/xxx.xx.xx.xx:8080-1)         at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)

16:38:40,207 ERROR [stderr] (http-/xxx.xx.xx.xx:8080-1)         at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)

16:38:40,207 ERROR [stderr] (http-/xxx.xx.xx.xx:8080-1)         at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

16:38:40,208 ERROR [stderr] (http-/xxx.xx.xx.xx:8080-1)         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295)

16:38:40,208 ERROR [stderr] (http-/xxx.xx.xx.xx:8080-1)         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)

16:38:40,208 ERROR [stderr] (http-/xxx.xx.xx.xx:8080-1)         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231)

16:38:40,208 ERROR [stderr] (http-/xxx.xx.xx.xx:8080-1)         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149)

16:38:40,209 ERROR [stderr] (http-/xxx.xx.xx.xx:8080-1)         at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)

16:38:40,209 ERROR [stderr] (http-/xxx.xx.xx.xx:8080-1)         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145)

16:38:40,209 ERROR [stderr] (http-/xxx.xx.xx.xx:8080-1)         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97)

16:38:40,209 ERROR [stderr] (http-/xxx.xx.xx.xx:8080-1)         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102)

16:38:40,209 ERROR [stderr] (http-/xxx.xx.xx.xx:8080-1)         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344)

16:38:40,210 ERROR [stderr] (http-/xxx.xx.xx.xx:8080-1)         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)

16:38:40,210 ERROR [stderr] (http-/xxx.xx.xx.xx:8080-1)         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653)

16:38:40,210 ERROR [stderr] (http-/xxx.xx.xx.xx:8080-1)         at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:926)

16:38:40,211 ERROR [stderr] (http-/xxx.xx.xx.xx:8080-1)         at java.lang.Thread.run(Unknown Source)

推荐答案

恐怕这是唯一的方法:在获取每个连接时,将autocommit选项以编程方式设置为false.主要原因是JCA规范,其中将参与事务的Connection对象的自动提交模式设置为off(假). 这就是为什么您不能在事务中更改自动提交模式的原因.

I am afraid this is the only way of doing this: to set the autocommit option to false programatically when obtaining every connection. And the main reason for that is the JCA spec where the auto-commit mode of the Connection object participating in a transaction is set to off (false). That's why you can not change the auto-commit mode within the transaction.

这篇关于jboss eap解决方法默认设置连接:autocommit = true的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆