What happens when two Java frameworks need third one but each of the two need different version of third one? -
in java project i'm using 2 different frameworks (let's a.jar , b.jar) , both of them require 1 common framework (let's log4j.jar) in 2 different versions. how treated java if framework needs log4j v1.1 , b needs log4j v1.2? cause kind of conflict/error or somehow (how?) resolved?
if not cause conflict/error (my project can compiled , run) - can use version of log4j myself in project? or forced select lower / higher version number of log4j?
update: to more specific... if part of log4j api changed in v1.2 (let's 1 single method doit() signature changed) , both , b call doit. happend? project run? crash on first use of doit? version of log4j must put on classpath - v1.2 or both?
java doesn't natively support management of multiple versions of same piece of code, is, can use @ 1 version within same jvm (with default class loader). however, checkout question 1705720, has several answers pointing out possible ways of achieving (osgi or custom class loaders).
but doubt worth trouble multiple log4j versions not required code directly. in case, i'd suggest start using newer log4j version (v1.2) first , verify if cause problem framework a. if cause conflict, fall-back log4j v1.1 , verify again. if out of luck, need hands dirty...
update: specific description, there's no way of using either log4j v1.1 or v1.2, framework , b each require different signature. have roll own version of of log4j or framework a, or b.
Comments
Post a Comment