Eddy
Eddy

Reputation: 1822

Is there something like the Weblogic filtering classloader for Websphere

I'd like to use something like the Filtering Classloader to prevent specific packages from creeping into the application context and becoming visible to Spring.

Changing the classloader order causes all sorts of nasty problems so I´d like to try this route.

Is it possible to achieve this with Websphere 6? If not, can I replace my own application classolader and implement the filter myself?

Upvotes: 1

Views: 589

Answers (3)

Lonzak
Lonzak

Reputation: 9816

I was just about to post the same question. But the answer was quite unsatisfying. I however checked the request from Petr H at the IBM developerworks and IBM did implement this feature (Huge thanks Petr!):

"WebSphere Application Server V8.5.5.7 (=Fixpack 7) gained the ability to prevent packages from the server classloader being visible to applications. This was delivered in the document "ISOLATE DEPLOYED ARTIFACTS FROM OSS PACKAGES" and is documented in 'Isolating open source software packages'.

The supplied links describe the mechanism by configuring always-protected packages. You basically have to do the following:

  1. Under Server Infrastructure on the server settings page in the administrative console, click Java and process management > Process definition.
  2. Select Java virtual machine.
  3. Define the following system properties in the JVM generic arguments section as follows: -Dcom.ibm.ws.classloader.server.alwaysProtectedPackages=org.bouncycastle. Please not that the final dot "." is really important otherwise everything will be ignored! Several packages can be added by comma ","
  4. Click Apply, OK and save the changes. Make sure that a file synchronization is done before you restart the servers. Restart WebSphere Application Server for the changes to take effect.
  5. Examine the native_stdout.log and find the system properties that are previously defined. For example, when you specify always-protected package org.bouncycastle., statements such as the following might appear: ProtectionMetaData.clinit: system property: com.ibm.ws.classloader.server.alwaysProtectedPackages=org.bouncycastle.

Upvotes: 0

Petr H
Petr H

Reputation: 460

bkail's answer is right, WAS doesn't have such feature even in its latest public version (8.5.5).

I just created a RFE requesting such feature so whoever is interested in this, please vote for it which may increase the possibility of this being implemented: http://www.ibm.com/developerworks/rfe/execute?use_case=viewRfe&CR_ID=43936 (IBM ID required)

In the meantime, you may use isolated shared libraries to override any particular classes (the above mentioned class loading order control - like parent_last - is too rough as it affects the class loading order of the whole application or module) Create a shared library with desired jars on the classpath, configure it as isolated shared library, reference it from the deployed application (or module). See here for complete documentation http://pic.dhe.ibm.com/infocenter/wasinfo/v8r5/topic/com.ibm.websphere.base.doc/ae/tcws_sharedlib.html

Upvotes: 1

Brett Kail
Brett Kail

Reputation: 33956

There is no such filtering mechanism in WebSphere, and there is no way to replace the application class loader. You'll have to use PARENT_LAST to override classes, sorry.

Upvotes: 1

Related Questions