I have a couple of issues relating to JNDI lookups I am currently trying to resolve and would be most grateful for any expert input on (disclaimer: I am fairly new to EJBs / J2EE).
Using Wildfly-9.0.0.Final, Java 8, Spring-4.1.6
| -- main-module.war
| -- service-provider.jar
First I have the following reference in jbossws-cxf.xml in main-module.war:
<jee:local-slsb id="myEndpointEjb" jndi-name="java:global/my_application/my_ejb_module/MyEndpointEJB" business-interface="com.test.MyEndpointSPI" resource-ref="false" />
with MyEndpointEJB being packaged in service-provider.jar. Most of the time this is fine, but in certain situations (it seems to be mostly on slower systems, e.g. running under a VM or docker container) the deployment will fail with javax.naming.NameNotFoundException trying to look up java:global/my_application/my_ejb_module/MyEndpointEJB.
The logs show:
(MSC service thread 1-1 ) - - [as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor ] INFO - JNDI bindings for session bean named MyEndpointEJB in deployment unit subdeployment "service-provider.jar" of deployment "my_application.ear" are as follows: java:global/my_application/service-provider/MyEndpointEJB!com.test.MyEndpointSPI java:app/service-provider/MyEndpointEJB!com.test.MyEndpointSPI java:module/MyEndpointEJB!com.test.MyEndpointSPI java:global/my_application/service-provider/MyEndpointEJB java:app/service-provider/MyEndpointEJB java:module/MyEndpointEJB
well before the deployment fails. Should that not mean those JNDI bindings are available from that point on? What sort of timing issue could be causing that behavior? (I want to avoid going down the road of using initialize-in-order in application.xml)
The other issue is that I had hoped to avoid the dependency on the name of the ear file by switching to use java:app/service-provider/MyEndpointEJB as the JNDI reference instead, but doing this causes the deployment to consistently fail with the same error as above (i.e. it can't find that binding). What have I missed? I am trying to ascertain whether this is more a wildfly configuration issue or something to do with Spring.
Any help would be most appreciated.