org.jboss.as.naming.InitialContextFactory doesn't work in Wildfly 27

200 views
Skip to first unread message

Arkady Zelekman

unread,
Feb 26, 2023, 8:44:21 AM2/26/23
to WildFly
Hello, team

We are trying to switch Wildfly version from 23 to 27.

We have A LOT of legacy code which runs INSIDE wildfly server and tries to do jndi-connection to controller beans via InitialContext in following way:

1. Create InitialContext  object with following properties:

{java.naming.provider.url=http://localhost/wildfly-services, java.naming.factory.initial=org.jboss.as.naming.InitialContextFactory, java.naming.factory.url.pkgs=org.jboss.as.naming.interfaces}

2. 
Object objrefinitialContext.lookup("java:global/NMS/config/PublicConfigurationControllerBean!com.allot.nms.configuration.management.ejb.PublicConfigurationControllerInternal");

Object remoteHome = PortableRemoteObject.narrow(objref, com.allot.nms.configuration.management.ejb.PublicConfigurationControllerInternal);

Call remoteHome.someFunction()

I get exception of "javax.naming.NameNotFoundException: NMS/config/PublicConfigurationControllerBean!com.allot.nms.configuration.management.ejb.PublicConfigurationControllerInternal"


It worked fine in Widfly 23. Should it work also in Wildfly 27 ?

Any help will be appreciated.


Thanks,

Arkady


Arkady Zelekman

unread,
Feb 27, 2023, 2:53:50 AM2/27/23
to WildFly
Is there a programmatic way to access ejb-resources from internal code inside wildfly server without using @EJB annotation ?
Reply all
Reply to author
Forward
0 new messages