Re: Stateless bean injection fails during application server startup

Thomas Butz <[email protected]> Tue, 22 Jul 2025 13:28:14 +0200
Newsgroups gmane.comp.java.openejb.user
Message-ID <[email protected]>
As for the additional details, the chain of events begins with a=20
singleton bean annotated with @Startup that sends messages to a JMS 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.poolP=
op()"=20
>> because "data" is null
>> at=20
>> org.apache.openejb.core.stateless.StatelessInstanceManager.getInstance=
(StatelessInstanceManager.java:218)=20
>> ~[?:?]
>> at=20
>> org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessC=
ontainer.java:204)=20
>> ~[?:?]
>> at=20
>> org.apache.openejb.core.ivm.EjbObjectProxyHandler.synchronizedBusiness=
Method(EjbObjectProxyHandler.java:265)=20
>> ~[?:?]
>> at=20
>> org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(EjbOb=
jectProxyHandler.java:260)=20
>> ~[?:?]
>> at=20
>> org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(EjbObjectPro=
xyHandler.java:89)=20
>> ~[?:?]
>> at=20
>> org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHan=
dler.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.java=
:92)=20
>> ~[?:?]
>> at=20
>> java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Direc=
tMethodHandleAccessor.java:103)=20
>> ~[?:?]
>> at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[?:?]
>> at=20
>> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invoca=
tion.invoke(ReflectionInvocationContext.java:210)=20
>> ~[?:?]
>> at=20
>> org.apache.openejb.core.interceptor.ReflectionInvocationContext.procee=
d(ReflectionInvocationContext.java:191)=20
>> ~[?:?]
>> at=20
>> org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor=
.java:191)=20
>> ~[?:?]
>> at=20
>> org.apache.openejb.monitoring.StatsInterceptor.invoke(StatsInterceptor=
.java:101)=20
>> ~[?:?]
>> at=20
>> java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Direc=
tMethodHandleAccessor.java:103)=20
>> ~[?:?]
>> at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[?:?]
>> at=20
>> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invoca=
tion.invoke(ReflectionInvocationContext.java:210)=20
>> ~[?:?]
>> at=20
>> org.apache.openejb.core.interceptor.ReflectionInvocationContext.procee=
d(ReflectionInvocationContext.java:191)=20
>> ~[?:?]
>> at=20
>> org.apache.openejb.core.interceptor.InterceptorStack.invoke(Intercepto=
rStack.java:95)=20
>> ~[?:?]
>> at=20
>> org.apache.openejb.core.mdb.MdbContainer._invoke(MdbContainer.java:536=
)=20
>> ~[?:?]
>> at=20
>> org.apache.openejb.core.mdb.MdbContainer.invoke(MdbContainer.java:510)=
=20
>> ~[?:?]
>> at=20
>> org.apache.openejb.core.mdb.AbstractEndpointHandler.deliverMessage(Abs=
tractEndpointHandler.java:115)=20
>> ~[?:?]
>> at=20
>> org.apache.openejb.core.mdb.EndpointHandler.deliverMessage(EndpointHan=
dler.java:28)=20
>> ~[?:?]
>> at=20
>> org.apache.openejb.core.mdb.AbstractEndpointHandler.invoke(AbstractEnd=
pointHandler.java:81)=20
>> ~[?:?]
>> at=20
>> org.apache.openejb.core.mdb.EndpointHandler.invoke(EndpointHandler.jav=
a:28)=20
>> ~[?:?]
>> at=20
>> de.optitool.bean.export.AsyncExportBean$$LocalBeanProxy.onMessage(de/o=
ptitool/bean/export/AsyncExportBean.java)=20
>> ~[?:?]
>> at=20
>> org.apache.activemq.ra.MessageEndpointProxy$MessageEndpointAlive.onMes=
sage(MessageEndpointProxy.java:123)=20
>> ~[?:?]
>> at=20
>> org.apache.activemq.ra.MessageEndpointProxy.onMessage(MessageEndpointP=
roxy.java:64)=20
>> ~[?:?]
>> at org.apache.activemq.ActiveMQSession.run(ActiveMQSession.java:1056)=20
>> ~[?:?]
>> at=20
>> org.apache.activemq.ra.ServerSessionImpl.run(ServerSessionImpl.java:17=
0)=20
>> ~[?:?]
>> at=20
>> org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.jav=
a:365)=20
>> ~[?:?]
>> at=20
>> org.apache.geronimo.connector.work.pool.NamedRunnable.run(NamedRunnabl=
e.java:32)=20
>> ~[?:?]
>> at=20
>> java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPool=
Executor.java:1144)=20
>> ~[?:?]
>> at=20
>> java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo=
lExecutor.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 @EJB=
.
>>
>> 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