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
  • The best option is to try and find a way to just have the class in one jar. When you get the no such method error, have you specified where you're importing the method from?

    If you really do need to have both jars present, there are three generally accepted methods of resolving this issue in java. However, fair warning, they're all pretty ugly.

    1) Serialize and deserialize the object
    2) Create a classloader that is the parent for both classes
    3) Reflection
Reply
  • The best option is to try and find a way to just have the class in one jar. When you get the no such method error, have you specified where you're importing the method from?

    If you really do need to have both jars present, there are three generally accepted methods of resolving this issue in java. However, fair warning, they're all pretty ugly.

    1) Serialize and deserialize the object
    2) Create a classloader that is the parent for both classes
    3) Reflection
Children
No Data