Edu Castrillon
Edu Castrillon

Reputation: 577

Weblogic - How to refer to a shared JAR library from a WAR

In Weblogic, I have a WAR application that needs to reference a shared library deployed as a JAR.

Is that possible?

I have tried these approaches unsuccessfully

Approach 1: Refer to the JAR in weblogic.xml:

<library-ref>
    <library-name>my-shared-jar</library-name>
</library-ref>

Result: classes from the JAR are not found during deployment (java.lang.ClassNotFoundException)

Approach 2: Refer to the JAR in weblogic-application.xml: same code, same unsuccessful result because apparently weblogic-application.xml can only be used with EARs

Is there a way to solve this?

Upvotes: 1

Views: 4493

Answers (1)

Edu Castrillon
Edu Castrillon

Reputation: 577

The solution is the following workaround:

  1. Create a new module packaged as a WAR and adding as the sole dependency the previous JAR module
  2. Deploy as shared library the new WAR
  3. The rest of the poms reference the JAR module with scope provided
  4. Every service in a WAR references the new (WAR) module in it's weblogic.xml

Upvotes: 1

Related Questions