[ http://jira.codehaus.org/browse/JBEHAVE-368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=240259#action_240259 ]
Daniel Godfrey edited comment on JBEHAVE-368 at 10/20/10 4:19 AM: ------------------------------------------------------------------ Yep, works fine thanks. was (Author: dgodfrey99): Yep, works fine. > Ensure same instance of EmbedderClassLoader is used to find and run stories > from Ant or Maven > --------------------------------------------------------------------------------------------- > > Key: JBEHAVE-368 > URL: http://jira.codehaus.org/browse/JBEHAVE-368 > Project: JBehave > Issue Type: Bug > Components: Ant Tasks, Maven Plugin > Affects Versions: 3.0.2 > Environment: Maven 2.2.1 and JDK 1.6 > Reporter: Daniel Godfrey > Assignee: Mauro Talevi > Fix For: 3.1 > > Attachments: jb.patch > > > I'm getting the following stacktrace when using the ServiceLoader > infrastructure in my JBehave steps while running under the maven plugin. I > think this is caused by using different class loaders to find the stories and > then to execute them. It starts working if I patch createClassLoader in > AbstractEmbedderMojo to cache the created classloader and to reuse that every > time. > java.lang.ClassCastException > at java.lang.Class.cast(Class.java:2990) > at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:345) > at java.util.ServiceLoader$1.next(ServiceLoader.java:421) > at > com.salerio.idm.service.AdaptorsModule.configure(AdaptorsModule.java:33) > at com.google.inject.AbstractModule.configure(AbstractModule.java:59) > at > com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223) > at com.google.inject.spi.Elements.getElements(Elements.java:101) > at com.google.inject.InjectorShell$Builder.build(InjectorShell.java:135) > at com.google.inject.InjectorBuilder.build(InjectorBuilder.java:102) > at com.google.inject.Guice.createInjector(Guice.java:92) > at com.google.inject.Guice.createInjector(Guice.java:69) > at functional.BaseFixture.initializeInjector(BaseFixture.java:272) > at functional.BaseFixture.initialize(BaseFixture.java:104) > at bdd.FixedIncomeSteps.init(FixedIncomeSteps.java:36) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:597) > at > org.jbehave.core.steps.StepCreator$BeforeOrAfter.run(StepCreator.java:348) > at org.jbehave.core.steps.StepCreator$1.perform(StepCreator.java:74) > at > org.jbehave.core.embedder.StoryRunner$FineSoFar.run(StoryRunner.java:202) > at org.jbehave.core.embedder.StoryRunner.runSteps(StoryRunner.java:187) > at > org.jbehave.core.embedder.StoryRunner.runStorySteps(StoryRunner.java:170) > at org.jbehave.core.embedder.StoryRunner.run(StoryRunner.java:84) > at org.jbehave.core.embedder.StoryRunner.run(StoryRunner.java:63) > at > org.jbehave.core.embedder.Embedder.runStoriesAsPaths(Embedder.java:194) > at bdd.MyStories.run(MyStories.java:52) > at > org.jbehave.core.embedder.Embedder.runStoriesWithAnnotatedEmbedderRunner(Embedder.java:137) > at > org.jbehave.mojo.RunStoriesWithAnnotatedEmbedderRunner.execute(RunStoriesWithAnnotatedEmbedderRunner.java:20) > at > org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180) > at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328) > at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138) > at org.apache.maven.cli.MavenCli.main(MavenCli.java:362) > at > org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:597) > at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) > at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) > at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) > at org.codehaus.classworlds.Launcher.main(Launcher.java:375) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email