azagniotov/stubby4j

Help wanted: java.lang.IllegalArgumentException: No selectors

Closed this issue · 2 comments

Hi,

I'm trying to start Stubby but i'm getting a IllegalArgumentException when doing so.
I tried to parse the YAML file to make sure that it is Stubby-proof, and it seems to work. So that doesn't seems to be the problem.
Can someone please tell me what i'm doing wrong?

    private static final int STUB_PORT = 4200;
    private static final int ADMIN_PORT = 8822;
    private static final String STUB_YAML_LOC = "stubdata.yml";

    public Stubby() {
        startStub();
    }

    public void startStub() {
        try {
            File configFile = new File(STUB_YAML_LOC);
            List<StubHttpLifecycle> list = new YAMLParser().parse(configFile.getParent(), configFile);
            stubbyClient.startJetty(STUB_PORT, ADMIN_PORT, STUB_YAML_LOC);
            LOGGER.info("Stubby successfully started.");
        } catch (Exception e) {
            LOGGER.error("Error while starting Stubby", e);
        }
    }

Stacktrace

15:03:26.794 [main] ERROR eu.***.test.automation.library.Stubby - Error while starting Stubby
java.lang.IllegalArgumentException: No selectors
	at org.eclipse.jetty.io.SelectorManager.<init>(SelectorManager.java:64)
	at org.eclipse.jetty.server.ServerConnector$ServerConnectorManager.<init>(ServerConnector.java:524)
	at org.eclipse.jetty.server.ServerConnector.newSelectorManager(ServerConnector.java:232)
	at org.eclipse.jetty.server.ServerConnector.<init>(ServerConnector.java:225)
	at org.eclipse.jetty.server.ServerConnector.<init>(ServerConnector.java:147)
	at io.github.azagniotov.stubby4j.server.JettyFactory.buildAdminConnector(JettyFactory.java:202)
	at io.github.azagniotov.stubby4j.server.JettyFactory.buildConnectors(JettyFactory.java:190)
	at io.github.azagniotov.stubby4j.server.JettyFactory.construct(JettyFactory.java:98)
	at io.github.azagniotov.stubby4j.server.StubbyManagerFactory.construct(StubbyManagerFactory.java:53)
	at io.github.azagniotov.stubby4j.client.StubbyClient.startJetty(StubbyClient.java:137)
	at io.github.azagniotov.stubby4j.client.StubbyClient.startJetty(StubbyClient.java:86)
	at eu.***.test.automation.library.Stubby.startStub(Stubby.java:29)
	at eu.***.test.automation.library.Stubby.<init>(Stubby.java:22)
	at eu.***.test.stepdefs.generic.TestDataStepDefs.<init>(TestDataStepDefs.java:10)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at cucumber.runtime.java.DefaultJavaObjectFactory.cacheNewInstance(DefaultJavaObjectFactory.java:41)
	at cucumber.runtime.java.DefaultJavaObjectFactory.getInstance(DefaultJavaObjectFactory.java:33)
	at cucumber.runtime.java.JavaBackend.buildWorld(JavaBackend.java:124)
	at cucumber.runner.Runner.buildBackendWorlds(Runner.java:155)
	at cucumber.runner.Runner.runPickle(Runner.java:78)
	at cucumber.runtime.junit.PickleRunners$NoStepDescriptions.run(PickleRunners.java:140)
	at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:68)
	at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:23)
	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 cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:73)
	at cucumber.api.junit.Cucumber.runChild(Cucumber.java:117)
	at cucumber.api.junit.Cucumber.runChild(Cucumber.java:55)
	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 cucumber.api.junit.Cucumber$1.evaluate(Cucumber.java:126)
	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.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

Yaml data file

- request:
    url: ^/backend/api/v1/version$
    method: GET
  response:
    status: 200
    headers:
      Content-Type: application/json
    body: >
      {"applicationName": "backend","version": "0.0.1"}

Hi,

Thanks for your quick reply.
There was a Jetty dependecy on my classpath comming from Selenium. After i excluded that Jetty dependency it started working without any problems.

So, thanks a lot 👍