Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set order of jars in WebLogic?

Tags:

jar

weblogic

In my application I am using Joda-Time 2.0 but in my WebLogic path there is library Joda-Time 1.2.

How can I change the order and tell WebLogic to use my library? Now it is using its own library, not mine. I just added a Maven project dependency to Joda-Time 2.0.

like image 853
hudi Avatar asked Aug 25 '11 08:08

hudi


People also ask

Can Jar be deployed in WebLogic?

Because the classloader can search a directory or a JAR file, you can deploy J2EE components on WebLogic Server in either an "exploded" directory or a JAR file. JAR files are convenient for packaging components and applications for distribution.

What is side by side deployment in WebLogic?

Weblogic Server supports a nice feature called side-by-side deployment (or versioned deployment). This function is extremely usefull when you need to deploy a new version of an application and still keep the old one up and running.


1 Answers

There are several ways of doing this.

  1. Change your startWeblogic.cmd(sh) in the bin folder for your domain, look for the classpath setting and add the new joda before any other WebLogic jars
  2. as was said above, you can change your weblogic.xml if the application is a web application and chose to prefer any lib that comes inside the war.
  3. If you are using an Enterprise application, you can set the following options in your weblogic-application.xml:

    <prefer-application-packages>
        <package-name>org.apache.*</package-name>
        <package-name>antlr.*</package-name>
    </prefer-application-packages>
    

And set your package name for joda in there.

Please note that the first option might result in strange behavior from WebLogic.

Note for some reason I can't get the code to work with the XML.

like image 190
Nuno Furtado Avatar answered Sep 21 '22 19:09

Nuno Furtado