4

I have been investigating using WebSphere's Liberty profile as a light weight alternative to having a fully fledged WebSphere instance deployed on my local machine (late to the party, I know).

1 thing that I can not figure out:

How do I set Parent Last class loading to be default? I want to deploy any application and have it automatically be parent last.

I am aware that I can deploy an EAR with the deployment.xml to trigger parent last class, or run a Jython script. However, I would rather have it be the default behavior.

Any ideas anyone?

WebSphere Version: Liberty 8.5.5.8

dooffas
  • 474
  • 9
  • 18
  • I'm interested to know why you need to do this at all – Steve C Feb 12 '16 at 22:18
  • The application I am running on WebSphere 8.5.5.4 requires JAX-RS 2. WebSphere ships a JAX-RS 1 implementation which is not compatible. So, I am bundling the required JARs in the WAR and setting parent last. The reason I want it to be default is, I am automatically deploying the application to a Liberty profile within a Docker container. All the applications I may deploy can be parent last and I want the Docker image to be generic. – dooffas Feb 13 '16 at 11:22
  • Unless you've explicitly enabled the jaxrs-1.0 feature in your server.xml (or a feature which includes it, like webProfile), the jaxrs classes will not be loaded by the Liberty server, so they won't be exposed to your application. – Holly Cummins Feb 14 '16 at 14:07
  • 1
    WebSphere Liberty 8.5.5.8 is Java EE 7 and therefore you should have JAX-RS 2.0 for free. If you are in fact using 8.5.5.4 then upgrading will be a much better idea. – Steve C Feb 14 '16 at 23:32

1 Answers1

3

If you're trying to set parent-last classloading in Liberty because you had to do so in WebSphere Application Server traditional to resolve library conflicts, you should first try the application on Liberty without changing it's configuration because Liberty was designed to avoid those types of conflict. If, after that, you're still inclined to change the configuration, while you can't set it as the default, you can do something like this in your server.xml:

<enterpriseApplication location="myApp.ear" name="MyApp">
    <classloader delegation="parentLast"/>
</enterpriseApplication>
F Rowe
  • 2,042
  • 1
  • 11
  • 12
  • Note that this will set parentLast delegation for both your application and the web modules within your application. There's currently no way to set it for one but not the other in Liberty. – Azquelt Feb 12 '16 at 17:24