[ https://issues.apache.org/jira/browse/GROOVY-11578?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17932196#comment-17932196 ]
Paul King commented on GROOVY-11578: ------------------------------------ The attached zip is a rework of the zip from GROOVY-10881. The integration test (passing for 4.0.26 and earlier) is shown here: {code:java} @RunWith(PaxExam.class) @ExamReactorStrategy(PerClass.class) public class GroovyJsonTest extends KarafTestSupport { @Configuration public Option[] config() { DefaultCompositeOption options = new DefaultCompositeOption(); options.add(super.config()); options.add(mavenBundle("org.apache.aries.spifly", "org.apache.aries.spifly.dynamic.bundle", "1.2.4")); options.add(mavenBundle("org.apache.groovy", "groovy", "4.0.26")); options.add(mavenBundle("org.apache.groovy", "groovy-json", "4.0.26")); File path = new File("../core/target/groovy-json-example.core-1.0.0-SNAPSHOT.jar"); options.add(bundle(path.toURI().toString())); return options.getOptions(); } @Test public void testFastStringUtils() throws Exception { GroovyService groovyService = getOsgiService(GroovyService.class); assertArrayEquals("result".toCharArray(), groovyService.getResult()); } } {code} If I change the spifly version to 1.3.0 or later, or use the "spifly" feature, the test then fails. > Services loaded via the service loader not working in (some) OSGi contexts > for Groovy 4+ > ---------------------------------------------------------------------------------------- > > Key: GROOVY-11578 > URL: https://issues.apache.org/jira/browse/GROOVY-11578 > Project: Groovy > Issue Type: Bug > Affects Versions: 4.0.26 > Reporter: Paul King > Assignee: Paul King > Priority: Major > Attachments: groovy-json-example.zip > > > This is related to GROOVY-11570 and GROOVY-11571 but it seems worthwhile > having an issue that is just about getting the services working again. > Current steps to reproduce: > * clone the apache/karaf repo > * change groovy versions: codehaus=>apache, 3.0.24=>4.0.26 > * add an additional test to GroovyTest (see below) to exercise service loader > related functionality > * run "mvn test" in the itests directory > Additional test: > {code} > @Test > public void testExecGroovyJsonCommand() throws Exception { > String resultNoArgs = executeCommand("groovy:exec \"" > + "import org.apache.groovy.json.internal.FastStringUtils\n" > + "println FastStringUtils.toCharArray('result') == > 'result'.toCharArray()\""); > assertContains("true", resultNoArgs); > } > {code} > Result: > {noformat} > <system-err><![CDATA[groovy:exec "import > org.apache.groovy.json.internal.FastStringUtils > println FastStringUtils.toCharArray('result') == 'result'.toCharArray()" > java.lang.RuntimeException: Unable to load FastStringService > at > org.apache.karaf.itests.KarafTestSupport.executeCommand(KarafTestSupport.java:444) > at > org.apache.karaf.itests.KarafTestSupport.executeCommand(KarafTestSupport.java:358) > at > org.apache.karaf.itests.KarafTestSupport.executeCommand(KarafTestSupport.java:345) > at > org.apache.karaf.itests.GroovyTest.testExecGroovyJsonCommand(GroovyTest.java:54) > ... > at > org.ops4j.pax.exam.invoker.junit.internal.ContainerTestRunner.runChild(ContainerTestRunner.java:43) > ... > Caused by: java.lang.RuntimeException: Unable to load FastStringService > at > org.apache.groovy.json.internal.FastStringUtils.getService(FastStringUtils.java:56) > ... > {noformat} -- This message was sent by Atlassian Jira (v8.20.10#820010)