My ear
contains one EJB module and one Web module. One singleton EJB within the EJB module has a String field annotated with @Resource
:
@Resource(name = "lecmConfigServiceLookupName")
private String lecmConfigServiceLookupName;
The META-INF/ejb-jar.xml specifies a mapping for this environment entry:
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd"
version="3.1">
<enterprise-beans>
<session id="ConfigSingleton">
<ejb-name>ConfigSingleton</ejb-name>
<ejb-class>ru.brbpm.custom_search_ejb.ConfigSingleton</ejb-class>
<session-type>Singleton</session-type>
<init-on-startup>true</init-on-startup>
<env-entry>
<env-entry-name>lecmConfigServiceLookupName</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>ejb/lecm/common-service.jar/ConfigServiceImpl#ru.brbpm.lecm.shared.api.ConfigServiceRemote</env-entry-value>
</env-entry>
</session>
</enterprise-beans>
</ejb-jar>
When I get to deploying the ear to WebSphere 8.5.5.3 I see two identical environment entries - one for the EJB module and the other for the Web module:
The entry for the web module also does not have the default value and adding an ejb-jar.xml to WEB-INF folder does not help.
How do I get rid of the environment entry for the Web module or at least provide it with a default value? As long as the entry for the Web module is not specified the application will not start.
Figured it out - turns out the Web module had an unnecessary transitive dependency on the ejb-client
of the EJB module. WebSphere was detecting the EJBs in the the ejb-client.jar that was in the Web module's WEB-INF/lib.