I stumbled on a bug in Payara Embedded. The deployment on a running, non-embedded, server works. If I add 2 WAR files to one EAR and deploy that EAR file, the deployment fails.
I debugged the error to the GlassfishNamingManagerImpl#lookup(String, String, Context) method, there it looks in my "MyApp" WAR for a class which is part of my "Hub" WAR, resulting in an exception. Debugging shows me that the first lookup works, because it uses the componentId "BackendIntegrationTestsAllInOne_/hub", which searches correctly in the "Hub" WAR. Later it fails when using the componentId "BackendIntegrationTestsAllInOne_/app", which searches wrongfully in the "MyApp" WAR. The reason may be that I include a Module named "Logic" in both WARs - which was and still is never a problem for years (!) on a normal server.
The bug seems to happen in complicated setups and my code is closed source, so it's problematic to upload code or make a simple example.
But I hope someone has an idea and tells me that I could avoid triggering that bug.
My glassfish-application.xml looks like this, is there the possiblity to change something?:
<glassfish-application>
<module>
<!-- Hub -->
<web>
<!-- Class of Hub WAR searched: Found -->
<web-uri>Hub-${project.version}.war</web-uri>
<context-root>/hub</context-root>
</web>
<!-- MyApp -->
<web>
<!-- Class of Hub WAR searched: Not found -->
<web-uri>MyApp-${project.version}.war</web-uri>
<context-root>/app</context-root>
</web>
<web>
<web-uri>Monitor-${project.version}.war</web-uri>
<context-root>/monitor</context-root>
</web>
</module>
</glassfish-application>
The exception is java.lang.IllegalStateException: Exception attempting to inject Remote ejb-ref name=de.hub.receive.filter.ErrorFilter/logService,Remote 3.x interface =de.service.logmessage.LogMessageService resolved to intra-app EJB LogMessageBean in module Logic-1.3.4.0-SNAPSHOT.jar,ejb-link=Logic-1.3.4.0-SNAPSHOT.jar#LogMessageBean,lookup=,mappedName=,jndi-name=java:global/BackendIntegrationTestsAllInOne/Logic/LogMessageBean,refType=Session into class de.hub.receive.filter.ErrorFilter: Lookup failed for 'java:comp/env/de.volkswagen.carsharing.hub.receive.filter.ErrorFilter/logService' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming}
Any ideas how to circumvent this bug?