With `sed`:
sed 's|/[^/]\+\.ear$|/ear2.ear|' file
* It seaches for line ending with `.ear` (`$` matches the end of the line). The filename can be everything except a `/`: `[^/]\+`. The `+` indicates that a character (which is not a `/`) can be repreated 1 or more times.
* Then is replaces that match with `/ear2.ear`.