Frage

I try to get a grip on class loading in Oracles Weblogic EE-Server version 12. My problem is to generate a webapp, which is deployable in JBoss as well as Weblogic. This application should use Logback instead of the logging provided by WLS/JBoss.

In JBoss the following approach works fine: I define a module containing slf4j/logback, then I exclude JBoss logging from my EAR-deployment and finally declare a dependency from the EAR-deployment to the slf4j/logback module.

In WLS, I seem to fail on the last step. First I exclude the WLS-slf4j Implementation by adding

<prefer-application-packages>
    <package-name>org.slf4j.*</package-name>
    <package-name>org.slf4j.impl.*</package-name>
</prefer-application-packages>

to the weblogic-application.xml.

But it seems, after doing so, there is no way to provide logback/slf4j as external library. Both, redefining the CLASSPATH in the admin console as well as putting the libs in the lib directory of the domain seem not to work, because <prefer-application-packages> scrubs them out as well.

Is there any way to remove the WLS-Logging implementation but still providing the required libs external to the EAR?

EDIT

I think I have clarified the differences between JBoss and WLS for myself. While in JBoss there can be a lot of different layers of class loaders which can be configured independently (for each module, each application and the server itself), WLS seems to have no independent configurable class-loader-layer between the server itself and the web-app.

While it is possible to add libraries to the server class loader it seems impossible to do some fine-coarsed tuning of the classes in the server class loader. Between the server and the application layer there is only the choice to allow or disallow a certain package, which is not enough, when you want to exclude wls-specific org.slf4j.impl classes but include the logback-specific org.slf4j.impl.

I would welcome someone to proof me wrong.

War es hilfreich?

Lösung

The answer is simple and already within my question: To cite myself: "there is no way to provide logback/slf4j as external library." The simple answer is to provide the required libraries within the EAR file. This is somehow nasty because there is always the lingering question, what will other applicationservers do, when there are conflicting versions within the appserver and the application? But with Jboss 7.1 and WLS 12c this works.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top