title: Deploying a Jersey application on Weblogic 12.1.3
body: <p>I am having difficulty deploying a Jersey application to Weblogic 12, I have spent a lot of time battling with it and am still struggling. I have followed various suggestions on various sites (including this one), but I am still having issues. I don't know if I am fundamentally misunderstanding something basic, so I am hoping someone can help me.</p>
  
  <p>Here is what I have so far:</p>
  
  <p>I have created a new maven project.
  Here is my POM:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
  
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
  &lt;groupId&gt;uk.co.omnicomengineering&lt;/groupId&gt;
  &lt;artifactId&gt;jersey-weblogic&lt;/artifactId&gt;
  &lt;packaging&gt;war&lt;/packaging&gt;
  &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  &lt;name&gt;jersey-weblogic&lt;/name&gt;
  
  &lt;build&gt;
      &lt;finalName&gt;jersey-weblogic&lt;/finalName&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.5.1&lt;/version&gt;
              &lt;inherited&gt;true&lt;/inherited&gt;
              &lt;configuration&gt;
                  &lt;source&gt;1.7&lt;/source&gt;
                  &lt;target&gt;1.7&lt;/target&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.glassfish.jersey.containers&lt;/groupId&gt;
          &lt;artifactId&gt;jersey-container-servlet&lt;/artifactId&gt;
          &lt;version&gt;2.19&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.ws.rs&lt;/groupId&gt;
          &lt;artifactId&gt;javax.ws.rs-api&lt;/artifactId&gt;
          &lt;version&gt;2.0.1&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  
  &lt;properties&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
  &lt;/properties&gt;
  </code></pre>
  
  <p></p>
  
  <p>I have also deployed the jax-rs to Weblogic as in <a href="https://docs.oracle.com/middleware/1213/wls/RESTF/use-jersey20-ri.htm#RESTF299" rel="nofollow">https://docs.oracle.com/middleware/1213/wls/RESTF/use-jersey20-ri.htm#RESTF299</a> and added the following weblogic.xml to my WEB-INF directory:</p>
  
  <pre><code>&lt;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://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.7/weblogic-web-app.xsd"&gt;
  
  &lt;wls:library-ref&gt;
     &lt;wls:library-name&gt;jax-rs&lt;/wls:library-name&gt;
     &lt;wls:specification-version&gt;2.0&lt;/wls:specification-version&gt;
     &lt;wls:exact-match&gt;false&lt;/wls:exact-match&gt;
  &lt;/wls:library-ref&gt;
  </code></pre>
  
  <p></p>
  
  <p>Now, when I try to deploy the application, I get the following error:</p>
  
  <pre><code>&lt;06-Jul-2015 11:19:45 o'clock BST&gt; &lt;Error&gt; &lt;HTTP&gt; &lt;BEA-101216&gt; &lt;Servlet: "Jersey Web Application" failed to preload on startup in Web application: "jersey-weblogic".
  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;
  at org.glassfish.jersey.internal.inject.Injections._createLocator(Injections.java:138)
  at org.glassfish.jersey.internal.inject.Injections.createLocator(Injections.java:123)
  at org.glassfish.jersey.server.ApplicationHandler.&lt;init&gt;(ApplicationHandler.java:329)
  at org.glassfish.jersey.servlet.WebComponent.&lt;init&gt;(WebComponent.java:339)
  at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:170)
  Truncated. see log file for complete stacktrace
  &gt; 
  &lt;06-Jul-2015 11:19:45 o'clock BST&gt; &lt;Error&gt; &lt;Deployer&gt; &lt;BEA-149265&gt; &lt;Failure occurred in the execution of deployment request with ID "10095322227139" for task "12". Error is: "weblogic.application.ModuleException: 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;"
  weblogic.application.ModuleException: 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;
  at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:140)
  at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)
  at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:216)
  at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:211)
  at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
  Truncated. see log file for complete stacktrace
  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;
  at org.glassfish.jersey.internal.inject.Injections._createLocator(Injections.java:138)
  at org.glassfish.jersey.internal.inject.Injections.createLocator(Injections.java:123)
  at org.glassfish.jersey.server.ApplicationHandler.&lt;init&gt;(ApplicationHandler.java:329)
  at org.glassfish.jersey.servlet.WebComponent.&lt;init&gt;(WebComponent.java:339)
  at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:170)
  Truncated. see log file for complete stacktrace
  &gt; 
  &lt;06-Jul-2015 11:19:45 o'clock BST&gt; &lt;Error&gt; &lt;Deployer&gt; &lt;BEA-149202&gt; &lt;Encountered an exception while attempting to commit the 7 task for the application "_auto_generated_ear_".&gt; 
  &lt;06-Jul-2015 11:19:45 o'clock BST&gt; &lt;Warning&gt; &lt;Deployer&gt; &lt;BEA-149004&gt; &lt;Failures were detected while initiating start task for application "_auto_generated_ear_".&gt; 
  &lt;06-Jul-2015 11:19:45 o'clock BST&gt; &lt;Warning&gt; &lt;Deployer&gt; &lt;BEA-149078&gt; &lt;Stack trace for message 149004
  weblogic.application.ModuleException: 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;
  at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:140)
  at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)
  at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:216)
  at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:211)
  at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
  Truncated. see log file for complete stacktrace
  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;
  at org.glassfish.jersey.internal.inject.Injections._createLocator(Injections.java:138)
  at org.glassfish.jersey.internal.inject.Injections.createLocator(Injections.java:123)
  at org.glassfish.jersey.server.ApplicationHandler.&lt;init&gt;(ApplicationHandler.java:329)
  at org.glassfish.jersey.servlet.WebComponent.&lt;init&gt;(WebComponent.java:339)
  at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:170)
  Truncated. see log file for complete stacktrace
  </code></pre>
  
  <p>I am not really sure what is going wrong; am I using the wrong dependencies in my POM?</p>
  
  <p>Any help that anyone could give would be gratefully received, I have spend a lot of time battling with Weblogic and Jersey!</p>
  
  <p>--EDIT --</p>
  
  <p>I have added the following to my weblogic.xml (following <a href="http://www.widecodes.com/CxVkWWgPUj/using-jersey-2x-web-service-on-weblogic-1211.html" rel="nofollow">http://www.widecodes.com/CxVkWWgPUj/using-jersey-2x-web-service-on-weblogic-1211.html</a> which seems to be a similar issue):</p>
  
  <pre><code>&lt;weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.7/weblogic-web-app.xsd"&gt;
  
  &lt;library-ref&gt;
     &lt;library-name&gt;jax-rs&lt;/library-name&gt;
     &lt;specification-version&gt;2.0&lt;/specification-version&gt;
     &lt;exact-match&gt;false&lt;/exact-match&gt;
  &lt;/library-ref&gt;
  
  &lt;container-descriptor&gt;
  &lt;prefer-application-packages&gt;
      &lt;package-name&gt;com.sun.jersey.*&lt;/package-name&gt;
      &lt;package-name&gt;org.glassfish.jersey.*&lt;/package-name&gt;
      &lt;package-name&gt;org.glassfish.hk2.*&lt;/package-name&gt;
      &lt;package-name&gt;org.jvnet.hk2.*&lt;/package-name&gt;
      &lt;package-name&gt;jersey.repackaged.org.objectweb.asm.*&lt;/package-name&gt;
  
      &lt;package-name&gt;com.sun.research.ws.wadl.*&lt;/package-name&gt;
      &lt;package-name&gt;com.sun.ws.rs.ext.*&lt;/package-name&gt;
  
      &lt;package-name&gt;org.codehaus.jackson.*&lt;/package-name&gt;
      &lt;package-name&gt;com.fasterxml.jackson.*&lt;/package-name&gt;
  
      &lt;package-name&gt;org.codehaus.jettison.*&lt;/package-name&gt;
  
      &lt;package-name&gt;javax.ws.rs.*&lt;/package-name&gt;
  
      &lt;package-name&gt;org.objectweb.asm.*&lt;/package-name&gt;
  
      &lt;package-name&gt;antlr.*&lt;/package-name&gt;
  &lt;/prefer-application-packages&gt;
  &lt;/container-descriptor&gt; 
  </code></pre>
  
  <p></p>
  
  <p>Now, when I deploy I get the following error:</p>
  
  <pre><code>&lt;08-Jul-2015 14:16:25 o'clock BST&gt; &lt;Error&gt; &lt;HTTP&gt; &lt;BEA-101216&gt; &lt;Servlet: "Jersey Web Application" failed to preload on startup in Web application: "jersey-weblogic".
  java.lang.NoSuchMethodError: org.glassfish.jersey.internal.util.PropertiesHelper.getValue(Ljava/util/Map;Ljavax/ws/rs/RuntimeType;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object;
  at org.glassfish.jersey.moxy.json.MoxyJsonFeature.configure(MoxyJsonFeature.java:67)
  at org.glassfish.jersey.model.internal.CommonConfig.configureFeatures(CommonConfig.java:714)
  at org.glassfish.jersey.model.internal.CommonConfig.configureMetaProviders(CommonConfig.java:644)
  at org.glassfish.jersey.server.ResourceConfig.configureMetaProviders(ResourceConfig.java:822)
  at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:452)
  Truncated. see log file for complete stacktrace
  &gt; 
  &lt;08-Jul-2015 14:16:26 o'clock BST&gt; &lt;Error&gt; &lt;Deployer&gt; &lt;BEA-149265&gt; &lt;Failure occurred in the execution of deployment request with ID "193463109842784" for task "12". Error is: "weblogic.application.ModuleException: java.lang.NoSuchMethodError: org.glassfish.jersey.internal.util.PropertiesHelper.getValue(Ljava/util/Map;Ljavax/ws/rs/RuntimeType;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object;"
  weblogic.application.ModuleException: java.lang.NoSuchMethodError: org.glassfish.jersey.internal.util.PropertiesHelper.getValue(Ljava/util/Map;Ljavax/ws/rs/RuntimeType;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object;
  at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:140)
  at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)
  at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:216)
  at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:211)
  at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
  Truncated. see log file for complete stacktrace
  Caused By: java.lang.NoSuchMethodError: org.glassfish.jersey.internal.util.PropertiesHelper.getValue(Ljava/util/Map;Ljavax/ws/rs/RuntimeType;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object;
  at org.glassfish.jersey.moxy.json.MoxyJsonFeature.configure(MoxyJsonFeature.java:67)
  at org.glassfish.jersey.model.internal.CommonConfig.configureFeatures(CommonConfig.java:714)
  at org.glassfish.jersey.model.internal.CommonConfig.configureMetaProviders(CommonConfig.java:644)
  at org.glassfish.jersey.server.ResourceConfig.configureMetaProviders(ResourceConfig.java:822)
  at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:452)
  Truncated. see log file for complete stacktrace
  &gt; 
  &lt;08-Jul-2015 14:16:26 o'clock BST&gt; &lt;Error&gt; &lt;Deployer&gt; &lt;BEA-149202&gt; &lt;Encountered an exception while attempting to commit the 7 task for the application "_auto_generated_ear_".&gt; 
  &lt;08-Jul-2015 14:16:26 o'clock BST&gt; &lt;Warning&gt; &lt;Deployer&gt; &lt;BEA-149004&gt; &lt;Failures were detected while initiating start task for application "_auto_generated_ear_".&gt; 
  &lt;08-Jul-2015 14:16:26 o'clock BST&gt; &lt;Warning&gt; &lt;Deployer&gt; &lt;BEA-149078&gt; &lt;Stack trace for message 149004
  weblogic.application.ModuleException: java.lang.NoSuchMethodError: org.glassfish.jersey.internal.util.PropertiesHelper.getValue(Ljava/util/Map;Ljavax/ws/rs/RuntimeType;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object;
  at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:140)
  at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)
  at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:216)
  at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:211)
  at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
  Truncated. see log file for complete stacktrace
  Caused By: java.lang.NoSuchMethodError: org.glassfish.jersey.internal.util.PropertiesHelper.getValue(Ljava/util/Map;Ljavax/ws/rs/RuntimeType;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object;
  at org.glassfish.jersey.moxy.json.MoxyJsonFeature.configure(MoxyJsonFeature.java:67)
  at org.glassfish.jersey.model.internal.CommonConfig.configureFeatures(CommonConfig.java:714)
  at org.glassfish.jersey.model.internal.CommonConfig.configureMetaProviders(CommonConfig.java:644)
  at org.glassfish.jersey.server.ResourceConfig.configureMetaProviders(ResourceConfig.java:822)
  at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:452)
  Truncated. see log file for complete stacktrace
  </code></pre>