Search code examples
javajersey

com.sun.jersey.api.view.Viewable cannot be resolved, it is indirectly referenced form required.class


I upgraded jersey version from 1.13 to 2.25.1. I've changed all the packages form com.sun.jersey to org.glassfish.jersey. App started working as expected but one of the classes is throwing com.sun.jersey.view.Viewable cannot be resolved, it is indirectly referenced from required.class error. Viewable class was present in older version of jersey and I am no longer referencing it but why I am getting error then? I've cleaned the project and updated the project via Maven but same error. Is there anything missing?

Thanks.


Solution

  • This may not be an ideal solution but the only way to get rid of this issue for me was to add the lower version of the jersey jars. As I said, this is not the right approach because now I got two version of Jersey jars in my classpath.

    We have to carefully build the project and test all the services just to make sure they are working as expected because jersey get confuse what to pick up if there are two version of jars.

    In these kind of cases, usually the third party api breaks because of the fact that you don't provide the implementation of certain interfaces or abstract classes which are not in the latest version but the compiler refers to the lower version and look for an implementation. Therefore I don't like this approach at all.