Spring cannot find jar outside EAR - WebSphere community edition

817 Views Asked by At

I have an ear deployed to WebSphere Application Server Community Edition which uses spring to load different interfaces. For production all those classes are loaded inside the ear. I'm trying to override those classes with another class in a jar outside the EAR.

I placed my jar in /var/shared/lib and have a deployment dependency which I thought would include those folder's into the classpath:

<sys:dependencies>
<sys:dependency>
<sys:groupId>org.apache.geronimo.configs</sys:groupId>
<sys:artifactId>sharedlib</sys:artifactId>
</sys:dependency>
</sys:dependencies>

What am I missing? The spring results in a NoClassDef stating the class cannot be found.

1

There are 1 best solutions below

0
On

Websphere has a shared library feature. Add your jar in shared library and then add that library in your application usin websphere admin console.

Using shared libraries at the application level
To define a shared library named VersionCheckerV2_SharedLib and associate it 
to our ClassloaderTest application, do the following steps:
1. In the administrative console, select Environment → Shared Libraries.
2. Select the scope at which you want this shared library to be defined, such as 
Cell, and click New

To add

Select Applications → Application Types→ WebSphere enterprise 
applications.
6. Select the ClassloadersExample application.
7. In References, select Shared library references.
8. Select AppName in the Application row.
9. Click Reference shared libraries.
10.Select the VersionCheckerV2_SharedLib and click the >> button to move it 
to the Selected column

Use shared library for this task. Use this book for guidence.