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

查看:268
本文介绍了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)

Caused by: java.lang.NoSuchMethodError: javax/ws/rs/core/Application.getProperties()Ljava/util/Map; at org.glassfish.jersey.server.ApplicationHandler.(ApplicationHandler.java:287) at 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属性com.ibm.websphere.jaxrs.server.DisableIBMJAXRSEngine=true在JAX-RS中内置的功能,请参见描述

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库创建隔离的共享库.

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

在创建库时,通过选中Use an isolated class loader for this shared library类加载选项,可以创建隔离的共享库.

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

在安装过程中或以后,通过Applications > appName > Shared library references将此共享库映射到您的应用程序.

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属性,并且需要将模块(不在EAR级别)类加载器中的类加载选项更改为Classes loaded with local class loader first (parent last)

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}

将类加载器顺序"下拉列表更改为:Classes loaded with local class loader first (parent last).

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

感谢dooffas对其进行检查,请参见没有隔离的共享库的JAX-RS 2.0 WebSphere 8.5

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天全站免登陆