I am using Jax RS in a Java application hosted on SAP NEO, and I am using @EJB annotation to create a field of a @Stateful service class, and when this field is used it gives exception mentioned below: (this exception is intermittent, 90% times it works)
EjbTransactionUtil.handleSystemException: Not Found javax.ejb.NoSuchEJBException: Not Found
at org.apache.openejb.core.ivm.BaseEjbProxyHandler.convertException(BaseEjbProxyHandler.java:429)
at org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:351)
at com.sun.proxy.$Proxy130.methodCallUsingEJBField(Unknown Source)
(This is not complete stack trace)
call to method 'methodCallUsingEJBField(aTypeOfList)' is made inside method abc(String str) and method abc is called by methodXYZ(MultipartBody body)
EjbTransactionUtil.handleSystemException: The transaction has been marked rollback only because the bean encountered a non-application exception :javax.ejb.NoSuchEJBException : Not Found javax.ejb.EJBTransactionRolledbackException: The transaction has been marked rollback only because the bean encountered a non-application exception :javax.ejb.NoSuchEJBException : Not Found
at org.apache.openejb.core.ivm.BaseEjbProxyHandler.convertException(BaseEjbProxyHandler.java:420)
at org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:351)
at com.sun.proxy.$Proxy171.methodXYZ(Unknown Source)
Class definition
@Stateful
public class ServiceClasss implements InterfaceName
Field Declaration in dao
@EJB
private InterfaceName fieldName;
using the field in this way
list = fieldName.methodCallUsingEJBField(list);
This exception is seen even if the session is active(at the time of using the application)(Was thinking about session timeout issue)
There is one another field annotated with @EJB in same dao class, it never throws exception(This EJB is of a @Stateless class)
Maven dependency
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>apache-tomee</artifactId>
<version>1.7.0</version>
<scope>provided</scope>
</dependency>
Update: The Dao class in which i am Declaring and using that EJB is Stateless
@Stateless
public class classNaameDao{
@EJB
private InterfaceName fieldName; //the class which implements this interface is @Stateful
//some code here
list = fieldName.methodCallUsingEJBField(list);
//using the field in this statelesss class
}
Any help is appereciated.