Hello All, I'm struggling futher in my adventure with Jboss and EJB 3.0. I joined Spring 3.0 with EJB. I have 3 modules - web module with Spring controllers, ejb module with my EJB beans and spring mogule with other classes like dao or some helpers. All in the ear.
So, in my Spring Controller I have the following code:
@Controller
public class IndexController {
@EJB
PaymentRemote paymentRemote;
@RequestMapping(value = "/index")
public ModelAndView index() throws Exception {
ModelAndView mav = new ModelAndView("index/index");
paymentRemote.savePayment(123, "bla222");
paymentRemote.sayGoodbye();
return mav;
}
In my EJB module I have the following stateful bean:
@Stateful
@Interceptors( SpringBeanAutowiringInterceptor.class)
public class PaymentRemoteImpl implements PaymentRemote{
@Autowired
ExampleService exampleService;
public void savePayment(long payment, String name) throws Exception {
exampleService.savePayment(123, "kk");
}
@Remove
public void sayGoodbye() {
System.out.println("I want to finish my task here!");
}
}
Every dependency is injected properly. When I test this code with stateless beans it works just fine. When it comes to stateful beans when I call my method sayGoodbye() I can't call again this bean. I get the exception:
javax.ejb.NoSuchEJBException: Could not find stateful bean: a74a2l-n1u5tx-gcwd0e6a-1-gcwd18fo-9h
I don't understand this situation :/ I asked the container to remove the bean but later on I would like to use it again but it wants to find me again the same bean. I thought that although I asked to remove it it will create on my request again. Could anyone kindly help me with my problem? I'm stucked.