Skip to main content

Error while calling EntityManager.createQuery with WebSphere 8.5

No replies
murthydvssn
Offline
Joined: 2013-07-29
Points: 0

Hi all, I have developed an application using Struts 2.3.4, JPA 2.0 using DB2 as backend and deployed it on WebSphere 8.5
But while running the login screen I have encountered the following error messages. Can anyone solve this problem?

The following is the code:

package com.sunrise.suzuki.dao;

import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import javax.persistence.TypedQuery;
import javax.transaction.UserTransaction;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.*;
import java.sql.*;
import com.ibm.db2.jcc.DB2ConnectionPoolDataSource;

import com.sunrise.suzuki.annotations.ClsInjectQueryAnnotationProcessor;
import com.sunrise.suzuki.annotations.InjectQuery;
import com.sunrise.suzuki.entities.ClsGroupMaster;
import com.sunrise.suzuki.entities.ClsUserMaster;
import com.sunrise.suzuki.entities.ClsFunctionMaster;
import com.sunrise.suzuki.pool.IPool;
import com.sunrise.suzuki.util.ClsJPAUtil;
import com.sunrise.suzuki.dao.LoginDAO;

public class LoginDAOImpl implements LoginDAO {
@InjectQuery(name = "getAgents")
private String getAgents;
@InjectQuery(name = "checkLogin")
private String qryCheckLogin;
@InjectQuery(name = "getfunctions")
private String qryGetFunctions;

public LoginDAOImpl() {
ClsInjectQueryAnnotationProcessor.processAnnotations(this);
}

public ClsUserMaster checkLogin(String userName, String pwd) {

ClsUserMaster user = null;
IPool entityManagerPool = null;
EntityManager entityManager = null;

try {
entityManagerPool = ClsJPAUtil.getEntityManagerPool();
entityManager = entityManagerPool.get();

Query qury = entityManager.createQuery(qryCheckLogin);
qury.setParameter("email", userName);
qury.setParameter("pwd", pwd);
qury.setParameter("isActive", "A");

user=(ClsUserMaster)qury.setMaxResults(1).getSingleResult();
entityManagerPool.release( entityManager );
}
catch (Exception e) {
e.printStackTrace();
}
return user;
}

}

The following are the error messages:
( the error is encountered while running the following line)
Query qury = entityManager.createQuery(qryCheckLogin);

at org.hibernate.engine.transaction.internal.jta.JtaStatusHelper.getStatus(JtaStatusHelper.java:73)null
at org.hibernate.engine.transaction.internal.jta.JtaStatusHelper.isActive(JtaStatusHelper.java:115)null
at org.hibernate.engine.transaction.internal.jta.CMTTransaction.join(CMTTransaction.java:149)null

at org.hibernate.ejb.AbstractEntityManagerImpl.joinTransaction(AbstractEntityManagerImpl.java:1220)null
at org.hibernate.ejb.AbstractEntityManagerImpl.postInit(AbstractEntityManagerImpl.java:178)null
at org.hibernate.ejb.EntityManagerImpl.(EntityManagerImpl.java:89)null
at org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:179)null

at com.ibm.ws.jpa.management.JPAEMPool.getEntityManager(JPAEMPool.java:170)null
at com.ibm.ws.jpa.management.JPATxEntityManager.getEMInvocationInfo(JPATxEntityManager.java:259)null
at com.ibm.ws.jpa.management.JPATxEntityManager.getEMInvocationInfo(JPATxEntityManager.java:191)null
at com.ibm.ws.jpa.management.JPAEntityManager.createQuery(JPAEntityManager.java:299)null

at com.sunrise.suzuki.dao.LoginDAOImpl.checkLogin(LoginDAOImpl.java:70)null

at com.sunrise.suzuki.action.LoginAction.execute(LoginAction.java:48)null

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)null
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)null
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)null

at java.lang.reflect.Method.invoke(Method.java:611)null

at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:453)null
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:292)null
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:255)null

at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)null

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)null
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)null
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)null
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)null
at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)null

at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)null

at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)null
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)null
at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)null
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)null
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:236)null
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)null
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)null
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:236)null
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)null
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)null
at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)null
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)null

at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)null

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)null
at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:90)null
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)null
at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)null
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)null
at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)null
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)null
at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)null
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)null
at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)null
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)null
at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)null
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)null
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)null
at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)null
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)null
at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)null
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)null
at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:192)null
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)null
at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)null
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)null

at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)null
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:511)null
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)null
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)null

at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)null
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)null
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:928)null
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1025)null
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3761)null
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)null
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:976)null
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)null
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)null
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:459)null
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:526)null
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:312)null
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:88)null
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)null
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)null
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)null
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)null
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)null
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)null
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)null
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1862)null