Replace a lib in Websphere 8.5 causes NoClassDefFoundError

1.9k views Asked by At

For various reasons that temporarily stop me from doing a complete recompile and redeploy, I want to hot-swap a .jar library on an application in Websphere. I want to replace the library xyz-1.7.jar with a previous version number, xyz-1.4.jar.

I located the .jar file in

/AppServer/profiles/$AppServer/installedApps/$Cell/$App.ear/

and replaced it with a previous version, and then restarted the server using

./startServer.sh $myServer

Once it was up and running, I logged in to the app to find it throwing NoClassDefFoundErrors.

I enabled the Class Loading Trace setting in Websphere and discovered that neither version of the .jar lib is being loaded.

Have I changed the .jar lib in the correct place?

I know from some experience in Tomcat and JBoss, I would need to modify the unexploded .ear file instead of the exploded deployed directory, but Websphere is new to me. Is it possible to do what I'm attempting?

1

There are 1 answers

0
trikelef On

First check from console that the setting "Enterprise Applications > Appname > Class loading and update detection > Reload classes when application files are updated" is enabled and Polling interval for updated files is set to a positive value.

If not enable it and restart the application.

Then you can update the jar inside installedApps taking care about read file permissions.

However why don't you use "Replace or add a single file" as an Update option from WAS console? Just enter the relative path of the jar inside your EAR inside "Specify the path beginning with the installed application archive file to the file to be replaced or added" text filed and you are done.