I have an ear with 2 .war files.
In war #1, under WEB-INF/classes/com/my there is a BatchTriggerBuildServlet.class
In war #2 i have the following in its web.xml (in its WEB-INF) (a reference to a class in war #1):
<web-app id="WebApp">
<!-- other stuff -->
<servlet>
<servlet-name>BatchTriggerBuildServlet</servlet-name>
<display-name>BatchTriggerBuildServlet</display-name>
<servlet-class>com.my.BatchTriggerBuildServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>BatchTriggerBuildServlet</servlet-name>
<url-pattern>/BatchTriggerBuildServlet</url-pattern>
</servlet-mapping>
<!-- other stuff -->
</web-app>
This is deployed in Wildfly 10. I also have a jboss-deployment-structure.xml in the META-INF folder of the containing .ear containing the following:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<!-- Make sub deployments NOT isolated by default, so they can see each others classes without a Class-Path entry -->
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
</jboss-deployment-structure>
Is this legitimate? Because I'm getting a ClassNotFoundException for the above class when i try to deploy the ear, along with the message that it
"Failed to start service ... from [Module "<my ear name>.<my war #2 name>:main" from Service Module Loader]"
Is there a way to get this to work? thanks in advance.
ear-subdeployments-isolated
does not apply to web modules, which are always isolated from each other. See Class Loading in WildFly.
Try moving the classes and their dependencies into a jar in the EAR/lib directory.