1
votes

I integrated a Jax-Rs Jersey (1.16) Restful service application with swagger. Application uses spring boot to launch. I see below exception when I run the application using java -jar my-service-1.0-SNAPSHOT.jar and access the http://localhost:8080/index.html to list the JaxRs resources.

14:01:53,135 INFO  Scanning for root resource and provider classes in the packages:
  com.company.automation.impl
  com.wordnik.swagger.jersey.listing       [http-nio-8080-exec-1] PackagesResourceConfig
14:01:53,435 ERROR StandardWrapper.Throwable                                                                                                                              [http-nio-8080-exec-1] [/]
com.sun.jersey.core.spi.scanning.ScannerException: IO error when scanning jar jar:file:/home/suman/dev/projects/MyService/my-service/build/libs/my-service-1.0-SNAPSHOT.jar!/lib/swagger-jersey-jaxrs_2.10-1.3.4.jar!/com/wordnik/swagger/jersey/listing
    at com.sun.jersey.core.spi.scanning.uri.JarZipSchemeScanner.scan(JarZipSchemeScanner.java:82)
    at com.sun.jersey.core.spi.scanning.PackageNamesScanner.scan(PackageNamesScanner.java:225)
    at com.sun.jersey.core.spi.scanning.PackageNamesScanner.scan(PackageNamesScanner.java:141)
    at com.sun.jersey.api.core.ScanningResourceConfig.init(ScanningResourceConfig.java:80)

I build the fat jar using gradle build including spring-boot-gradle-plugin. I could see that swagger-jersey-jaxrs_2.10-1.3.4.jar was bundled with the fat jar. What am I missing?
I can the run the application fine by other means i.e gradle distZip and extracting the zip content into a directory and run the application run script files created by gradle. But I would really like to run it using java -jar to avoid extracting zip contents step.

[EDIT] Is this a caveat mentioned in http://www.opencredo.com/2014/02/24/experiences-with-spring-boot/ under Caveats section?

1
I think I can safely say that this is nothing to do with the caveats in that blog. What made you think otherwise? On the other hand without more data, it's hard to say what it might be. There's a swagger example here using Jersey 2. I am not so sure that Jersey 1 is worth the effort, but we can give it a try if you can share your code. - Dave Syer
@abalogh if you can provide this jira link comment as answer, I will up vote and accept. - suman j

1 Answers

1
votes

This is a documented Jersey bug, see here.