Andrey Adamovich
Andrey Adamovich

Reputation: 20663

Order of JAR loading inside EAR's APP-INF/lib

Will adding a MANIFEST.MF file with Class-Path attribute to META-INF directory inside EAR influence the order of loading of JARs located in APP-INF/lib under WebLogic 8.1?

Upvotes: 3

Views: 6908

Answers (3)

Isaac Villanueva
Isaac Villanueva

Reputation: 274

I agree with duffymo

You shouldn't have to worry about the order of class loading, if this is due to conflicting classes you can always exclude the conflicting classes from Jars using Maven or a similar tool.

For instance this is a very simple example of adding jersey-spring4 jar but I'm excluding its dependencies so I can use a different version of the spring framework library.

<dependency>
  <groupId>org.glassfish.jersey.ext</groupId>
  <artifactId>jersey-spring4</artifactId>
  <exclusions>
    <exclusion>
      <artifactId>spring-web</artifactId>
      <groupId>org.springframework</groupId>
    </exclusion>
    <exclusion>
      <artifactId>spring-aop</artifactId>
      <groupId>org.springframework</groupId>
    </exclusion>
    <exclusion>
      <artifactId>spring-context</artifactId>
      <groupId>org.springframework</groupId>
    </exclusion>
    <exclusion>
      <artifactId>spring-beans</artifactId>
      <groupId>org.springframework</groupId>
    </exclusion>
  </exclusions>
</dependency>

Upvotes: 0

duffymo
duffymo

Reputation: 308938

I thought the class loader read JARs as they're required by your application.

I have two questions for you:

  1. Why are you still using WebLogic 8.1? It's off support now, and the current version is 10.x. You're two versions behind. Is this a legacy app that hasn't migrated yet? You'll get a big boost by upgrading, because you'll be using JDK 5 or 6 with the -server option. I'd recommend it.
  2. Why should you care about the order of loading? It should be immaterial to your app how the container loads and manages the beans.

UPDATE:

That sounds different, almost as if you were having conflicts with server JARs. There's that prefer-web-inf-classes setting for that situation. Is that what you mean?

Upvotes: 0

Billy Bob Bain
Billy Bob Bain

Reputation: 2895

I don't believe you can control the APP-INF/lib order via ClassPath attribute of MANIFEST.MF.

I've done this a couple different ways, depending on the client.

  1. Add the patch jar to the system classpath for WLS. If you examine domain/bin/setDomainEnv.sh (or .cmd) there should pre, post, patch classpath environment variables. You could try to add your patch jar to the classpath here. This makes it available for all apps, which might not be what your client wants.
  2. Patch somejar.jar & name it somejar-patched.jar. Replace the jar in APP-INF/lib with the "-patched" version.

Upvotes: 1

Related Questions