Over a million developers have joined DZone.

Updating EclipseLink in WebLogic

· Java Zone

Check out this 8-step guide to see how you can increase your productivity by skipping slow application redeploys and by implementing application profiling, as you code! Brought to you in partnership with ZeroTurnaround.

JSON binding was added to EclipseLink in version 2.4.  If you are using a version of that does not contain this version (i.e. WebLogic 10.3.4 (11g) contains EclipseLink 2.1.2), then by default you won't have access to this functionality. The recommended solution to this problem is to create a shared library in WebLogic for the newer release of EclipseLink.

Create the Shared Library

WebLogic has the concept of shared libraries. These are deployed as an EAR. Below is what the EAR will look like for creating a shared library for EclipseLink 2.4.

  • lib/eclipselink.jar 
  • META-INF/application.xml 
  • META-INF/weblogic-application.xml
  <display-name>EclipseLink 2.4 Shared Library</display-name>
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.2
Created-By: 1.7.0_04-b21 (Oracle Corporation)
Extension-Name: EclipseLink-2.4.0
Specification-Version: 2.4.0
Implementation-Version: 2.4.0.v20120608-r11652
Use the Shared Library

Once the shared library has been deployed, you need to configure your enterprise applications to use it.

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


The weblogic-application.xml file is used to reference the shared library. The entries in the library-ref element need to match the corresponding entries from MANIFEST.MF in the shared library.
<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-application xmlns:wls="http://xmlns.oracle.com/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://xmlns.oracle.com/weblogic/weblogic-application http://xmlns.oracle.com/weblogic/weblogic-application/1.2/weblogic-application.xsd">

Below is a test servlet that you could include in the WAR to test the EclipseLink version.
package com.example;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.*;
public class TestServlet extends HttpServlet {
    private static final long serialVersionUID = 1L;
    public TestServlet() {
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        PrintWriter out = response.getWriter();
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

The Java Zone is brought to you in partnership with ZeroTurnaround. Check out this 8-step guide to see how you can increase your productivity by skipping slow application redeploys and by implementing application profiling, as you code!


Published at DZone with permission of Blaise Doughan, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}