java – WebLogic and lib conflicts: How do I know which versions WebLogic already has?

Question:

My question is for a beginner, but I feel pretty lost.

I've been working with Java, but I've always been using Tomcat. Recently I needed to make my "webapp" compatible with WebLogic. The problem is that I started having lib version conflicts.

After some internet research, I ended up adding the weblogic.xml file and adding the prefer-web-inf-classes tag with the value true .

However my doubt is more conceptual. The question is this: how can I find out which libs WebLogic already offers me?

For example, if I'm developing a JSF application, WebLogic already offers me a lib with a certain version, right? How can I find out about this version (JSF is an example, but I would like to know all the ones that are available to me)? And, later, if you used maven in this JSF application, should I use scope provided in the dependency definition?

I hope the question wasn't too confusing. If that is the case, please ask me for more information in the comments.

Answer:

Answering each question would be something like this:

How can I find out which libs WebLogic already offers me?

The version of the libraries will depend on the container version as it will depend on the container 's support for the Java EE specification.

For example, for WebLogic version 12c 12.1.3 these versions of the standards are supported, while for 11g 11.1.1.9 these .

If you used maven in this JSF application, should I use scope provided in the dependency definition?

Yes, you can use this scope and no longer need to tell WebLogic to prioritize those present in the application's library directory. This scope will not include the dependency in the bundle, as it is expected to be provided at runtime by the container .

Also, one way to make your project support multiple environments is to use maven profiles to define what and how dependencies will be managed. An example would be this:

<profile>
    <id>tomcat</id>
    <activation>
        <activeByDefault>true</activeByDefault>
    </activation>
    <dependencies>
        <dependency>
            <groupId>javax.faces</groupId>
            <artifactId>jsf-api</artifactId>
            <version>2.0</version>
        </dependency>
    </dependencies>
</profile>

<profile>
    <id>weblogic</id>
    <dependencies>
        <dependency>
            <groupId>javax.faces</groupId>
            <artifactId>jsf-api</artifactId>
            <version>2.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
</profile>

In this example we see that for the tomcat profile we will always package the version 2.0 jsf-api library, while for different versions of WebLogic the library will always be "provided" by the container and may even be of a different version, according to what is supported by the container and by its application. That is, if we used JSF 2.1.* we could package to tomcat and declare it to WebLogic version 12c 12.1.3 .

Scroll to Top