How to set WebSphere class loader policy for PARENT_LAST for an application created in Eclipse?

Our company currently uses RAD to develop our Java applications, but we are committed to moving to Eclipse using WebSphere Developer Tools. The pilot for our transition is going well, except that we are faced with a classloader policy problem for new applications that are originally created in Eclipse, not RAD. Our projects that were originally created by RAD were deployed with the correct class loader policy (PARENT_LAST) when publishing through Eclipse, because we originally used the deployment descriptor editor in RAD, which set the correct class loader policy in /src/main/application/META-INF/ibmconfig/cells/defaultCell/applications/defaultApp/deployments/defaultApp/deployment.xml . But now with the help of Eclipse and WebSphere Developer Tools, we no longer have a good Deployment descriptor editor interface for creating or modifying this file for us (apparently it is not included in the WDT plugin ).

So now my question is the best way to configure this classloader policy? We still need new applications to install the PARENT_LAST classloader policy when we deploy them to our local servers. Our team knows a little about this, and at the moment we can see 4 options.

  • Open the admin console after each publication and change it. That would be a huge pain and to a large extent is not a real option.
  • Change the server profile setting to use the PARENT_LAST class loader policy for all applications. However, this does not apply to all applications in our company and will not work for all groups.
  • Run the jython script after each post to set the class loader policy. This is slightly better than option 1, but not by much.
  • Manually create the deployment.xml file in the same place as other applications created by RAD, with the same structure as the deployment.xml files created by RAD, and modify them as necessary for each application.

Option 4 is apparently the best of the many, but it is still a manual process and somewhat error prone. Even if most of our developers will be able to evaluate this approach for new applications, it would be ideal if it were a simple one-click button click process.

So, given the fact that IBM omitted the deployment descriptor editor from the WDT plugin, it would seem that option 4 is our only hope, but I will ask again if there is another better way to install the WebSphere class loader policy for PARENT_LAST for the application when application created in Eclipse? Any help is appreciated, thanks.

+6
source share
3 answers

Well, Eclipse is free, and Rational Application Developer costs about $ 5,000 a year (per developer). A good deployment editor (which wasn’t so enjoyable. It usually includes all kinds of things that are not needed. Who needs this Derby DataSource defined there?) Is one of the things you should give up on saving tons of cash on annual basis.

I'm distracted.

Option (1) is a complete no-no. You do not want to rely on manual steps for deployment; You should aim for automatic deployment as much as possible.

Option (2) can do. I'm not sure what flavor of WebSphere you are using, but if you are using the Network Deployment edition, you can create a WebSphere topology consisting of several servers and clusters. Theoretically, you could come up with a topology in which PARENT_LAST applications run on a specific server (or cluster) and PARENT_FIRST applications running on another server (or cluster).

You can combine option (2) with the technical initiative so that all your applications work with PARENT_LAST . This is the recommended approach if your application uses popular third-party libraries that WebSphere also uses for its internal purposes. For example, if you use Commons Lang, you are already advised to switch to PARENT_LAST , because WebSphere uses its own internal copy of Commons Lang, which may conflict with yours.

Option (3) is, of course, better than option (1), but not necessarily worse than option (2), if you can get the WebSphere topology correctly.

Option (4) is harder to implement, but I think this is the best approach overall:

  • This is a one-time setup for each EAR (and for each WAR that exists in the EAR).
  • After that, deployment can be easily automated, as no additional steps are required.
  • If you work with a local test environment to test your code and quickly publish applications from your workspace to a local test environment, then this approach is the only approach (except option (2)) that will work for you without additional manual work.

If no one works ... think about paying $ 5,000 a year (for each user) and getting option (5) - use the IBM editor. Or, better ... hire someone to create an Eclipse plugin that does this for you. No more than a week or two to develop.

+2
source

The last answer is helpful.

Go to the WAS console and select the application; Example:

Enterprise Applications> my_application_ear> class loader And change the "class loader order and WAR class loader policy"

+1
source

Open the admin console on the eclipse click server -> your server -> scroll down and under the server infrastructure -> java process control select the loader class -> select a new one, you can change it here

0
source

Source: https://habr.com/ru/post/970110/


All Articles