Hm.  Well, I tried making it a @Stateful bean, and went through some rigmarole 
with needing to put the init() method in the local interface.

But it still fails.  I now get this (sorry for the big mangled stacktrace, this 
forum isn't kind to long code lines):
   [testng] WARN  25-08 00:41:39,828 (Log4JLogger.java:warn:104)  -Stateful 
session beans was bound to the APPLICATION context - note that it is not safe 
to make concurrent calls to the bean: replogApplication
  |    [testng] INFO  25-08 00:41:39,828 (Log4JLogger.java:info:94)  
-Component: replogApplication, scope: APPLICATION, type: STATEFUL_SESSION_BEAN, 
class: com.robjsoftware.replog.ReplogApplication, JNDI: ReplogApplication/local
  | ...
  |    [testng] DEBUG 25-08 00:41:43,860 
(EJBContainer.java:initialiseInterceptors:718)  -Initialising interceptors for 
ReplogApplication...
  |    [testng] DEBUG 25-08 00:41:43,860 
(EJBContainer.java:initialiseInterceptors:720)  -Default interceptors: null
  |    [testng] DEBUG 25-08 00:41:43,860 
(EJBContainer.java:initialiseInterceptors:723)  -Class interceptors: []
  |    [testng] DEBUG 25-08 00:41:43,860 
(EJBContainer.java:initialiseInterceptors:739)  -All applicable interceptor 
classes: []
  |    [testng] INFO  25-08 00:41:43,860 (MCKernelAbstraction.java:install:84)  
-installing bean: jboss.j2ee:jar=test,name=ReplogApplication,service=EJB3 with 
dependencies:
  |    [testng] DEBUG 25-08 00:41:43,985 
(EJB3InterceptorsFactory.java:createPerJoinpoint:100)  -Bound interceptors for 
joinpoint: public void com.robjsoftware.replog.ReplogApplication.init() - 
[Lorg.jboss.ejb3.interceptor.InterceptorInfo;@150b45a
  |    [testng] DEBUG 25-08 00:41:44,000 (UserTransactionImpl.java:<init>:56)  
-new UserTx: [EMAIL PROTECTED]
  |    [testng] DEBUG 25-08 00:41:44,032 
(EJB3InterceptorsFactory.java:createPerJoinpoint:100)  -Bound interceptors for 
joinpoint: public void com.robjsoftware.replog.ReplogApplication.init() - 
[Lorg.jboss.ejb3.interceptor.InterceptorInfo;@b0ede6
  |    [testng] DEBUG 25-08 00:41:44,032 (JaccHelper.java:addPermissions:143)  
-ReplogApplication has no
  |  @SecurityDomain - skipping JACC configuration
  |    [testng] INFO  25-08 00:41:44,032 (EJBContainer.java:start:553)  
-STARTED EJB: com.robjsoftware.replog.ReplogApplication ejbName: 
ReplogApplication
  |    [testng] DEBUG 25-08 00:41:44,063 
(Ejb3Deployment.java:registerEJBContainer:440)  -Bound ejb3 container 
jboss.j2ee:service=EJB3,jar=test,name=ReplogApplication
  |    [testng] DEBUG 25-08 00:41:44,063 (Log4JLogger.java:debug:84)  
-instantiating Seam component: isUserInRole
  |    [testng] DEBUG 25-08 00:41:44,063 (Log4JLogger.java:debug:84)  
-instantiating Seam component: statelessContext
  |    [testng] DEBUG 25-08 00:41:44,063 (Log4JLogger.java:debug:84)  
-instantiating Seam component: replogApplication
  |    [testng] DEBUG 25-08 00:41:44,063 (Log4JLogger.java:debug:84)  -JNDI 
InitialContext 
properties:{java.naming.factory.initial=org.jnp.interfaces.LocalOnlyContextFactory,
 java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
  |    [testng] DEBUG 25-08 00:41:44,094 
(SecurityAssociation.java:<clinit>:143)  -Using ThreadLocal: false
  |    [testng] DEBUG 25-08 00:41:44,125 
(ExtendedPersistenceContextPropagationInterceptor.java:invoke:50)  -++++ 
LongLivedSessionPropagationInterceptor
  |    [testng] DEBUG 25-08 00:41:44,125 (ReplogApplication.java:init:37)  
-Creating replogApplication
  |    [testng] javax.ejb.EJBException: java.lang.NullPointerException
  |    [testng]     at 
org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:69)
  |    [testng]     at 
org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
  |    [testng]     at 
org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:197)
  |    [testng]     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
  |    [testng]     at 
org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
  |    [testng]     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
  |    [testng]     at 
org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:81)
  |    [testng]     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
  |    [testng]     at 
org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
  |    [testng]     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
  |    [testng]     at 
org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
  |    [testng]     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
  |    [testng]     at 
org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
  |    [testng]     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
  |    [testng]     at 
org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:189)
  |    [testng]     at 
