Re: Stateless bean injection fails during application server startup

Thomas Butz <[email protected]> Tue, 22 Jul 2025 14:34:52 +0200
Newsgroups gmane.comp.java.openejb.user
Message-ID <dd4ac33d-0848-47c5-b9fb-56fb74106a10__31830.4631322221$1753187705$gmane$org@optitool.de>
I fear that this is just another offshoot of=20
https://issues.apache.org/jira/browse/TOMEE-4485


Thomas Butz:
> As for the additional details, the chain of events begins with a=20
> singleton bean annotated with @Startup that sends messages to a JMS=20
> topic.
>
> Deferring the message sending (tested with a TimerService) seems to be=20
> enough to avoid triggering the problem.
>
> I can try to come up with a reproducer, but it is unlikely that I will=20
> succeed, as our current stack is quite complex. However, please feel=20
> free to ask any questions or tell me how I can provide the necessary=20
> debug information.
>
>
>
> Richard Zowalla:
>> Hi,
>>
>> It seems that the information provided isn't sufficient to determine=20
>> the root cause.
>> Would you be able to share a reproducer or additional details?
>>
>> Gru=C3=9F
>>
>> Richard
>>
>>
>>> Am 21.07.2025 um 10:23 schrieb Thomas Butz <[email protected]=
>:
>>>
>>> Hi, I'm currently struggling with a potential bug in TomEE 10.1.0.=20
>>> The problem seems to be triggered by the early injection of a=20
>>> stateless EJB during server startup.
>>> This results in a cascade of NPEs for subsequent stateless EJB=20
>>> injections.
>>>
>>> This is the first exception that can be observed during the startup=20
>>> phase:
>>>
>>> java.lang.NullPointerException: Cannot invoke=20
>>> "org.apache.openejb.core.stateless.StatelessInstanceManager$Data.pool=
Pop()"=20
>>> because "data" is null
>>> at=20
>>> org.apache.openejb.core.stateless.StatelessInstanceManager.getInstanc=
e(StatelessInstanceManager.java:218)=20
>>> ~[?:?]
>>> at=20
>>> org.apache.openejb.core.stateless.StatelessContainer.invoke(Stateless=
Container.java:204)=20
>>> ~[?:?]
>>> at=20
>>> org.apache.openejb.core.ivm.EjbObjectProxyHandler.synchronizedBusines=
sMethod(EjbObjectProxyHandler.java:265)=20
>>> ~[?:?]
>>> at=20
>>> org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(EjbO=
bjectProxyHandler.java:260)=20
>>> ~[?:?]
>>> at=20
>>> org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(EjbObjectPr=
oxyHandler.java:89)=20
>>> ~[?:?]
>>> at=20
>>> org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHa=
ndler.java:349)=20
>>> ~[?:?]
>>> at jdk.proxy17/jdk.proxy17.$Proxy272.doMasterDataExport(Unknown=20
>>> Source) ~[?:?]
>>> at=20
>>> de.optitool.bean.export.AsyncExportBean.handleMessage(AsyncExportBean=
.java:176)=20
>>> ~[?:?]
>>> at=20
>>> de.optitool.bean.export.AsyncExportBean.onMessage(AsyncExportBean.jav=
a:92)=20
>>> ~[?:?]
>>> at=20
>>> java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Dire=
ctMethodHandleAccessor.java:103)=20
>>> ~[?:?]
>>> at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[?:?]
>>> at=20
>>> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invoc=
ation.invoke(ReflectionInvocationContext.java:210)=20
>>> ~[?:?]
>>> at=20
>>> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proce=
ed(ReflectionInvocationContext.java:191)=20
>>> ~[?:?]
>>> at=20
>>> org.apache.openejb.monitoring.StatsInterceptor.record(StatsIntercepto=
r.java:191)=20
>>> ~[?:?]
>>> at=20
>>> org.apache.openejb.monitoring.StatsInterceptor.invoke(StatsIntercepto=
r.java:101)=20
>>> ~[?:?]
>>> at=20
>>> java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Dire=
ctMethodHandleAccessor.java:103)=20
>>> ~[?:?]
>>> at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[?:?]
>>> at=20
>>> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invoc=
ation.invoke(ReflectionInvocationContext.java:210)=20
>>> ~[?:?]
>>> at=20
>>> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proce=
ed(ReflectionInvocationContext.java:191)=20
>>> ~[?:?]
>>> at=20
>>> org.apache.openejb.core.interceptor.InterceptorStack.invoke(Intercept=
orStack.java:95)=20
>>> ~[?:?]
>>> at=20
>>> org.apache.openejb.core.mdb.MdbContainer._invoke(MdbContainer.java:53=
6)=20
>>> ~[?:?]
>>> at=20
>>> org.apache.openejb.core.mdb.MdbContainer.invoke(MdbContainer.java:510=
)=20
>>> ~[?:?]
>>> at=20
>>> org.apache.openejb.core.mdb.AbstractEndpointHandler.deliverMessage(Ab=
stractEndpointHandler.java:115)=20
>>> ~[?:?]
>>> at=20
>>> org.apache.openejb.core.mdb.EndpointHandler.deliverMessage(EndpointHa=
ndler.java:28)=20
>>> ~[?:?]
>>> at=20
>>> org.apache.openejb.core.mdb.AbstractEndpointHandler.invoke(AbstractEn=
dpointHandler.java:81)=20
>>> ~[?:?]
>>> at=20
>>> org.apache.openejb.core.mdb.EndpointHandler.invoke(EndpointHandler.ja=
va:28)=20
>>> ~[?:?]
>>> at=20
>>> de.optitool.bean.export.AsyncExportBean$$LocalBeanProxy.onMessage(de/=
optitool/bean/export/AsyncExportBean.java)=20
>>> ~[?:?]
>>> at=20
>>> org.apache.activemq.ra.MessageEndpointProxy$MessageEndpointAlive.onMe=
ssage(MessageEndpointProxy.java:123)=20
>>> ~[?:?]
>>> at=20
>>> org.apache.activemq.ra.MessageEndpointProxy.onMessage(MessageEndpoint=
Proxy.java:64)=20
>>> ~[?:?]
>>> at=20
>>> org.apache.activemq.ActiveMQSession.run(ActiveMQSession.java:1056)=20
>>> ~[?:?]
>>> at=20
>>> org.apache.activemq.ra.ServerSessionImpl.run(ServerSessionImpl.java:1=
70)=20
>>> ~[?:?]
>>> at=20
>>> org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.ja=
va:365)=20
>>> ~[?:?]
>>> at=20
>>> org.apache.geronimo.connector.work.pool.NamedRunnable.run(NamedRunnab=
le.java:32)=20
>>> ~[?:?]
>>> at=20
>>> java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoo=
lExecutor.java:1144)=20
>>> ~[?:?]
>>> at=20
>>> java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPo=
olExecutor.java:642)=20
>>> ~[?:?]
>>> at java.base/java.lang.Thread.run(Thread.java:1583) [?:?]
>>>
>>>
>>> The AsyncExportBean is a message-driven bean which tries to invoke=20
>>> the "doMasterDataExport()" of a local stateless EJB injected with @EJ=
B.
>>>
>>> I quickly skimmed through the StatelessInstanceManager code, and it=20
>>> doesn't seem to expect BeanContext.getContainerData() to return a=20
>>> null value.
>>>
>>
--=20
Mit freundlichen Gr=C3=BC=C3=9Fen / Best regards


Thomas Butz

_______________________________

OPTITOOL GmbH
Im Gewerbepark D 85
D - 93059 Regensburg

Phone: +49-941-59578-14