I have an application ear-file which contains multiple warfiles.
One of these modules is using JPA library which version is different from what Liberty contains. Because of this I have to configure the application in Liberties server.xml
to use "parentLast" classloader:
<application id="app" name="app" type="ear" location="app.ear">
<classloader delegation="parentLast" />
</application>
Now there is another module in the same ear-file which doesn't work with "parentLast" classloader. Unfortunately the upper classloader configuration applys to all modules in the ear-file.
In the old Websphere 8.5. I could configure different classloader behaviour for each module by adding a file deployment.xml
in a special sub-folder oth the ear-file. Unfortunately this doesn't seem to work in Liberty any more.
Is it also possible in Websphere Liberty to configure the classloader for each module in an ear-file separately so that one module uses "parentLast" and another "parentFirst" classloader?
The content of the ear-file looks like this:
app.ear
|--> META-INF
|--> application.xml
|--> app1.war
|--> app2.war
That WAS traditional configuration option does not exist in Liberty - class loader settings, including delegation mode, are all contained at the application level.
Based on your statement here, though, I think there may be a much simpler option:
One of these modules is using JPA library which version is different from what Liberty contains
The Liberty server was designed to require much less usage of parent-last class loading delegation than was often necessary in WAS traditional. In your case, the simplest solution is probably just to disable the JPA component in the Liberty server - unlike in the traditional server, disabling the component completely removes its classes from visibility to the server JVM, so you don't have to do any class loader configuration for your application to use its own copy of JPA.