Reputation: 5396
Can taking a backup in WEB-INF/lib foo.jar to foo_backup.jar will effect in project?
What my exact question is...
If I do above kind of thing, will it load both jar? foo.jar and foo_backup.jar?
And as both jar contains same classes inside it. Which will be considered when I use some class (consider com.test.TestClass)? Will it be of foo.jar or foo_backup.jar?
can any one please advice on same? I can remove that foo_backup.jar but I want to know what will happen if this kind of scenario?
Upvotes: 0
Views: 716
Reputation: 2530
It's definitely a good practice to call an back-up with name(-data).bak The data is in parenthesis as is optional, because it is useful in case you are going to have more than one backup so you can track your most recent ones.
Upvotes: 0
Reputation: 5377
I think the classloader will just pick the first one and load only that, but it will depend on the implementation of the classloader, which is not typically something you have much control over. This can lead to all sorts of nasty bugs. I'd suggest using @fvu's suggestion.
Upvotes: 0
Reputation: 34387
Instead of foo_backup.jar
, create a backup with name like foo.jar.backup
.
Still if you go with backup as foo_backup.jar
then I think foo.jar
will be loaded first as it comes first in the listing but still suspect, it may lead into issues(assuming backup is older version) as both the jars and hence the classes inside it would be available in the class path.
Upvotes: 1