I am trying to call a remote ejb from my application and getting error
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.RuntimeException: javax.naming.NameNotFoundException: CNTR4009E: The edu.osu.cse5234.ooth.business.view.InventoryService remote interface for the InventoryServiceBean enterprise bean in the OutOfTheHouse-EJB.jar module in the OutOfTheHouse-EJBEAR application could not be obtained for the java:global/OutOfTheHouse-EJBEAR/OutOfTheHouse-EJB/InventoryServiceBean!edu.osu.cse5234.ooth.business.view.InventoryService JNDI name because remote interfaces are not supported by any of the features configured in the server.xml file.
I found that we need to add
<featureManager>
<feature>ejbRemote-3.2</feature>
<feature>localConnector-1.0</feature>
</featureManager>
but I am not getting an option to add ejbRemote in my server.xml
.
What could be the reason?
Open server.xml, view in the Design mode (as opposed to Source mode), expand Server Configuration and click on Feature Manager. On the right side feature manager deatails will be listed. Click on Add. Add the following features:
ejblite-3.2
javaee-7.0
jndi-1.0
localConnnector-1.0
Additionally, make sure the EAR project is added to WAS liberty profile. Increase console log level to INFO (Server Manager --> Add --> Logging then edit console log level in the details window). The console output will spit out the JNDI name exactly as generated by the container. Copy paste into ServiceLocator code.
I get this error as soon as I enable features "webProfile-7.0" or "javaee-7.0". These features load other features and it seems that one of them prevents the EJB from being bound. Also there is no log entry containing the JNDI name in this case. To solve this issue I just enable the features I really need (servlet-3.1, localConnector-1.0, ejbLite-3.2, ejbRemote-3.2, jsp-2.3 in my case). This also speeds up server start.
The problem was with the version of liberty profile I was using. I used a different one and I was able to add javaee-7.0 as feature and after that it worked fine.