How to invoke EJB from custom JMX MBEAN? (Doc ID 989655.1)

Last updated on JUNE 09, 2016

Applies to:

Oracle Weblogic Server - Version 9.2 to 10.3
Information in this document applies to any platform.

Goal

On invoking an EJB Stateless bean from JMX MBEAN results in the below exception:

java.lang.ClassCastException: Cannot narrow remote object weblogic.rmi.internal.CollocatedRemoteRef - hostID: '229378190
0966588767S::jmx_ejb_test:AdminServer', oid: '286', channel: 'null' to examples.ServiceHome
at weblogic.corba.server.naming.ReferenceHelperImpl.narrow(ReferenceHelperImpl.java:206)


From a standalone client the same code works fine.
The thread that is created by JMX for the call (possible RMI thread) is missing the context that exists in servlet thread.


JConsole ------>MBean-------->Invokes Stateless Session Bean

1) Invoke EJB stateless session bean from JMX MBean that is located on the same app server.
2) JMX MBean to be invoked from a JMX client via JConsole, from Sun.

Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms