You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Vinaya Tirikkovalluru <vi...@converge.com> on 2009/06/16 17:38:50 UTC
startTransaction() returns NullPointer exception
Him,
I am trying to implement Transactions.
My code is
[code]
public void testTrans() throws SQLException {
try{
System.out.println("in DAOimpl");
if(getSqlMapClient() == null){
System.out.println("getSqlMapClient is null");
}else{
System.out.println("getSqlMapClient is not
null");
System.out.println("getSqlMapClient :" +
getSqlMapClient());
}
getSqlMapClient().startTransaction();
System.out.println("in DAOimpl asdadasasas");
SecurityRole example = new SecurityRole();
example.setApplication("QMS");
example.setSecurityRole("MYTEST");
example.setSecurityRoleDesc("test for Transactions");
System.out.println("in DAOimpl 111");
getSqlMapClientTemplate().update("NECXADM_SECURITY_ROLE.abatorgenerated_
updateByPrimaryKey", example);
System.out.println("in DAOimpl 2222");
UserAccounts acc = new UserAccounts();
acc.setAccountId(new BigDecimal(8099));
acc.setInsertUserId(new Long(0));
System.out.println("in DAOimpl 3333");
getSqlMapClientTemplate().update("NECXADM_USER_ACCOUNTS.abatorgenerated_
updateByPrimaryKey", acc);
System.out.println("in DAOimpl 4444");
getSqlMapClient().commitTransaction();
System.out.println("in DAOimpl 5555");
}finally {
System.out.println("in DAOimpl 6666");
getSqlMapClient().endTransaction();
System.out.println("in DAOimpl 7777");
}
}
[/code]
I get the below exception
2009-06-16 11:32:23,196 [JEVANS,CBAA546390915330A48911020688FE35] INFO
[STDOUT] here in trans
2009-06-16 11:32:23,196 [JEVANS,CBAA546390915330A48911020688FE35] INFO
[STDOUT] in DAOimpl
2009-06-16 11:32:23,196 [JEVANS,CBAA546390915330A48911020688FE35] INFO
[STDOUT] getSqlMapClient is not null
2009-06-16 11:32:23,196 [JEVANS,CBAA546390915330A48911020688FE35] INFO
[STDOUT] getSqlMapClient :null
2009-06-16 11:32:23,196 [JEVANS,CBAA546390915330A48911020688FE35] INFO
[STDOUT] in DAOimpl 6666
2009-06-16 11:32:23,196 [JEVANS,CBAA546390915330A48911020688FE35] FATAL
Caused by: java.lang.NullPointerException
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.endTransaction(SqlM
apExecutorDelegate.java:782)
at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.endTransaction(SqlMapSes
sionImpl.java:176)
at
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.endTransaction(SqlMapClie
ntImpl.java:154)
at
com.converge.trade.persistent.model.workgroup.view.workgroupusersvw.Work
GroupUsersVwDAOImpl.testTrans(WorkGroupUsersVwDAOImpl.java:166)
at
com.converge.trade.persistent.model.customerreq.CustomerRequirementsServ
iceImpl.testTrans(CustomerRequirementsServiceImpl.java:1088)
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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(
AopUtils.java:310)
at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAo
pProxy.java:198)
at $Proxy66.testTrans(Unknown Source)
at
com.converge.trade.view.bean.customerrequirements.seller.search.SearchRe
qReqLinesHandler.testTrans(SearchReqReqLinesHandler.java:528)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[adajavax.enterprise.resource.webcontainer.jsf.application]
java.lang.NullPointerException
javax.faces.el.EvaluationException: java.lang.NullPointerException
Thanks
Vinaya
This electronic message is intended only for the use of the individual(s) or entity(ies) named above and may contain information which is privileged and/or confidential. If you are not the intended recipient, be aware that any disclosure, copying, distribution, dissemination or use of the contents of this message is prohibited. If you received this message in error, please notify the sender immediately.