Reputation: 167
In jboss 7, I have below config
<datasource jndi-name="java:jboss/env/esilicon/vms/OracleDBPoolNonXA" pool-name="ExampleDS">
<connection-url>jdbc:oracle:thin:@erptstdb.sc.kaka.com:14100:ERPTST</connection-url>
<driver>XAOracleJDBCDriver</driver>
<pool>
<min-pool-size>10</min-pool-size>
<max-pool-size>20</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>apps</user-name>
<password>apps</password>
</security>
</datasource>
<drivers>
<driver name="XAOracleJDBCDriver" module="oracle.jdbc">
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
</driver>
</drivers>
In orther class, I've method to get the connection for datasource
public static Connection getNonXAConnection() {
try {
InitialContext context = new InitialContext();
DataSource dataSource = (DataSource)context.lookup(JNDILookup.PURE_CONNECTION_JNDI);
return dataSource.getConnection();
} catch (Exception e) {
e.printStackTrace();
logger.fatal(e.getMessage(), e.getCause());
}
return null;
}
The error occur when I commit this connection
java.sql.SQLException: You cannot commit during a managed transaction!
at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection.jdbcCommit(BaseWrapperManagedConnection.java:981)
at org.jboss.jca.adapters.jdbc.WrappedConnection.commit(WrappedConnection.java:757)
I just like to get connection and execute some stored procedure, and finnaly commit this connection. Please help me
Upvotes: 2
Views: 3683
Reputation: 186
Use an anotation like this:
@TransactionAttribute(TransactionAttributeType.SUPPORTS)
public class SchedulerBean {
I was facing same problem with Quartz and was able to solve this way.
Upvotes: 2
Reputation: 8819
I had this error when specifying an incorrect remoting address in the standalone.xml file. The value should normally be:
<socket-binding name="remoting" port="4447"/>
This value should be set to the port address before any offset applied using the -Djboss.socket.binding.port-offset=xxx option in the startup script.
Upvotes: 1