<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{mso-style-priority:99;
mso-style-link:"Balloon Text Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:8.0pt;
font-family:"Tahoma","sans-serif";
mso-fareast-language:EN-US;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.BalloonTextChar
{mso-style-name:"Balloon Text Char";
mso-style-priority:99;
mso-style-link:"Balloon Text";
font-family:"Tahoma","sans-serif";}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:"Courier New";
mso-fareast-language:EN-AU;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:378437558;
mso-list-type:hybrid;
mso-list-template-ids:-169315850 201916439 201916441 201916443 201916431 201916441 201916443 201916431 201916441 201916443;}
@list l0:level1
{mso-level-number-format:alpha-lower;
mso-level-text:"%1\)";
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level2
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level3
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level4
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level5
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level6
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level7
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level8
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level9
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l1
{mso-list-id:1827555339;
mso-list-type:hybrid;
mso-list-template-ids:179864946 201916431 201916441 201916443 201916431 201916441 201916443 201916431 201916441 201916443;}
@list l1:level1
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l1:level2
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l1:level3
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l1:level4
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l1:level5
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l1:level6
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l1:level7
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l1:level8
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l1:level9
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-AU" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hi,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I’m creating a Groovy/JavaFX app which invokes an ant build script from a 3<sup>rd</sup> party software product installed on the same host. My app (Griffon) has a runtime dependency of slf4j-log4j12-1.7.10. I’ve also added ant-1.9.4 as
a compile dependency.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The ant build file imports other build scripts (from the 3rd party “scripts” folder) which import others and eventually the necessary taskdef and classpath refs are created – this classpath uses an older slf4j implantation containing: jcl-over-slf4j-1.5.2.jar,
slf4j-log4j12-1.5.2.jar, slf4j-api-1.5.2.jar<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">At runtime when I execute the target I’m seeing the following error and the ant task did not complete:<o:p></o:p></p>
<pre style="background:white"><b><span style="font-size:9.0pt;color:#000043">def </span></b><span style="font-size:9.0pt;color:black">antProject = </span><b><span style="font-size:9.0pt;color:#000043">new </span></b><span style="font-size:9.0pt;color:black">Project()<br>antProject.init()<br>ProjectHelper.<i>configureProject</i>(antProject, buildFile)<o:p></o:p></span></pre>
<pre style="background:white"><span style="font-size:9.0pt;color:black">antProject.executeTarget(</span><b><span style="font-size:9.0pt;color:green">'</span></b><span style="font-size:9.0pt;color:black">export</span><b><span style="font-size:9.0pt;color:green">'</span></b><span style="font-size:9.0pt;color:black">)<br><br><o:p></o:p></span></pre>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Caused by: java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V<o:p></o:p></p>
<p class="MsoNormal"> at org.apache.commons.logging.impl.SLF4JLocationAwareLog.warn(SLF4JLocationAwareLog.java:173)<o:p></o:p></p>
<p class="MsoNormal"> at org.apache.axis2.util.Loader.getResourceAsStream(Loader.java:140)<o:p></o:p></p>
<p class="MsoNormal"> at org.apache.axis2.deployment.FileSystemConfigurator.getAxisConfiguration(FileSystemConfigurator.java:113)<o:p></o:p></p>
<p class="MsoNormal"> at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:68)<o:p></o:p></p>
<p class="MsoNormal"> at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem(ConfigurationContextFactory.java:184)<o:p></o:p></p>
<p class="MsoNormal"> at org.apache.axis2.client.ServiceClient.configureServiceClient(ServiceClient.java:150)<o:p></o:p></p>
<p class="MsoNormal"> at org.apache.axis2.client.ServiceClient.<init>(ServiceClient.java:143)<o:p></o:p></p>
<p class="MsoNormal"> at org.apache.axis2.client.ServiceClient.<init>(ServiceClient.java:244)<o:p></o:p></p>
<p class="MsoNormal"> at org.apache.axis2.rpc.client.RPCServiceClient.<init>(RPCServiceClient.java:48)<o:p></o:p></p>
<p class="MsoNormal"> at com.tibco.amf.admin.api.servicefactory.remote.axis2.Axis2ProxyServiceFactory$Axis2ServiceInvocation.<init>(Axis2ProxyServiceFactory.java:185)<o:p></o:p></p>
<p class="MsoNormal"> at com.tibco.amf.admin.api.servicefactory.remote.axis2.Axis2ProxyServiceFactory.createService(Axis2ProxyServiceFactory.java:168)<o:p></o:p></p>
<p class="MsoNormal"> at com.tibco.amf.admin.api.servicefactory.remote.RemoteServicesRegistry.getRemoteServiceInstance(RemoteServicesRegistry.java:112)<o:p></o:p></p>
<p class="MsoNormal"> at com.tibco.amf.admin.cmdline.ServiceFactory.createService(ServiceFactory.java:196)<o:p></o:p></p>
<p class="MsoNormal"> at com.tibco.amf.admin.cmdline.CLIRegistry.getService(CLIRegistry.java:181)<o:p></o:p></p>
<p class="MsoNormal"> at com.tibco.amf.admin.cmdline.Processor.process(Processor.java:104)<o:p></o:p></p>
<p class="MsoNormal"> at com.tibco.amf.admin.cmdline.Processor.processChildren(Processor.java:39)<o:p></o:p></p>
<p class="MsoNormal"> at com.tibco.amf.admin.cmdline.ant.AMXAdminTask.process(AMXAdminTask.java:362)<o:p></o:p></p>
<p class="MsoNormal"> at com.tibco.amf.admin.cmdline.ant.AMXAdminTask.execute(AMXAdminTask.java:280)<o:p></o:p></p>
<p class="MsoNormal"> at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)<o:p></o:p></p>
<p class="MsoNormal"> at sun.reflect.GeneratedMethodAccessor26.invoke(Unknown Source)<o:p></o:p></p>
<p class="MsoNormal"> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)<o:p></o:p></p>
<p class="MsoNormal"> at java.lang.reflect.Method.invoke(Method.java:497)<o:p></o:p></p>
<p class="MsoNormal"> at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)<o:p></o:p></p>
<p class="MsoNormal"> ... 35 more<o:p></o:p></p>
<p class="MsoNormal">[2015-05-07 14:46:39,063] [JavaFX Application Thread] INFO griffon.javafx.JavaFXGriffonApplication - Shutdown is in process<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">My build.gradle<o:p></o:p></p>
<p class="MsoNormal">...<o:p></o:p></p>
<p class="MsoNormal">dependencies {<o:p></o:p></p>
<p class="MsoNormal"> griffon 'org.codehaus.griffon.plugins:griffon-miglayout-plugin:1.1.1'<o:p></o:p></p>
<p class="MsoNormal"> compile "org.codehaus.griffon:griffon-guice:${griffon.version}"
<o:p></o:p></p>
<p class="MsoNormal"> //compile 'org.apache.ant:ant:1.9.4'<o:p></o:p></p>
<p class="MsoNormal"> compile('org.apache.ant:ant-apache-log4j:1.9.4') {<o:p></o:p></p>
<p class="MsoNormal"> exclude group: 'log4j', module: 'log4j'<o:p></o:p></p>
<p class="MsoNormal"> }<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"> runtime('log4j:log4j:1.2.17') {<o:p></o:p></p>
<p class="MsoNormal"> exclude group: 'ant', module: 'ant-nodeps'<o:p></o:p></p>
<p class="MsoNormal"> exclude group: 'ant', module: 'ant-junit'<o:p></o:p></p>
<p class="MsoNormal"> exclude group: 'ant-contrib', module: 'ant-contrib'<o:p></o:p></p>
<p class="MsoNormal"> }<o:p></o:p></p>
<p class="MsoNormal"> runtime 'org.slf4j:slf4j-log4j12:1.7.10'<o:p></o:p></p>
<p class="MsoNormal"> //runtime 'org.slf4j:slf4j-jcl:1.7.10'<o:p></o:p></p>
<p class="MsoNormal"> //runtime 'org.slf4j:jcl-over-slf4j:1.7.10'<o:p></o:p></p>
<p class="MsoNormal"> runtime 'commons-logging:commons-logging:1.1.1'<o:p></o:p></p>
<p class="MsoNormal"> runtime 'org.apache.ant:ant-commons-logging:1.9.4'<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"> testCompile 'org.spockframework:spock-core:0.7-groovy-2.0'<o:p></o:p></p>
<p class="MsoNormal"> testCompile 'com.jayway.awaitility:awaitility-groovy:1.6.3'<o:p></o:p></p>
<p class="MsoNormal">}<o:p></o:p></p>
<p class="MsoNormal">...<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">My interpretation of this exception is:<o:p></o:p></p>
<p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l1 level1 lfo1"><![if !supportLists]><span style="mso-list:Ignore">1.<span style="font:7.0pt "Times New Roman"">
</span></span><![endif]>SLF4JLocationAwareLog has been loaded from slf4j<1.6 (i.e. jcl-over-slf4j-1.5.2.jar)<o:p></o:p></p>
<p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l1 level1 lfo1"><![if !supportLists]><span style="mso-list:Ignore">2.<span style="font:7.0pt "Times New Roman"">
</span></span><![endif]>LocationAwareLogger has been loaded from slf4j>=1.6 (i.e. slf4j-api-1.7.10.jar)<o:p></o:p></p>
<p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l1 level1 lfo1"><![if !supportLists]><span style="mso-list:Ignore">3.<span style="font:7.0pt "Times New Roman"">
</span></span><![endif]>I understand that slf4j isn’t binary compatible between 1.5 and 1.6 – and doesn’t like >1 binding on the classapath<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">What I don’t understand is if my Griffon/Gradle build project contains { runtime 'org.slf4j:slf4j-log4j12:1.7.10' } this means I’ve fulfilled slf4j’s requirement by providing the slf4j api and log4j12 binding.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">So ant’s taskdef classpath contains the 1.5.2 API – but I can’t change these scripts<o:p></o:p></p>
<p class="MsoNormal">For some reason slf4j picks jcl-over-slf4j-1.5.2 (the other choice being slf4j-log4j12-1.5.2) even though a binding has already been defined/loaded/used.<o:p></o:p></p>
<p class="MsoNormal">In the interim I can “make the error go away” by:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l0 level1 lfo2"><![if !supportLists]><span style="mso-list:Ignore">a)<span style="font:7.0pt "Times New Roman"">
</span></span><![endif]>Comment out runtime 'org.slf4j:slf4j-log4j12:1.7.10' – meaning no logging / noop?<o:p></o:p></p>
<p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l0 level1 lfo2"><![if !supportLists]><span style="mso-list:Ignore">b)<span style="font:7.0pt "Times New Roman"">
</span></span><![endif]>Comment in runtime ‘org.slf4j:jcl-over-slf4j:1.7.10’ – (I don’t really want JCL)<o:p></o:p></p>
<p class="MsoListParagraph"><o:p> </o:p></p>
<p class="MsoNormal">I’m running out of ideas– do I need to dig into the ant code & try and change the classpath (remove 1.7.10?) I don’t know if that would work if classes from 1.7.10 have already been loaded – I’m hoping there’s a really simple solution I’ve
just happened to overlook (like executing ant in a new process with a new classloader) but if anyone has a suggestion it would be appreciated.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Cheers,<o:p></o:p></p>
<p class="MsoNormal">Paul<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoListParagraph"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<FONT face="Courier New" size=2>
<P><BR>**********************************************************************<BR>This
message is intended for the addressee named and may contain <BR>privileged
information or confidential information or both. If you <BR>are not the intended
recipient please delete it and notify the
sender.<BR>**********************************************************************
</FONT></P>
</body>
</html>