-
15. Re: CNFE: org.apache.AnnotationProcessor from BaseClassLoader
mpavleski Feb 4, 2011 11:31 AM (in response to juergen.zimmermann)Hi,
I have the same problem with stateful session beans. My usage is :
@Stateful
public class StatefulBean {
private @Inject StatelessBean bean;
}
The exception:
17:26:06,092 ERROR [org.jboss.ejb3.cache.simple.SimpleStatefulCache.StatefulBean] problem passivation thread: javax.ejb.EJBException: Could not passivate; failed to save state
Root cause:
java.lang.ClassNotFoundException: org.apache.AnnotationProcessor
It doesn't seam productive to add transient to SFSBs data members for injected classes. For example I did not had such problems on Seam 2/EJB 3 when I was using @In or @EJB. Also there was no need (and I presume no need either in EJB 3.1) to state that SFSBs implement Seriazible interface.
-
16. CNFE: org.apache.AnnotationProcessor from BaseClassLoader
juergen.zimmermann Feb 5, 2011 3:20 AM (in response to mpavleski)Why do you use @Inject to inject a stateless session bean? Why don't you use @EJB?
-
17. CNFE: org.apache.AnnotationProcessor from BaseClassLoader
nickarls Feb 5, 2011 4:26 AM (in response to juergen.zimmermann)Juergen Zimmermann wrote:
Why do you use @Inject to inject a stateless session bean? Why don't you use @EJB?
decorators, stereotype-enabled interceptors etc. Do people still use @EJB? Barbarians! ;-)
-
18. CNFE: org.apache.AnnotationProcessor from BaseClassLoader
juergen.zimmermann Feb 5, 2011 5:59 AM (in response to nickarls)What are the disadvantages in using @EJB? Which annotation would you use in the concrete case above?
-
19. Re: CNFE: org.apache.AnnotationProcessor from BaseClassLoader
mpavleski Feb 5, 2011 9:14 AM (in response to juergen.zimmermann)decorators, stereotype-enabled interceptors
Neither, I'm needing the @Inject mostly because we are using the @Alternatives patern so some stateless interfaces have diferent implementations depending on sub-project. With @EJB we don't have that, and in EJB 3.1 container complains because it cannot decide which implementation to use.
Of course, in the fulness of time if needed those handy features of CDI will come into play.
About the @EJB annotation, in current Weld implementations it seems that if you don't need the CDI features it may be more useful to stick with it, at least memory consumption wise, according to this post: http://hwellmann.blogspot.com/2010/11/cdi-major-risk-factor-in-java-ee-6.html
Back on the original question.. Will suplement of the AnnotationProcessor class in the class-path resolve the issue or is it just a bug in Weld ? (Weld misinterpreting the environment to be Tomcat instead of JBoss).
If it is worth mentioning, some of the objects used in the stateful beans are JAX-B annotated classes and the AS is configured to use JBossWS-CXF 3.4.1 implementation. JBoss is 6.0 Final.
-
20. CNFE: org.apache.AnnotationProcessor from BaseClassLoader
nickarls Feb 5, 2011 9:36 AM (in response to mpavleski)Could you post a minimal EJB with @CacheConfig(idleTimeoutSeconds = 1) that show this behaviour?
-
21. CNFE: org.apache.AnnotationProcessor from BaseClassLoader
mpavleski Feb 7, 2011 3:48 AM (in response to nickarls)Here is actual log from a passivisation error event:
I'm testing the minimal bean right now...
-
22. CNFE: org.apache.AnnotationProcessor from BaseClassLoader
nickarls Feb 7, 2011 3:51 AM (in response to mpavleski)Bonus points awarded if you can get it down to a single, interfaceless, war-deployed case ;-)
-
23. Re: CNFE: org.apache.AnnotationProcessor from BaseClassLoader
mpavleski Feb 7, 2011 5:50 AM (in response to nickarls)I did't succeed to reproduce the problem on a minimal test bean, Statless bean injected or not, the passivation went ok.
However I found the following by examining the logs: We have 4 statefull beans in the current project 3 of which @Inject a EJB3.1 Singleton bean which we use for configuration (it is using @Lock(LockType.READ) as once initialized it is safe to be concurrently read). Exactly those three classes cause the passivisation errors. I'll add transient to the data member and see if that workaround works (I assume it will)...
Update:
Additional testing confirms that the singleton injection is the problem. Adding transient did not help. We will solve this by switching from Singleton to @ApplicationScoped producer method and the class that was a EJB3.1 signleton will become a POJO. However if that was not possible (we don't need DI and other stuff for the exSingleton) this bug would have caused more trouble. -
24. Re: CNFE: org.apache.AnnotationProcessor from BaseClassLoader
nickarls Feb 7, 2011 6:18 AM (in response to mpavleski)So you are saying that any stateless EJB with an @Injected Singelton will fail passivation?
-
25. Re: CNFE: org.apache.AnnotationProcessor from BaseClassLoader
mpavleski Feb 7, 2011 8:28 AM (in response to nickarls)Yeah I ment that (except stateful not stateless), but it turned out I jumped to a conclusion to early. The signleton is not the problem as changing the implementation did not stop the error.
Further testing with a simple SFSB revealed that the problem occurs when I @Inject a simple SLSB which accesses EntityManager.Here is the signature of that SLSB (nothing special about it):
public class DBLog {
private static final String LOG_FORMAT="ePero Event %06d (%s), detail: %s, %s:%s";
private static final String LOG_FORMAT_STACKTRACE = "ePero Event %06d (%s), detail: %s, %s:%s\nStacktrace: %s";
@PersistenceContext
private EntityManager em;
private static Logger log = Logger.getLogger(DBLog.class);
public void log(Document doc,int code,String desc)
public void log(Job job,int code,String desc)
public void log(String jobId,String docId, int code,String desc)
public String logException(String jobId, String docId, ePeroException e)
public String logException(ePeroException e)
public static String getStackTrace(Throwable t)
}
-
26. CNFE: org.apache.AnnotationProcessor from BaseClassLoader
nickarls Feb 7, 2011 8:29 AM (in response to mpavleski)So the minimal case is a passivating stateful ejb which injects another stateful ejb that has a @PersistenceContext field. Or? Just looking for something to reproduce locally...
-
27. Re: CNFE: org.apache.AnnotationProcessor from BaseClassLoader
mpavleski Feb 7, 2011 9:21 AM (in response to nickarls)Yes it seems that way. Also note that by replacing the @Inject to @EJB the problem went away for the test bean, however I cannot do that on all injections so the problem persists...
-
28. Re: CNFE: org.apache.AnnotationProcessor from BaseClassLoader
mpavleski Feb 7, 2011 11:47 AM (in response to mpavleski)Only .class in the whole JBoss6 deployment directory tree referencing the org.apache.AnnotationProcessor class is the Tomcat6InjectionProvider class located in Mojarra 2:
JBoss6\server\default\deployers\jsf.deployer\Mojarra-2.0\jsf-libs\jsf-impl-2.0.3-b05.jar
I don't know if that is the cause of the problems...
-
29. Re: CNFE: org.apache.AnnotationProcessor from BaseClassLoader
nickarls Feb 8, 2011 3:57 AM (in response to mpavleski)And there are no refs to JSF stuff in the bean being injected?