I've written an Appian smart service plugin for an integration that has a de

I've written an Appian smart service plugin for an integration that has a dependency on jersey-client-1.18.jar, and jersey-core-1.18.jar. However, Appian's installation also has atlassian-rest-module-2.6.7.jar, which has classes with same name and package as in the jersey-client* and jersey-core* jars. The class loader seems to load the atlassian-rest-module classes, which is causing the following Class Cast Exception: Cannot cast com.sun.jersey.core.impl.provider.header.LocaleProvider to com.sun.jersey.core.impl.provider.header.LocaleProvider . Is there any way to resolve this class loading conflict so I may get my plugin smart service to use the jersey* jar classes? Appreciate your help.

OriginalPostID-196932

OriginalPostID-196932

  Discussion posts and replies are publicly visible

Parents
  • We are facing same issue with other OpenLPR API as well.. OpenLPR API uses jersey API for making rest calls. Here is the error..

    Caused by: com.sun.jersey.spi.service.ServiceConfigurationError: com.sun.jersey.spi.HeaderDelegateProvider: The class com.sun.jersey.core.impl.provider.header.LocaleProvider implementing provider interface com.sun.jersey.spi.HeaderDelegateProvider could not be instantiated: Cannot cast com.sun.jersey.core.impl.provider.header.LocaleProvider to com.sun.jersey.spi.HeaderDelegateProvider..

    Even I tried to overcome by changing class loader in class where issue occured, but it does not resolve the problem
    ClassLoader old = Thread.currentThread().getContextClassLoader();
    Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());

    Jersey stuff...

    Thread.currentThread().setContextClassLoader(old);

Reply
  • We are facing same issue with other OpenLPR API as well.. OpenLPR API uses jersey API for making rest calls. Here is the error..

    Caused by: com.sun.jersey.spi.service.ServiceConfigurationError: com.sun.jersey.spi.HeaderDelegateProvider: The class com.sun.jersey.core.impl.provider.header.LocaleProvider implementing provider interface com.sun.jersey.spi.HeaderDelegateProvider could not be instantiated: Cannot cast com.sun.jersey.core.impl.provider.header.LocaleProvider to com.sun.jersey.spi.HeaderDelegateProvider..

    Even I tried to overcome by changing class loader in class where issue occured, but it does not resolve the problem
    ClassLoader old = Thread.currentThread().getContextClassLoader();
    Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());

    Jersey stuff...

    Thread.currentThread().setContextClassLoader(old);

Children
No Data