spring annotations <tx:annotation-driven/>
ankit909 Nov 17, 2011 1:45 AMHi,
I am using jboss-eap-4.2
with Spring 3.0 and using annotations. I am using @Transactional annotation on my DAO as shown below :
@Repository("chatSessionDAO")
@Transactional
public class ChatSessionDAO extends MercerChatDAO {
/** mySessionFactory */
@Autowired
@Qualifier("mySessionFactory")
private LocalSessionFactoryBean mySessionFactory;
/** chatAlertsDO */
@Autowired
@Qualifier("chatAlertsDO")
private MHRContChatAlertsDO chatAlertsDO;
/**
* Method to retrieve chat session objects for a particular id
*
* @param chatSessionQO
* @return
* @throws MercerException
*/
public List<?> retrieveSessionInfo(ChatSessionQO chatSessionQO) throws MercerException {
Criteria criteria = null;
List<?> lstReturn = null;
try {
long chatSessionId = chatSessionQO.getChatSessionId();
Long chatSessionIdLong = new Long(chatSessionId);
log.info("creating criteria for chatsession");
SessionFactory sessionFactory = mySessionFactory.getObject();
Session session = sessionFactory.getCurrentSession();
criteria = session.createCriteria(MHRContChatSessionDO.class, "chatSession").add(
Restrictions.eq("id", chatSessionIdLong));
if (criteria != null) {
lstReturn = processQuery(criteria);
}
} catch (Exception e) {
log.error("error :::", e);
throw new MercerException("No transaction");
}
return lstReturn;
}
and on starting the server I am getting the following error:
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'chatSessionDAO'
defined in file [/local/jboss-eap-4.2/jboss-as/server/mercer02/deploy/mercerhr.ear/mercer.war/WEB-INF/classes/com/mercer/chat/app/dao/ChatSessionDAO.class]:
Initialization of bean failed;
nested exception is java.lang.VerifyError:
(class: com/mercer/chat/app/dao/ChatSessionDAO$$EnhancerByCGLIB$$c2bd3f90$$FastClassByCGLIB$$bc114739,
method: invoke signature: (ILjava/lang/Object;[Ljava/lang/ObjectLjava/lang/Object Inconsistent stack height 2 != 1
I am using <tx:annotation-driven/> as follows:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:task="http://www.springframework.org/schema/task"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task-3.0.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<tx:annotation-driven/>
and using JTATransactionManager: