Weblogic

Skip to end of metadata
Go to start of metadata

Installation of Jenkins into Weblogic

A big thank you for this blog by Maxence Button and this blog by Gatux for the Weblogic expertise to get Jenkins running. Jenkins can be downloaded from jenkins-ci.org site as a WAR file. However, it cannot be deployed to Weblogic without some changes. These are necessary because of Weblogic's proprietary class loaders which behave badly compared to Tomcat, JBoss, et. al.

Install the Jenkins as a WAR to the Weblogic 12.1.1 server:

Note: Tested on Jenkins 1.500

1. Create a weblogic.xml file that looks like the following:
weblogic.xml
<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wls="http://www.bea.com/ns/weblogic/90" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-web-app.xsd">
    <wls:weblogic-version>12.1.1</wls:weblogic-version>
    <wls:context-root>jenkins</wls:context-root>
    <wls:container-descriptor>
         <wls:prefer-web-inf-classes>true</wls:prefer-web-inf-classes>
    </wls:container-descriptor>
</wls:weblogic-web-app>

Drop this file in the WEB-INF directory of the war file. Note: this was tested on Oracle WebLogic 12.1.1.c.

Use this Oracle recommended nomenclature which ensures the version of package 'com.google.common.*' contained in the Jenkins war is used ahead of the system class loader version. The newer version contains a method required by Jenkins.

<?xml version="1.0" encoding="UTF-8"?>
 <wls:weblogic-web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wls="http://www.bea.com/ns/weblogic/90" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-web-app.xsd">
     <wls:weblogic-version>12.1.1.0</wls:weblogic-version>
     <wls:context-root>jenkins</wls:context-root>
     <wls:container-descriptor>
          <wls:prefer-web-inf-classes>false</wls:prefer-web-inf-classes>
      <wls:prefer-application-packages>
              <wls:package-name>com.google.common.*</wls:package-name>
         </wls:prefer-application-packages>
     </wls:container-descriptor>
 </wls:weblogic-web-app>

Install the Jenkins as a WAR to the Weblogic 10.3.4 or newer server:

Note: Tested on Jenkins 1.477 & 1.482
Note: To use this simpler technique, you will need Weblogic 10.3.3 or newer. The "prefer-web-inf-classes" tag is not available in older versions of the weblogic.xml.

1. Create a weblogic.xml file that looks like the following:
weblogic.xml
<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app
    xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsdhttp://xmlns.oracle.com/weblogic/weblogic-web-apphttp://xmlns.oracle.com/weblogic/weblogic-web-app/1.2/weblogic-web-app.xsd">
    <wls:weblogic-version>10.3.4</wls:weblogic-version>
    <wls:context-root>jenkins</wls:context-root>    
    <wls:container-descriptor>
         <wls:prefer-application-packages>
                        <wls:package-name>org.apache.*</wls:package-name>
                        <wls:package-name>javax.persistence.*</wls:package-name>
                        <wls:package-name>antlr.*</wls:package-name>
                        <wls:package-name>org.slf4j</wls:package-name>
        </wls:prefer-application-packages>
    </wls:container-descriptor>
</wls:weblogic-web-app>

Drop this file in the WEB-INF directory of the war file. Note: this was tested on Oracle WebLogic 10.3.4.x.

2. Insert the jcl-over-slf4j jar

Since Weblogic does not ship with these classes you will get an error: ClassNotFoundError : org.apache.commons.logging.impl.SLF4JLocationAwareLog

Copy a jcl-over-slf4j-1.6.2.jar into the WEB-INF/lib dir of the jenkins.war file to correct this error. You can download a jar here

Older Weblogic servers

Note: this installation was tested using Hudson 1.391 and Weblogic 10.3.

To correct Weblogic's class loader problems, we need to build an EAR file and put the weblogic-application.xml directives into it.

1. Create a directory to story the ear contents, with the following structure:

ROOT_Folder/

  • META-INF/
    • application.xml
    • weblogic-application.xml
  • jenkins.war

Once you create the ROOT_Folder,

  • drop the jenkins.war into the ROOT_Folder
  • create the META-INF dir
  • create the following XML files in that META_INF dir:
weblogic-application.xml
<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-application
xmlns:wls="http://www.bea.com/ns/weblogic/weblogic-application"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/javaee_5.xsd
http://www.bea.com/ns/weblogic/weblogic-application http://www.bea.com/ns/weblogic/weblogic-application/1.0/weblogic-application.xsd">

<!-- server-version: 10.3 -->
<wls:application-param>
<wls:param-name>webapp.encoding.default</wls:param-name>
<wls:param-value>UTF-8</wls:param-value>
</wls:application-param>


<wls:prefer-application-packages>
<wls:package-name>org.apache.*</wls:package-name>
<wls:package-name>javax.xml.stream.*</wls:package-name>
</wls:prefer-application-packages>
</wls:weblogic-application>

Weblogic needs this because (unlike JBoss, Tomcat, Jetty et. al) Weblogic will not load the JARs in the WAR before the Weblogic installed JARs, and usually the resulting error is that there is an old version of Ant 1.7 in scope, instead of Ant 1.8.x as Jenkins wants. There is also a conflict with stax-api-1.0.1.jar for the javax.xml package listed.

Here is a simple application.xml that will work

application.xml
<?xml version="1.0" encoding="UTF-8"?>

<application xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd"
version="5">

<module id="jenkins">
<web>
<web-uri>jenkins.war</web-uri>
<context-root>/jenkins</context-root>
</web>
</module>
</application>
2. Zip the files up to create the ear

You can use your favorite file zip tool to create the ear file, I used 7zip. Just verify that the file is named jenkins.ear and that it has the original WAR file and the META-INF dir in its root.

3. Install the EAR to the Weblogic server:

Use your favorite method to install the jenkins.ear into the Weblogic server. Note: remember to delete any old Jenkins WAR or EAR deployments first.

4. Use Jenkins

The application will deploy to http://serverName:port/jenkins.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

Add Comment