[jboss-user] [JBoss Seam] - Injected SLSB not getting interceptors sometimes
stu2
do-not-reply at jboss.com
Wed Apr 4 17:27:09 EDT 2007
I'm running Seam 1.2.1, and these symptoms appear in SeamTest.
I have SLSB A which is injected via @In with SLSB B. A seems to have all appropriate interceptors, and @Logger injection works fine. A calls B. B blows up upon writing to the log because the log is never initialized. I've tried having B declare @Logger Log log explicitly and (in the example I'll post here) by extending EntityController.
Here's relevant bits of A:
| @Name("ingestService")
| @Stateless
| @AutoCreate
| public class IngestServiceImpl implements IngestService
| {
| @Logger static Log log;
| @In CsvIngest ingestUtil;
|
|
| .... (in a method)
| ingestResult = ingestUtil.ingest(feedFile, feedDefinition, previousFeedItems);
|
B will throw NullPointerException when it tries to log. What I found odd is that A has all indications of receiving the interceptors, which do the injection. B looks like a direct invocation (no sign of interceptors). And I can's see a meaningful difference between A and B - so I'm stuck.
Anyway, here's the relevant bits from B:
| @Stateless
| @Name("ingestUtil")
| @AutoCreate
| public class CsvIngestUtil extends EntityController implements CsvIngest
| {
|
| ... below from the throwing method - last line is 135 referenced from stacktrace
|
| item.setFeedItemStatus(FeedItemStatus.INSERT_REQUESTED);
| // I put this here to test if the em was injected - it is because the assert doesn't throw
| assert getEntityManager() != null : "null entity manager!";
| System.out.println("EntityManager is not null. [" + getEntityManager().getClass().getName() + "]");
| debug("Scheduling item [" + item.getUniqueInternalCode() + "] for insert"); // throws here
|
The stacktrace showing the (to me) unexpected presence/absence of interceptors is:
| aused by: java.lang.NullPointerException
| at org.jboss.seam.framework.Controller.debug(Controller.java:183)
| at com.fb.core.business.ingest.CsvIngestUtil.updateItemFromPreviousData(CsvIngestUtil.java:135)
| at com.fb.core.business.ingest.CsvIngestUtil.ingest(CsvIngestUtil.java:85)
| at com.fb.core.business.IngestServiceImpl.processFeedImportNoPersistance(IngestServiceImpl.java:76)
| at com.fb.core.business.IngestServiceImpl.processFeedImport(IngestServiceImpl.java:52)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:109)
| at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
| at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:37)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
| at org.jboss.seam.interceptors.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:47)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
| at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
| at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
| at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:53)
| at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
| at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
| at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
| at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
| at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
|
Any idea what I'm doing wrong here? Any more info I could provide if not?
I confess I'm a bit confused by when I should expect interception. I'm using SLSB more often than I would otherwise because I want @Logger and other interceptor services to work, but I realize this is because I don't understand enough yet.
Thanks,
Stu
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4034796#4034796
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4034796
More information about the jboss-user
mailing list