Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP Server Autostart with JavaConfig fails with IllegalStateException: STARTED #179

Closed
karnis opened this issue Dec 15, 2016 · 1 comment
Milestone

Comments

@karnis
Copy link
Contributor

karnis commented Dec 15, 2016

Enabling http server autostart when using javaconfig fails in 2.6.2:

@Configuration
public class HttpServerTestConfig  {  
  @Bean
  public HttpServer httpServer() {
    return CitrusEndpoints.http().server().autoStart(true).port(10001).build();
  }
}
@ContextConfiguration(classes = { HttpServerTestConfig.class })
public class HttpServerTest extends JUnit4CitrusTestRunner {

  @CitrusEndpoint(name = "httpServer")
  HttpServer httpServer;

  @Test
  @CitrusTest
  public void sendGetStatusRequest(@CitrusResource TestContext context) {
    echo("hello world");
  }
}
Caused by: java.lang.IllegalStateException: STARTED
	at org.eclipse.jetty.server.handler.HandlerWrapper.setServer(HandlerWrapper.java:110)
	at org.eclipse.jetty.server.handler.HandlerWrapper.setHandler(HandlerWrapper.java:84)
	at org.eclipse.jetty.servlet.ServletContextHandler.relinkHandlers(ServletContextHandler.java:201)
	at org.eclipse.jetty.servlet.ServletContextHandler.setServletHandler(ServletContextHandler.java:507)
	at com.consol.citrus.http.server.HttpServer.startup(HttpServer.java:169)
	at com.consol.citrus.server.AbstractServer.start(AbstractServer.java:90)
	at com.consol.citrus.server.AbstractServer.afterPropertiesSet(AbstractServer.java:162)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
@christophd
Copy link
Member

Thanks for reporting. This issue has already been fixed with #177 and is included in 2.6.3-SNAPSHOT and 2.7-SNAPSHOT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants