In a WildFly-project, I have a big WAR-File (about 100 MB) which contains the whole application in JAR-Files (EJBs, GUI, Web Services etc)
In this WAR, there are some Functions which implement a custom Function
interface (there are also other classes like AbstractFunction
and so on). Now I would like to extend the application with user-provided functions (they should be on the class path which can then be accessed by the application.
The problem is that I can't deploy the functions before the main WAR because Function
, AbstractFunction
etc. are the the WAR which is not yet deployed.
Adding a WildFly module with the functions fails for the same reason.
One possibility would be to restructure the WAR file so that Function
, AbstractionFunction
are in an own jar which is deployed separately. Unfortunately, this would be a major refactoring which is not possible at the time being.
So is the only (simple) possibility to put the user-defined functions in a JAR into the WAR-file?
You can deploy user code as independent jar/war with EJB. EJB implements Function
. Main module can lookup and find them through JNDI. Also you have to make common classes like Function
and DTO available for user modules and for main war. The simplest way is share classes from main war. You can add META-INF/jboss-deployment-structure.xml to client modules:
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<deployment>
<dependencies>
<module name="deployment.main.war"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
PS
I have similar project with structure:
In my core.war I have code like:
Plugin srv = (Plugin) new InitialContext().lookup(jndi);
And my plugin looks like:
@Stateless
public class UserPlugin implements Plugin
JNDI looks like java:global/user-plugin/UserPlugin
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.