Start jetty in external process #51

Closed
hgoebl opened this Issue Mar 15, 2012 · 4 comments

3 participants

@hgoebl

We have very nasty problems using Betamax with Java/Glassfish/Jersey

        <dependency>
            <groupId>org.glassfish.extras</groupId>
            <artifactId>glassfish-embedded-all</artifactId>
            <version>3.1.1</version>
            <scope>test</scope>
        </dependency>

The problem: jetty-server uses SLF4J 1.6.x and the fat pig glassfish-embedded-all carries SLF4J 1.5.6.

java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)
        at org.eclipse.jetty.util.log.JettyAwareLogger.log(JettyAwareLogger.java:591)
        at org.eclipse.jetty.util.log.JettyAwareLogger.debug(JettyAwareLogger.java:193)
        at org.eclipse.jetty.util.log.Slf4jLog.debug(Slf4jLog.java:92)
        at org.eclipse.jetty.util.log.Log.initialized(Log.java:80)
        at org.eclipse.jetty.util.log.Log.getLogger(Log.java:357)
        at org.eclipse.jetty.util.log.Log.getLogger(Log.java:347)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.<clinit>(AbstractLifeCycle.java:28)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at betamax.proxy.jetty.ProxyServer.class$(ProxyServer.groovy)
        at betamax.proxy.jetty.ProxyServer.$get$$class$betamax$proxy$jetty$ProxyHandler(ProxyServer.groovy)
        at betamax.proxy.jetty.ProxyServer.start(ProxyServer.groovy:30)

I tried to change the order of dependencies but didn't find a solution.
A patched version of glassfish-embedded-all w/o SLF4J didn't work either.

Would it be possible to start jetty in an external process?

@robfletcher

I've been bitten by this too. It's particularly nasty because Jetty doesn't express its slf4j dependency via maven; it's an optional runtime dependency.

I think what you propose is a good idea. You could then run a Betamax 'server' either standalone or with a forked process from a maven/gradle build. The annotated tests would just override proxy settings so they connected to the running Betamax .

@hgoebl

I'd like to help you, at least with some testing, if you like.
Tell me, if I can support you (Java knowledge: excellent, Groovy: not yet).

BTW, would #47 for using HttpClient decorator solve the issue with jetty? Maybe this would be a better investment?

@robfletcher

Yes #47 would also solve the issue but I'd like to maintain the proxy as an option & I think it would be valuable to implement this functionality.

@cowboygneox

I apologize that this has gone for so long overlooked. We currently do not have plans to support running Betamax in a forked process. Our most recent efforts have been to simplify, refactor, and reduce dependencies. I would say a fork is a natural evolution as long as we can get it to play nice with Maven, but we're still a ways out from that.

If you're still interested, we should discuss a feature request and build some acceptance criteria.

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