MailListener: how to create a new instance for each message?
amic Jun 20, 2009 11:17 PMHi there,
could you please give me a short sample how you instantiate a new entity whenever a message arrives through onMessage(Message message)
?.
I'm receiving an exception and I can't figure out how to fix this:
[Component] Exception calling component @Destroy method: entityManager java.lang.IllegalStateException: attempting to destroy the persistence context while an active transaction exists (try installing <transaction:ejb-transaction/>) at org.jboss.seam.persistence.ManagedPersistenceContext.close(ManagedPersistenceContext.java:214) at org.jboss.seam.persistence.ManagedPersistenceContext.destroy(ManagedPersistenceContext.java:177) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.jboss.seam.util.Reflections.invoke(Reflections.java:22) at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144) at org.jboss.seam.Component.callComponentMethod(Component.java:2249) at org.jboss.seam.Component.callDestroyMethod(Component.java:2180) at org.jboss.seam.Component.destroy(Component.java:1469) at org.jboss.seam.contexts.Contexts.destroy(Contexts.java:251) at org.jboss.seam.contexts.Contexts.flushAndDestroyContexts(Contexts.java:363) at org.jboss.seam.contexts.Lifecycle.endCall(Lifecycle.java:96) at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:122) at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597)
The goal would be, to invoke the process
method from the eMailHome bean from inside the onMessage() method.
... @Name("eMailHome") public class EMailHome extends EntityHome<EMail> { ... public void process() { }
It would be great if someone could give me a hint.
Thx
Mike