Websphere 8 中的 JAX-RS Jersey 2.10 支持 [英] JAX-RS Jersey 2.10 support in Websphere 8

查看:21
本文介绍了Websphere 8 中的 JAX-RS Jersey 2.10 支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Websphere 8 中使用 Jersey 2.10,但它尝试引用作为 JAX-RS 1.1 实现的应用程序(默认 Wink)即使我通过设置 IBM 属性禁用了 JAX-RS 默认值,我也会收到以下错误.

I am trying to use Jersey 2.10 in Websphere 8 but it tries to reference the Application which is a implementation of JAX-RS 1.1 (default Wink) I get this below error even though I disabled to JAX-RS default by setting the IBM property.

引起:java.lang.NoSuchMethodError: javax/ws/rs/core/Application.getProperties()Ljava/util/Map;在 org.glassfish.jersey.server.ApplicationHandler.(ApplicationHandler.java:287)在 org.glassfish.jersey.servlet.WebComponent.(WebComponent.java:311)

我读过一篇文章,说要为 PARENT_LAST 制定类加载策略.在 WAS 控制台上禁用了更改该选项,因此我尝试使用(WAS 的发布设置 - 使用服务器上的资源运行服务器)并且我的服务器崩溃了.

I read a post that says to make class loading policy to PARENT_LAST. Changing that option was disabled on WAS console, so I tried using the (Publishing settings for WAS - Run server with resources on Server) and my server got crashed.

请指教.谢谢.

推荐答案

你需要做以下步骤:

通过 JVM 属性禁用内置 JAX-RS com.ibm.websphere.jaxrs.server.DisableIBMJAXRSEngine=true 参见描述 这里.
您可以通过 Servers > 中的 Web 管理控制台设置此属性.WebSphere 应用程序服务器 >你的服务器名.然后在 Server Infrastructure 部分 Java and Process Management >流程定义>Java虚拟机>自定义属性.

Disable built in JAX-RS via JVM property com.ibm.websphere.jaxrs.server.DisableIBMJAXRSEngine=true see description here.
You can set this property via web admin console in Servers > WebSphere Application Servers > yourServerName. Then in Server Infrastructure section Java and Process Management > Process definition > Java Virtual Machine > Custom properties.

使用所有 JAX-RS 2.10 库在控制台中通过 Environment > 创建 isolated 共享库共享库.

Create isolated shared library with all JAX-RS 2.10 libraries, in console via Environment > Shared Libraries.

隔离共享库是通过检查为此共享库使用隔离类加载器创建库时的类加载选项来创建的.

Isolated shared library is created via checking Use an isolated class loader for this shared library Class Loading option, when creating library.

在安装期间或稍后通过 Applications > 将此共享库映射到您的应用程序应用名称>共享库参考.

Map this shared library to your application, either during installation or later on, via Applications > appName > Shared library references.

重启应用服务器.在 SystemOut.log 中,您应该会看到消息正在初始化 JAX-RS 类:

Restart application server. In the SystemOut.log you should see message initializing JAX-RS classes:

[7/12/14 16:10:36:470 CEST] 0000004a JerseyServlet I   Registering the Jersey servlet application, named javax.ws.rs.core.Application, with the following root resource and provider classes: [class jax.Hello, class org.glassfish.jersey.server.wadl.internal.WadlResource]
[7/12/14 16:10:36:688 CEST] 0000004a ApplicationHa I   Initiating Jersey application, version Jersey: 2.10.1 2014-06-30 13:53:32...

更新

似乎也可以从 WAR 中加载 JAX-RS jar.您必须设置此 DisableIBMJAXRSEngine 属性,并且需要将 module(不在 EAR 级别)类加载器中的类加载选项更改为 Classes loaded with local class loader第一个(父级最后一个)

It appears that it is also possible to load the JAX-RS jars from within the WAR. You have to set this DisableIBMJAXRSEngine property and you need to change the class loading option in the module (not on EAR level) classloader to Classes loaded with local class loader first (parent last)

在管理控制台中:

应用程序 > WebSphere 企业应用程序 > {your.application} > 管理模块 > {your.module}

Applications > WebSphere Enterprise Applications > {your.application} > Manage Modules > {your.module}

将类加载器顺序下拉菜单更改为:首先使用本地类加载器加载的类(最后是父类).

Change the Class loader order dropdown to: Classes loaded with local class loader first (parent last).

感谢 dooffas 对其进行检查,请参阅 JAX-RS 2.0 WebSphere 8.5 without isolated shared library

Thanks for dooffas for checking it, see JAX-RS 2.0 WebSphere 8.5 without isolated shared library

这篇关于Websphere 8 中的 JAX-RS Jersey 2.10 支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