1

I have a legacy application (EAR) that is decades old, based on WebSphere Application Server 9.0 (WAS). It has moved across different development teams to reach us for further development and support.

We get minimal support requests where we hardly do any code changes and deploy, but now all of a sudden we have received ticket that requires changes in the code. The changes are in 4 files

  • 1 .xhtml
  • 2 .java
  • 3 .properties

We do not have the setup to build the EAR but we are able to build the .class files.

Can someone advice on how to go about replacing just these files? What are the caveats that should be taken care of while doing such partial updates?

We have done a JSP file update earlier, replacing the xhtml should be easy. Wondering about caveats while replacing the .class files and .properties files.

nitinsj
  • 11
  • 3

2 Answers2

1

Short-Term Solution: An EAR application is just a compressed directory (like a .zip file). If you just need to do this once and you are making minor changes then the short-term solution would be to replace .class, .xhtml and .property files; unzip the application, replace the files, and rezip with the .ear extension.

Long-Term Solution: Making changes to the java components will be harder since you need to make sure whatever you change interoperates with what already exists. The long-term solution would be to get the source code and import it into a maven/gradle project. Both maven and gradle have plugins that will build and package your application as an EAR.

KyleAure
  • 465
  • 4
  • 15
  • Thanks for the answer. We are exploring the Short Term Solution currently as the Application is been planned to sunset in coming year. Hoping that unpacking, updating and then packing the ear file to deploy again causes no problems. – nitinsj Feb 24 '23 at 16:12
1

You can get EAR file via WebSphere admin console, with the export EAR option. Then you could use tool for managing archives, e.g. Total Commander to replace specific files. And finally redeploy the updated EAR.

You have to be careful, if you manually replaced files (jsps) on the deployed application without the install/update process, they will not be in the exported ear file, so you need to be sure that all the files are in the correct version.

However as KyleAure suggested it would be best to have build environment. For old ear files, if you have sources, the easiest might be to use Eclipse for Java EE, import ear and sources and you should be good to go.

Gas
  • 17,601
  • 4
  • 46
  • 93