Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JAX-RS Jersey 2.10 support in Websphere 8

Tags:

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.

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)

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.

Please advise. Thanks.

like image 784
jerry Avatar asked Jul 10 '14 19:07

jerry


People also ask

What is the use of soap connector port in WebSphere?

If your operating system is configured with Federal Desktop Core Configuration (FDCC) and you want to connect to a WebSphere Application Server on another server as your workbench, you need to use the SOAP connector port to cross the firewall that is typically present between the workbench and the remote application ...

Is IBM WebSphere still supported?

IBM support for WebSphere Application Server V8. 5.5 with Java 7, as provided prior to September 2019, now continues unchanged until the new end of support date. There is no need to purchase a support extension to receive this support through July 2022. It is part of the standard WebSphere V8.

Does WebSphere 9 support Java 11?

Java 11 is not supported on Traditional WebSphere.


1 Answers

You need to do the following steps:

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.

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.

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

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... 

UPDATE

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)

In the admin console:

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).

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

like image 155
Gas Avatar answered Oct 14 '22 12:10

Gas