0

I'm using these jersey libraries:

    <dependency>
        <groupId>org.glassfish.jersey.core</groupId>
        <artifactId>jersey-client</artifactId>
        <version>2.34</version>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.media</groupId>
        <artifactId>jersey-media-json-jackson</artifactId>
        <version>2.34</version>
    </dependency>     
    <dependency>
        <groupId>org.glassfish.jersey.media</groupId>
        <artifactId>jersey-media-sse</artifactId>
        <version>2.34</version>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.inject</groupId>
        <artifactId>jersey-hk2</artifactId>
        <version>2.34</version>
    </dependency>        

My java application is packaged into a uber-jar (MyApplication-1.0.jar in the jnlp file) that includes my code and all the dependencies.

It is a headless java application that makes API requests using jax-rs and jersey libraries.

It runs on multiple devices using java web start (https://github.com/AdoptOpenJDK /IcedTea-Web

I have noticed that from time to time some devices start making requests for the MyApplication-1.0.jar file while the application is still alive. It usually happens when the application has been running for some time (2 or 3 days at least)

I can see that on my webserver access log:

172.53.45.128 (81.53.51.24) - - [03/Jan/2020:12:49:01 +0000] "GET /MyApplication-1.0.jar HTTP/1.1" 200 20308737 "-" "Java/1.8.0_222"

I've run this test where I remove the jnlp and the jar file from the webserver and found that the devices where the application was already running and were requesting the .jar file over and over started producing this exception org.glassfish.jersey.internal.inject.InjectionManagerFactory: : java.io.FileNotFoundException: https://dev.myapplication.com/MyApplication-1.0.jar every time a new Rest API request to the server was being done.

What can be happening here? How is the jersey client messed up when running inside java web start for it to start producing all this requests?

The code that triggers the requests on the jersey libraries is in the method lookService from the Injections class org.glassfish.jersey.internal.inject.Injections.lookupService

this is the full stacktrace

org.glassfish.jersey.internal.ServiceConfigurationError:
org.glassfish.jersey.internal.inject.InjectionManagerFactory: : 
java.io.FileNotFoundException: https://dev.myapplication.com/MyApplication-1.0.jar at 
org.glassfish.jersey.internal.ServiceFinder.fail(ServiceFinder.java:410) at 
org.glassfish.jersey.internal.ServiceFinder.parse(ServiceFinder.java:489) at 
org.glassfish.jersey.internal.ServiceFinder.access$400(ServiceFinder.java:132) at org.glassfish.jersey.internal.ServiceFinder$LazyObjectIterator.hasNext(ServiceFinder.java:686
) at
org.glassfish.jersey.internal.inject.Injections.lookupService(Injections.java:88) at 
org.glassfish.jersey.internal.inject.Injections.lookupInjectionManagerFactory(Injections.java:73) at 
org.glassfish.jersey.internal.inject.Injections.createInjectionManager(Injections.java:44) at 
org.glassfish.jersey.client.ClientConfig$State.initRuntime(ClientConfig.java:413) at 
org.glassfish.jersey.internal.util.collection.Values$LazyValueImpl.get(Values.java:317) at 
org.glassfish.jersey.client.ClientConfig.getRuntime(ClientConfig.java:819) at 
org.glassfish.jersey.client.ClientRequest.getClientRuntime(ClientRequest.java:176) at 
org.glassfish.jersey.client.ClientRequest.getInjectionManager(ClientRequest.java:567) at 
org.glassfish.jersey.client.JerseyWebTarget.onBuilder(JerseyWebTarget.java:371) at 
org.glassfish.jersey.client.JerseyWebTarget.request(JerseyWebTarget.java:206) at 
org.glassfish.jersey.client.JerseyWebTarget.request(JerseyWebTarget.java:38) at 
com.mycompany.myapp.restclient.MyAppJerseyClient.updateUserData(MyAppJerseyClient.java:164) <------ my application api request
ansanes
  • 87
  • 1
  • 9

0 Answers0