2

I am using following dependeny.

<dependency>
    <groupId>org.glassfish.jersey.core</groupId>
    <artifactId>jersey-common</artifactId>
    <version>2.22.1</version>
</dependency>

but having following error

rg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'openStackService': Invocation of init method failed; nested exception is java.lang.NoSuchMet
odError: 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/Obje
t;

which version has thie method

Ljava/util/Map;
Ljavax/ws/rs/RuntimeType;


Ljava/lang/String;
Ljava/lang/Object;
Ljava/lang/Class;)

Ljava/lang/Object;
Paul Samsotha
  • 205,037
  • 37
  • 486
  • 720
Ahmet Karakaya
  • 9,899
  • 23
  • 86
  • 141
  • Can you check this http://stackoverflow.com/questions/28009988/embedded-jetty-jersey-works-with-jersey-2-7-exception-with-2-9? – harshavmb Jan 06 '16 at 14:34
  • 2.11 version has also has getValue method. http://javadox.com/org.glassfish.jersey.core/jersey-common/2.11/org/glassfish/jersey/internal/util/PropertiesHelper.html – harshavmb Jan 06 '16 at 14:37
  • no, I have not found a method have 5 parameters passing and last one is java/lang/Class – Ahmet Karakaya Jan 06 '16 at 15:43

3 Answers3

0

I discovered this same issue when trying to create a reusable component that would be compatible with Java 6, i.e. I would have to use Jersey 2.6. The use of the PropertiesHelper is as follows. Say you want to get some configuration property

public MyContructor(@Context Configuration config) {
    Map<String, Object> props = config.getProperties();
    boolean doSomething = 
        PropertiesHelper.getValue(
            props,
            RuntimeType.SERVER,
            Constants.SOME_PROP_KEY,
            defaultValue,
            Boolean.class
         );     
}

The problem this poses, is that starting from Jersey 2.8, the PropertiesHelper class was completely changed, with no backward compatibility. So instead of the following,

getValue(Map<String,?> properties, javax.ws.rs.RuntimeType runtimeType, String key, T defaultValue, Class<T> type)

all the overloaded properties helper getValue methods added another parameter of a legacy map

getValue(Map<String, ?> properties, RuntimeType runtimeType, String key, T defaultValue, Class<T> type, Map<String, String> legacyMap)

Whatever openStackService is, this is the problem you are facing. That component is trying to use a pre-2.8 version of Jersey, or more precisely, of the PropertiesHelper class. If openStackService is a third party class, there's not really anything you can do about it, except use the older Jersey version, or maybe open some issues :-)

Paul Samsotha
  • 205,037
  • 37
  • 486
  • 720
0

I have found out that, my application uses jersey-media-moxy-2.5.1.jar and in this API older version of getValue() is invoked I have added new version of following dependency so it solves the problem.

<dependency>
    <groupId>org.glassfish.jersey.media</groupId>
    <artifactId>jersey-media-moxy</artifactId>
    <version>2.22.1</version>
</dependency>

enter image description here

Ahmet Karakaya
  • 9,899
  • 23
  • 86
  • 141
0

Possible root cause:

<dependency>
    <groupId>org.glassfish.jersey.connectors</groupId>
    <artifactId>jersey-apache-connector</artifactId>
    <version>${jersey.version}</version>
</dependency>
  • ${jersey.version} differ from the other jersey dependencies
Taraskin
  • 561
  • 9
  • 15