我正在使用websphere 6.1迁移到jboss EAP 6.3。我发现jboss内容的部署过程非常简单,我的旧服务器只包含战争。
共享库的配置已经没有问题,但问题是数据源的配置是一个java.sql.SQLException错误:你不能使用autocommit set提交!阻止通过。
我在google上搜索最多说这是标准,我们必须将代码更改为setAutoCommit(Fasle)。
但在我的情况下,为了让这段话对开发者来说是透明的或者改变很小,我无法改变战争。我介入的区域只是应用程序服务器。
在配置文件standalone.xml下面:
感谢您指导我,如果另一个问题处理同样的问题,我还没有发现类似的问题。即使在我看来它是基本的东西!!
Similar questions but need more detail
有什么想法吗?
<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)
答案 0 :(得分:0)
我担心这是执行此操作的唯一方法:在获取每个连接时以编程方式将autocommit选项设置为false。主要原因是JCA规范,其中参与事务的Connection对象的自动提交模式设置为off(false)。 这就是为什么你不能在事务中改变自动提交模式的原因。