Wednesday, May 25, 2011

Adding custom jars/classes to Weblogic server -how it works


 One of the queries I got was on how to add custom jars to the weblogic server. This is described in detail in Oracle documentation. I will be just explaining on how it works.
          As you know a domain is a set of WebLogic servers with a central administration point (the Admin Server) and a central configuration repository (config. xml). A managed server is a WebLogic server instance running in a single JVM on a single machine with a targeted set of applications. If you go through the config.xml you will find a list of libraries that need to be loaded and added to the class path. One of them is the oracle extension library named oracle.soa.ext_11.1.1.

Code snippet - Entries from Config.xml

<library>
    <target>AdminServer,soa_server1</target>
    <source-path>D:/Oracle/Middleware/Oracle_SOA1/soa/modules/oracle.soa.ext_11.1.1/oracle.soa.ext.jar</source-path>
    <deployment-order>307</deployment-order>
    <security-dd-model>DDOnly</security-dd-model>
    <staging-mode>nostage</staging-mode>
  </library>

This entry is the handle Weblogic uses to load the custom jars.
How to add custom jars to weblogic domains is described in detail here

Main steps are

  1. Copy the jar files to this directory or its subdirectory.
To add custom jars :
 You can add custom classes and JAR files to an SOA composite application. A SOA extension library for adding extension classes and JARs to an SOA composite application is available in the $ORACLE_HOME/soa/modules/oracle.soa.ext_11.1.1 directory. For Oracle JDeveloper, custom classes and JARs are added to the application_name/project/sca-inf/lib directory.
To add custom classes:
Copy the classes to the classes directory. If the classes are used in bpelx:exec, you must also add the JARs in bpelcClasspath in bpel-config.xml. The bpel-config.xml is stored in soa/  folder in MDS.
  
  1. Run "ant".
  2. Restart Oracle WebLogic Server.
 
How it works ??
Go to $ORACLE_HOME/soa/modules/oracle.soa.ext_11.1.1 directory.
Open the oracle.soa.ext.jar.
The Existing MANIFEST file will look like below.

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: 16.0-b13 (Sun Microsystems Inc.)
Implementation-Vendor: Oracle
Implementation-Title: Oracle SOA EXT
Implementation-Version: 11.1.1
Product-Name: Oracle SOA EXT
Product-Version: 11.1.1.3.0
Specification-Version: 11.1.1
Extension-Name: oracle.soa.ext
Class-Path: classes/

To see how it works I created a folder ext and added the jar - geo.soa.ext.jar to ext.
Ran the build file. It re-created the jar with new Manifest file.

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: 16.0-b13 (Sun Microsystems Inc.)
Implementation-Vendor: Oracle
Implementation-Title: Oracle SOA EXT
Implementation-Version: 11.1.1
Product-Name: Oracle SOA EXT
Product-Version: 11.1.1.3.0
Specification-Version: 11.1.1
Extension-Name: oracle.soa.ext
Class-Path: ext/geo.soa.ext.jar classes


Restart the server. Observe the logs.


If you see the  oracle.soa.bpel.engine.compiler sets LibClasspath

Log Snippet
[soa_server1] [NOTIFICATION] [] [oracle.soa.bpel.engine.compiler] [tid: weblogic.work.j2ee.J2EEWorkManager$WorkWithListener@3b5c934] [userId: <anonymous>] [ecid: 0000J0Bx98BCgoK_MTk3ye1DpW4f000000,1:20517] [APP: soa-infra] [dcid: 437f5d69399c9ba4:-4506c58d:1300bf5c396:-7ffd-000000000000000e] LibClasspath=D:\Oracle\MIDDLE~1\ORACLE~1\modules\commonj.sdo_2.1.0.jar;D:\Oracle\MIDDLE~1\ORACLE~1\modules\oracle.fabriccommon_11.1.1\fabric-common.jar;D:\Oracle\MIDDLE~1\ORACLE~1\modules\oracle.xdk_11.1.0\xmlparserv2.jar;D:\Oracle\Middleware\Oracle_SOA1\soa\modules\oracle.soa.bpel_11.1.1\orabpel-common.jar;D:\Oracle\Middleware\Oracle_SOA1\soa\modules\oracle.soa.bpel_11.1.1\orabpel-exts.jar;D:\Oracle\Middleware\Oracle_SOA1\soa\modules\oracle.soa.bpel_11.1.1\orabpel-thirdparty.jar;D:\Oracle\Middleware\Oracle_SOA1\soa\modules\oracle.soa.bpel_11.1.1\orabpel-validator.jar;D:\Oracle\Middleware\Oracle_SOA1\soa\modules\oracle.soa.bpel_11.1.1\orabpel.jar;D:\Oracle\Middleware\Oracle_SOA1\soa\modules\oracle.soa.fabric_11.1.1\fabric-client.jar;D:\Oracle\Middleware\Oracle_SOA1\soa\modules\oracle.soa.fabric_11.1.1\fabric-ext.jar;D:\Oracle\Middleware\Oracle_SOA1\soa\modules\oracle.soa.fabric_11.1.1\fabric-runtime.jar;D:\Oracle\Middleware\Oracle_SOA1\soa\modules\oracle.soa.fabric_11.1.1\oracle.soa.fabric.jar;D:\Oracle\Middleware\Oracle_SOA1\soa\modules\oracle.soa.fabric_11.1.1\soa-infra-tools.jar;D:\Oracle\Middleware\Oracle_SOA1\soa\modules\oracle.soa.ext_11.1.1\ext/geo.soa.ext.jar;D:\Oracle\Middleware\Oracle_SOA1\soa\modules\oracle.soa.ext_11.1.1\classes;D:\Oracle\MIDDLE~1\ORACLE~1\soa\modules\oracle.soa.mgmt_11.1.1\soa-infra-mgmt.jar


The custom jars/classes are loaded at server startup so that the jars are available during runtime. Thanks to Siva for his inputs.

1 comment:

Anonymous said...

Hello, I do believe your web site could possibly be having web browser
compatibility problems. Whenever I look at your site in Safari, it
looks fine however when opening in IE, it
has some overlapping issues. I just wanted to provide you with a quick heads up!
Other than that, fantastic site!

Also visit my webpage ... Additional reading