org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)
  |    [testng]     at $Proxy55.init(Unknown Source)
  |    [testng]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native 
Method)
  |    [testng]     at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  |    [testng]     at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |    [testng]     at java.lang.reflect.Method.invoke(Method.java:585)
  |    [testng]     at 
org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
  |    [testng]     at 
org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:32)
  |    [testng]     at 
org.jboss.seam.Component.callComponentMethod(Component.java:1338)
  |    [testng]     at 
org.jboss.seam.Component.callCreateMethod(Component.java:1326)
  |    [testng]     at org.jboss.seam.Component.newInstance(Component.java:1316)
  |    [testng]     at org.jboss.seam.Component.getInstance(Component.java:1267)
  |    [testng]     at org.jboss.seam.Component.getInstance(Component.java:1257)
  |    [testng]     at 
org.jboss.seam.contexts.Lifecycle.startup(Lifecycle.java:125)
  |    [testng]     at 
org.jboss.seam.contexts.Lifecycle.endInitialization(Lifecycle.java:104)
  |    [testng]     at 
org.jboss.seam.init.Initialization.init(Initialization.java:199)
  |    [testng]     at org.jboss.seam.mock.SeamTest.init(SeamTest.java:321)
  |    [testng]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native 
Method)
  |    [testng]     at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  |    [testng]     at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |    [testng]     at java.lang.reflect.Method.invoke(Method.java:585)
  |    [testng]     at 
org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:529)
  |    [testng]     at 
org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:311)
  |    [testng]     at 
org.testng.internal.Invoker.invokeConfigurations(Invoker.java:149)
  |    [testng]     at 
org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:77)
  |    [testng]     at org.testng.TestRunner.privateRun(TestRunner.java:614)
  |    [testng]     at org.testng.TestRunner.run(TestRunner.java:505)
  |    [testng]     at org.testng.SuiteRunner.privateRun(SuiteRunner.java:221)
  |    [testng]     at org.testng.SuiteRunner.run(SuiteRunner.java:147)
  |    [testng]     at 
org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:576)
  |    [testng]     at org.testng.TestNG.runSuitesLocally(TestNG.java:539)
  |    [testng]     at org.testng.TestNG.run(TestNG.java:316)
  |    [testng]     at org.testng.TestNG.privateMain(TestNG.java:666)
  |    [testng]     at org.testng.TestNG.main(TestNG.java:608)
  |    [testng] Caused by: java.lang.NullPointerException
  |    [testng]     at 
com.robjsoftware.replog.ReplogApplication.init(ReplogApplication.java:40)
  |    [testng]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native 
Method)
  |    [testng]     at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  |    [testng]     at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java
  | :25)
  |    [testng]     at java.lang.reflect.Method.invoke(Method.java:585)
  |    [testng]     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:109)
  |    [testng]     at 
org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
  |    [testng]     at 
org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
  |    [testng]     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
  |    [testng]     at 
org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:57)
  |    [testng]     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
  |    [testng]     at 
org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
  |    [testng]     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
  |    [testng]     at 
org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
  |    [testng]     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
  |    [testng]     at 
org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
  |    [testng]     ... 47 more
You guessed it... same darn NullPointerException because entityManager is null.

What am I missing?  I have plain old POJOs in my session scope that I inject an 
EntityManager to in exactly the same way.  Why is this not working at 
application scope?

Maybe there's another way to do what I'm wanting to do here... basically, I 
want there to be some application component that maintains a list of 
"synchronizers", one synchronizer per Site entity that exists in the database.  
Perhaps I want a stateless component that extracts the list of sites, and then 
have the application component inject that SiteList and construct its 
synchronizers from that?  I'll try that next (but not tonight, it's 1 AM ;-).  
But it'd still be nice to know the theory behind why what I'm doing here isn't 
supported... or know what I'm doing wrong!

Thanks,
Rob

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3967418#3967418

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3967418
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to