title: Using Jersey 2.x web service on Weblogic 12.1.1
body: <p>I'm trying to deploy Jersey 2.13 web services to Weblogic 12.1.1. This version of weblogic is compliant with JSR-311 JAX-RS 1.1 specification whereas Jersey 2.x provides implementation for JAX-RS 2.0</p>
  
  <p>Oracle has an instruction on how to upgrade the version of Jersey JAX-RS RI :
  <a href="http://docs.oracle.com/cd/E24329_01/web.1211/e24983/version.htm" rel="noreferrer">http://docs.oracle.com/cd/E24329_01/web.1211/e24983/version.htm</a></p>
  
  <p>However even this doesn't help solving all of the deployment issues.</p>
  
  <p>I'm packaging the application in EAR containing WAR. In order to override weblogic jars I've included added the following <strong>weblogic-application.xml</strong> file :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
  &lt;weblogic-application xmlns="http://www.bea.com/ns/weblogic/90"&gt;
    &lt;prefer-application-packages&gt;
      &lt;!-- apis --&gt;
      &lt;package-name&gt;javax.ws.rs.*&lt;/package-name&gt;
      &lt;!-- guava --&gt;
      &lt;package-name&gt;com.google.common.*&lt;/package-name&gt;
      &lt;!-- jersey1 providers --&gt;
      &lt;package-name&gt;com.sun.jersey.*&lt;/package-name&gt;
      &lt;!-- media providers --&gt;
      &lt;package-name&gt;org.eclipse.persistence.jaxb.rs.*&lt;/package-name&gt;
      &lt;package-name&gt;org.codehaus.jackson.jaxrs.*&lt;/package-name&gt;
      &lt;!-- wls --&gt;
      &lt;package-name&gt;weblogic.jaxrs.api.client.*&lt;/package-name&gt;
      &lt;package-name&gt;weblogic.jaxrs.internal.api.client.*&lt;/package-name&gt;
      &lt;package-name&gt;weblogic.jaxrs.dispatch.*&lt;/package-name&gt;
      &lt;package-name&gt;weblogic.jaxrs.monitoring.util.*&lt;/package-name&gt;
  
     &lt;/prefer-application-packages&gt;
  &lt;/weblogic-application&gt;
  </code></pre>
  
  <p>This configuration gives me a following error message on deployment : </p>
  
  <pre><code>Caused By: java.lang.NoSuchMethodError: org.glassfish.hk2.api.ServiceLocatorFactory.create(Ljava/lang/String;Lorg/glassfish/hk2/api/ServiceLocator;Lorg/glassfish/hk2/extension/ServiceLocatorGenerator;Lorg/glassfish/hk2/api/ServiceLocatorFactory$CreatePolicy;)Lorg/glassfish/hk2/api/ServiceLocator;
  </code></pre>
  
  <p>If I try to replace org.glassfish.hk2.* classes by adding it to <strong>prefer-application-packages</strong> I receive new errors and it's continuing forever...</p>
  
  <p>Has anyone migrated Jersey to version 2.x on weblogic 12.1.1 or below?</p>
  
  <p>Thanks!</p>