Reputation: 1
After migrating from Java 6 to Java 8 and from jboss 6.2 to jboss 7.2 i'm encountering the following problem:
Caused by: com.ibatis.sqlmap.client.SqlMapException: Error initializing TransactionManager. Could not instantiate TransactionConfig. Cause: java.lang.NullPointerException
at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser$7.process(SqlMapConfigParser.java:192) [ibatis-2.3.4.jar:]
at com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:121) [ibatis-2.3.4.jar:]
... 138 more
Caused by: java.lang.NullPointerException
at org.jboss.as.naming.InitialContext.getURLScheme(InitialContext.java:162) [wildfly-naming-7.2.9.GA-redhat-00003.jar:7.2.9.GA-redhat-00003]
at org.jboss.as.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:130) [wildfly-naming-7.2.9.GA-redhat-00003.jar:7.2.9.GA-redhat-00003]
at javax.naming.InitialContext.lookup(InitialContext.java:417) [rt.jar:1.8.0_322]
at javax.naming.InitialContext.lookup(InitialContext.java:417) [rt.jar:1.8.0_322]
at com.ibatis.sqlmap.engine.transaction.jta.JtaTransactionConfig.setProperties(JtaTransactionConfig.java:47) [ibatis-2.3.4.jar:]
at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser$7.process(SqlMapConfigParser.java:183) [ibatis-2.3.4.jar:]
... 139 more
This the code:
private Ibatis() throws MyException {
try {
String resource = "com/tact/raqu/ibatis/sqlmaps/SqlMapConfigRaqu.xml";
Reader reader = Resources.getResourceAsReader(resource);
sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
} catch (Exception e) {
log.error("Errore di configurazione Ibatis", e);
throw new QuasarException("Errore di configurazione Ibatis", e);
}
}
and here the xml
<sqlMapConfig>
<settings useStatementNamespaces="false"
cacheModelsEnabled="true"
enhancementEnabled="true"
lazyLoadingEnabled="true" />
<typeHandler javaType="java.util.Calendar" callback="com.tact.raqu.dao.CalendarTypeHandler"/>
<transactionManager type="JTA">
<property name="transactionManagerName" value="java:jboss/TransactionManager"/>
<dataSource type="JNDI">
<property name="DataSource" value="java:/jdbc/ds_raqu"/>
</dataSource>
</transactionManager>
<sqlMap resource="com/tact/raqu/ibatis/sqlmaps/raqu.xml"/>
</sqlMapConfig>
the null pointer is on a class of the ibatis framework as it tries to do a lookup at userTransaction, if I add the following line to the xml:
property name="UserTransaction" value="java:jboss/UserTransaction"/>
gives the error:
WFLYEJB0137: Only session and message-driven beans with bean-managed transaction demarcation are allowed to access UserTransaction.
But i need to use cmt. Any helps?
switching transactionManagement type from JTA
to EXTERNAL
makes it work, but i have to use JTA.
Upvotes: 0
Views: 56