OpenSource
OpenSource

Reputation: 2257

Jboss class conflict

This is should be a common case and easy for many of you.

I have appA. This application uses frameworks fw1 and fw2.

fw1 uses the Logger.java from a jar here

http://anonsvn.jboss.org/repos/common/common-logging-spi/trunk/src/main/java/org/jboss/logging/

fw2 uses the Logger.java from a jar here

http://anonsvn.jboss.org/repos/common/jboss-logging/trunk/src/main/java/org/jboss/logging/

Please note the Logger.java is not interchangeable (ie. have different methods). Each framework needs to use its own choice of Logger.java.

How is it possible to deploy such an application in Jboss? This is not my exact scenario but if someone can tell me how to solve this that will be awesome. I can take it from there. The reason is if I have to explain my situation it will take 3 pages!

Thanks in advance

Upvotes: 2

Views: 318

Answers (2)

Mukul Goel
Mukul Goel

Reputation: 8467

Which version of JBoss are you working on?

JBoss provides a very fine-grained class load handling through jboss-deployment-structure.xml

Using this you can specify fw1 to use loggera.java and fw2 to use loggerb.java

I don't feel need to have duplicacy, you can read about jboss-deployment-structure.xml in jboss docs.

Hope this helps.

Upvotes: 0

AlexR
AlexR

Reputation: 115388

I do not think that there is a general solution for your problem. But I'd suggest you to continue discovering as following.

Generally you should run fw1 and fw2 using different class loaders. If it you can intercept the initialization of these frameworks you can probably do this.

Other way is to create your own, mixed version of Logger. I do not know how complicated it is but probably this is easier. For example logger1 has method writeLog() while Logger2 has method printLog(). So create your own Logger that in same package as the original one. This logger will use separate class loaders to delegate calls to first or second version and will implement both methods.

Unfortunately you described your problem very generally without the concrete names of fw1, fw2 and logger. If you cannot find solution yourself probably try to submit another question with more concrete information. It may help.

Good luck.

Upvotes: 1

Related Questions