java.lang.LinkageError: loader constraint violation when developing a SOAP plugin in JIRA

I am trying to implement a listener in JIRA which uses SOAP to contact
a web service, (in fact it is OTRS, another issue management system).
I chose to following a SimpleListener implementation (JIRA Listener
Event), rather than an atlassian-event.
I chose to implement it via the plug-in mechanism, rather than
installing a one-off static class into JIRA’s CLASSPATH.
(maybe that was the wrong decision, I do not know).

Notice: I do not know much about SOAP, WSDL, nor the internals of JIRA
(codehouse, osgi).
I followed by and large the instructions given at:
https://developer.atlassian.com/docs/getting-started/set-up-the-atlassian-plugin-sdk-and-build-a-project/create-a-helloworld-plugin-project
(and subsequent instruction pages).

I have created a plugin for JIRA using the atlas-create-jira-plugin.

I generated (using the org.apache.axis.wsdl.WSDL2Java class — I think
it is called Apache’s Axis version 1 — in a command-line-mode from
the WSDL file: standardTicketActionsSoap.wsdl)
a bunch of Java classes which I added to the plug-in, such as:

org/otrs/www/TicketConnector/GenericTicketConnector.java
org/otrs/www/TicketConnector/GenericTicketConnectorLocator.java
org/otrs/www/TicketConnector/GenericTicketConnector_BindingStub.java
org/otrs/www/TicketConnector/GenericTicketConnector_PortType.java
org/otrs/www/TicketConnector/OTRS_Article.java
org/otrs/www/TicketConnector/OTRS_Attachment.java
org/otrs/www/TicketConnector/OTRS_DynamicField.java
org/otrs/www/TicketConnector/OTRS_Error.java
org/otrs/www/TicketConnector/OTRS_PendingTime.java
org/otrs/www/TicketConnector/OTRS_TicketCreate_Ticket.java
org/otrs/www/TicketConnector/OTRS_TicketGetResponse_Article.java
org/otrs/www/TicketConnector/OTRS_TicketGetResponse_Attachment.java
org/otrs/www/TicketConnector/OTRS_TicketGetResponse_Ticket.java
org/otrs/www/TicketConnector/OTRS_TicketSearch_DynamicField.java
org/otrs/www/TicketConnector/OTRS_TicketSearch_TicketFlag.java
org/otrs/www/TicketConnector/OTRS_TicketUpdate_Ticket.java
org/otrs/www/TicketConnector/SessionCreate.java
org/otrs/www/TicketConnector/SessionCreateResponse.java
org/otrs/www/TicketConnector/TicketCreate.java
org/otrs/www/TicketConnector/TicketCreateResponse.java
org/otrs/www/TicketConnector/TicketGet.java
org/otrs/www/TicketConnector/TicketSearch.java
org/otrs/www/TicketConnector/TicketSearchResponse.java
org/otrs/www/TicketConnector/TicketUpdate.java
org/otrs/www/TicketConnector/TicketUpdateResponse.java

I had to manually modify two generated classes according to:
How to solve SAXException: Invalid element in,
to avoid a “org.xml.sax.SAXException: Invalid element ” error.

I have three issues with this approach, of which the third one is the
real problem:

a) the refresh with FastDev or with atlas-cli ‘pi’ command does not
work, with the “[INFO] Waiting for commands…” symtom (as:
in atlassian’s answers page topic: fastdev-not-end-up-the-processing
but the fix won’t work for me) , I always need to shutdown the full
JIRA test installation and restart it. This may be due to some false
plug-in configuration and, though a pain in the neck, I can live with that for the time being.

b) a command-line build via Maven (atlas-run or atlas-build) does not
report any error, while compiling the project with Eclipse will fail
with:

Project build error: Unresolveable build extension: Plugin com.atlassian.maven.plugins:maven-jira-plugin:5.0.13 or one of its dependencies could not be resolved: Failure to find com.atlassian.maven.plugins:maven-jira-plugin:jar:5.0.13 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced

c) when the listener is executed I get a nasty:
java.lang.LinkageError: loader constraint violation: when resolving field “service” the class loader (instance of org/apache/felix/framework/ModuleImpl$ModuleClassLoader) of the referring class, org/apache/axis/client/Stub, and the class loader (instance of org/apache/catalina/loader/WebappClassLoader) for the field’s resolved type, org/apache/catalina/loader/WebappClassLoader, have different Class objects for that type
at
org.otrs.www.TicketConnector.GenericTicketConnector_BindingStub.(GenericTicketConnector_BindingStub.java:98)
This is the real show-stopper.

Could this be a simple Maven configuration issue?
thanks,

Michele


Source: eclipse

Leave a Reply