2

I'm hitting occasional Java Linkage errors when using the Grails Release plugin and am completely stumped as to how to resolve the problem. I would appreciate some suggestions. The errors vary but are in the same area.

I'm seeing the following types of error messages when trying to run publish-plugin:

09:32:36 | Generating POM file.....
09:32:36 | Error Error executing script PublishPlugin: Class org.apache.http.message.BasicNameValuePair does not implement the requested interface org.apache.http.NameValuePair (Use --stacktrace to see the full trace)

Another example with a stacktrace is:

09:08:57 | Error java.lang.LinkageError: loader constraint violation: when resolving method "org.apache.http.impl.cookie.NetscapeDraftHeaderParser.parseHeader(Lorg/apache/http/util/CharArrayBuffer;Lorg/apache/http/message/ParserCursor;)Lorg/apache/http/HeaderElement;" the class loader (instance of groovy/lang/GroovyClassLoader) of the current class, org/apache/http/impl/cookie/BestMatchSpec, and the class loader (instance of org/codehaus/groovy/grails/cli/support/GrailsRootLoader) for resolved class, org/apache/http/impl/cookie/NetscapeDraftHeaderParser, have different Class objects for the type arser.parseHeader(Lorg/apache/http/util/CharArrayBuffer;Lorg/apache/http/message/ParserCursor;)Lorg/apache/http/HeaderElement; used in the signature
09:08:57 | Error    at org.apache.http.impl.cookie.BestMatchSpec.parse(BestMatchSpec.java:134)
09:08:57 | Error    at org.apache.http.client.protocol.ResponseProcessCookies.processCookies(ResponseProcessCookies.java:115)
09:08:57 | Error    at org.apache.http.client.protocol.ResponseProcessCookies.process(ResponseProcessCookies.java:96)
09:08:57 | Error    at org.apache.http.protocol.ImmutableHttpProcessor.process(ImmutableHttpProcessor.java:117)
09:08:57 | Error    at org.apache.http.protocol.HttpRequestExecutor.postProcess(HttpRequestExecutor.java:345)
09:08:57 | Error    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:528)
09:08:57 | Error    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
09:08:57 | Error    at org.apache.http.impl.client.DecompressingHttpClient.execute(DecompressingHttpClient.java:137)
09:08:57 | Error    at org.eclipse.aether.transport.http.HttpTransporter.execute(HttpTransporter.java:294)
09:08:57 | Error    at org.eclipse.aether.transport.http.HttpTransporter.implGet(HttpTransporter.java:250)
09:08:57 | Error    at org.eclipse.aether.spi.connector.transport.AbstractTransporter.get(AbstractTransporter.java:59)
09:08:57 | Error    at org.eclipse.aether.connector.basic.BasicRepositoryConnector$GetTaskRunner.runTask(BasicRepositoryConnector.java:418)
09:08:57 | Error    at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:337)
09:08:57 | Error    at org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:67)

Running the command again, directly afterwards often succeeds.

I believe the problem is related to or caused by grails bundling a version of httpcore (4.2.4), but my desire to use a newer version (4.4.1)

I have tried excluding httpcore in the inherits('global') section of build config:

inherits('global') {
    excludes 'httpcore'
} 

as suggested by this answer How to exclude grails global dependency to no avail and also other specific dependencies suggested by this answer Grails --- loader constraint violation. I have also upgraded to the latest version of the release plugin.

The error happens as part of our Jenkins build process using grails 2.3.8 running on RedHat Linux 7 and JDK 1.7.0 (I have also tried a number of update versions to see if that is the problem)

Community
  • 1
  • 1
John Lear
  • 46
  • 4
  • Same issue here - might happen up to 3 times in a row but it's often resolved after a rerun indeed – Cyril Dec 07 '15 at 05:34
  • We have this same issue as well, but not in Jenkins, just when trying to run publish-plugin from command line. Have so far been unable to resolve (edit: grails 2.5.1) – Trebla Sep 14 '16 at 19:18

0 Answers0