Using Jersey 2.x web service on Weblogic 12.1.1(在 Weblogic 12.1.1 上使用 Jersey 2.x Web 服务)
问题描述
我正在尝试将 Jersey 2.13 Web 服务部署到 Weblogic 12.1.1.此版本的 weblogic 符合 JSR-311 JAX-RS 1.1 规范,而 Jersey 2.x 提供 JAX-RS 2.0 的实现
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
Oracle 有关于如何升级 Jersey JAX-RS RI 版本的说明:http://docs.oracle.com/cd/E24329_01/web.1211/e24983/version.htm
Oracle has an instruction on how to upgrade the version of Jersey JAX-RS RI : http://docs.oracle.com/cd/E24329_01/web.1211/e24983/version.htm
然而,即使这样也无助于解决所有的部署问题.
However even this doesn't help solving all of the deployment issues.
我将应用程序打包到包含 WAR 的 EAR 中.为了覆盖 weblogic jar,我添加了以下 weblogic-application.xml 文件:
I'm packaging the application in EAR containing WAR. In order to override weblogic jars I've included added the following weblogic-application.xml file :
<?xml version="1.0" encoding="ISO-8859-1"?>
<weblogic-application xmlns="http://www.bea.com/ns/weblogic/90">
<prefer-application-packages>
<!-- apis -->
<package-name>javax.ws.rs.*</package-name>
<!-- guava -->
<package-name>com.google.common.*</package-name>
<!-- jersey1 providers -->
<package-name>com.sun.jersey.*</package-name>
<!-- media providers -->
<package-name>org.eclipse.persistence.jaxb.rs.*</package-name>
<package-name>org.codehaus.jackson.jaxrs.*</package-name>
<!-- wls -->
<package-name>weblogic.jaxrs.api.client.*</package-name>
<package-name>weblogic.jaxrs.internal.api.client.*</package-name>
<package-name>weblogic.jaxrs.dispatch.*</package-name>
<package-name>weblogic.jaxrs.monitoring.util.*</package-name>
</prefer-application-packages>
</weblogic-application>
此配置在部署时给我以下错误消息:
This configuration gives me a following error message on deployment :
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;
如果我尝试通过将 org.glassfish.hk2.* 类添加到 prefer-application-packages 来替换它,我会收到新的错误并且它会永远持续下去......
If I try to replace org.glassfish.hk2.* classes by adding it to prefer-application-packages I receive new errors and it's continuing forever...
有人在 weblogic 12.1.1 或更低版本上将 Jersey 迁移到 2.x 版吗?
Has anyone migrated Jersey to version 2.x on weblogic 12.1.1 or below?
谢谢!
推荐答案
最终发现,您实际上必须更换比 Oracle 建议的更多的 jar.这是我的 weblogic-application.xml 的样子:
In the end it turned out that you actually have to replace more jars than Oracle suggests. Here's what my weblogic-application.xml looks like :
<prefer-application-packages>
<package-name>com.sun.jersey.*</package-name>
<package-name>org.glassfish.jersey.*</package-name>
<package-name>org.glassfish.hk2.*</package-name>
<package-name>org.jvnet.hk2.*</package-name>
<package-name>jersey.repackaged.org.objectweb.asm.*</package-name>
<package-name>com.sun.research.ws.wadl.*</package-name>
<package-name>com.sun.ws.rs.ext.*</package-name>
<package-name>org.codehaus.jackson.*</package-name>
<package-name>com.fasterxml.jackson.*</package-name>
<package-name>org.codehaus.jettison.*</package-name>
<package-name>javax.ws.rs.*</package-name>
<package-name>org.objectweb.asm.*</package-name>
<package-name>antlr.*</package-name>
</prefer-application-packages>
希望对你有帮助.
这篇关于在 Weblogic 12.1.1 上使用 Jersey 2.x Web 服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 Weblogic 12.1.1 上使用 Jersey 2.x Web 服务
- Eclipse 插件更新错误日志在哪里? 2022-01-01
- C++ 和 Java 进程之间的共享内存 2022-01-01
- 从 finally 块返回时 Java 的奇怪行为 2022-01-01
- Safepoint+stats 日志,输出 JDK12 中没有 vmop 操作 2022-01-01
- Jersey REST 客户端:发布多部分数据 2022-01-01
- 将log4j 1.2配置转换为log4j 2配置 2022-01-01
- value & 是什么意思?0xff 在 Java 中做什么? 2022-01-01
- Java包名称中单词分隔符的约定是什么? 2022-01-01
- Spring Boot连接到使用仲裁器运行的MongoDB副本集 2022-01-01
- 如何使用WebFilter实现授权头检查 2022-01-01