After upgrading "cucumber-picocontainer" from 1.2.5 to 5..0.0-RC1 getting "org.picocontainer.injectors.AbstractInjector$UnsatisfiableDependenciesException:"
See original GitHub issueAfter upgrading pico-container version 5.0.0-RC1 from 1.2.5 i have started getting error message and desperately looking for help as our current production code is failing due to this migration.
Any help asap would be appreciated.
Maven pom.xml change
Upgraded from this info.cukes cucumber-picocontainer 1.2.5
To this io.cucumber cucumber-picocontainer 5.0.0-RC1 test
I am creating an instance of page class during runtime using these 4 list of classes
Basepage.java
public class BasePage {
public static HomePage goToHomePage(Scenario scenario, String UserEmailID) {
Selenide.refresh();
if (WebDriverRunner.url().equalsIgnoreCase("https://www.footlocker.com/")) {
}
return page(HomePage.class);
}
}
BaseSteps.java
import io.cucumber.java8.En;
import org.picocontainer.annotations.Inject;
public class BaseSteps implements En {
@Inject
private PageContainer pageContainer;
protected void update(BasePage newPage) {
pageContainer.updatePage(newPage);
}
protected BasePage page() {
return pageContainer.getPage();
}
}
PageContainer.java
public class PageContainer {
private BasePage currentPage;
public void updatePage(BasePage newPage) {
currentPage = newPage;
}
public BasePage getPage() {
return currentPage;
}
}
PicoDependencyInjector.java
import io.cucumber.core.backend.ObjectFactory;
import io.cucumber.picocontainer.PicoFactory;
public class PicoDependencyInjector implements ObjectFactory {
private PicoFactory delegate = new PicoFactory();
public PicoDependencyInjector() {
addClass(PageContainer.class);
}
@Override
public void start() {
delegate.start();
}
@Override
public void stop() {
delegate.stop();
}
@Override
public boolean addClass(Class<?> aClass) {
return delegate.addClass(aClass);
}
@Override
public <T> T getInstance(Class<T> aClass) {
return delegate.getInstance(aClass);
}
}
cucumber.properties
io.cucumber.core.backend.ObjectFactory = com.footlocker.core.PicoDependencyInjector
Error i am getting is
org.picocontainer.injectors.AbstractInjector$UnsatisfiableDependenciesException: com.footlocker.steps.RegisterMultiUserSteps has unsatisfied dependency for fields [com.footlocker.core.PageContainer.pageContainer] from org.picocontainer.DefaultPicoContainer@661972b0:5<|
at org.picocontainer.injectors.AbstractFieldInjector.unsatisfiedDependencies(AbstractFieldInjector.java:30)
at org.picocontainer.injectors.IterativeInjector.getMatchingParameterListForSetters(IterativeInjector.java:104)
at org.picocontainer.injectors.IterativeInjector.access$000(IterativeInjector.java:33)
at org.picocontainer.injectors.IterativeInjector$2.run(IterativeInjector.java:153)
at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
at org.picocontainer.injectors.IterativeInjector.getComponentInstance(IterativeInjector.java:160)
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:678)
at io.cucumber.picocontainer.PicoFactory.getInstance(PicoFactory.java:47)
at io.cucumber.java8.Java8Backend.buildWorld(Java8Backend.java:62)
at io.cucumber.core.runner.Runner.buildBackendWorlds(Runner.java:165)
at io.cucumber.core.runner.Runner.runPickle(Runner.java:61)
at io.cucumber.junit.PickleRunners$NoStepDescriptions.run(PickleRunners.java:149)
at io.cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:83)
at io.cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:24)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at io.cucumber.junit.Cucumber.runChild(Cucumber.java:174)
at io.cucumber.junit.Cucumber.runChild(Cucumber.java:82)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at io.cucumber.junit.Cucumber$RunCucumber.evaluate(Cucumber.java:208)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
java - Pico container exception: org.picocontainer.injectors ...
This happening because you are trying to create constructors in stepdefination file without putting picocontainer dependency.
Read more >Using Dependency Injectors to Simplify Your Code in Cucumber
I am getting following error while implementing CustomFactory Pico Container. org.picocontainer.injectors.AbstractInjector$ ...
Read more >[JVM] PicoContainer UnsatisfiableDependenciesException ...
I run this either via gradle or inside of IntelliJ and get the same error, which is this: org.picocontainer.injectors.
Read more >Trap in issue for Pico Container | Selenium Forum
I am getting trapped in an issue related to cucumber picocontainer. My step defination HomePageSteps is not being executed.
Read more >Download cucumber-picocontainer JAR 1.2.5 With all ...
Artifact cucumber-picocontainer. Group info.cukes. Version 1.2.5. Last update 12. September 2016. Tags: https open projects maven sonatype repositories ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Heya, thanks for test driving RC1!
We’re using Service Provider Interfaces to detect
ObjectFactory
implementations now. To make sure your object factory is picked up by SPI you’ll have to create this file in your project:/src/main/resources/META-INF/services/io.cucumber.core.backend.ObjectFactory
And because you have more then one object factory on your class path, to disambiguate between the two your
cucumber.properties
file should contain:Since you are here. Would you mind commenting on this issue https://github.com/cucumber/cucumber/issues/568? We’re looking to create a list of companies that use Cucumber.
Resolved the doc issues in 0d864ca. The field scanning is too complicated for now. If some one wants to send a PR for it I’ll take it though.