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

Need to add slf4j dependency in Alternator pom.xml #37

Open
inder123 opened this issue Aug 30, 2012 · 9 comments
Open

Need to add slf4j dependency in Alternator pom.xml #37

inder123 opened this issue Aug 30, 2012 · 9 comments

Comments

@inder123
Copy link
Contributor

I added Alternator per the instructions in your readme. However, when I attempt to start the Alternator server, I ran into an exception (see below). It seems to me that you need to specify an additional dependency in your pom.xml?

java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.arrayFormat(Ljava/lang/String;[Ljava/lang/Object;)Lorg/slf4j/helpers/FormattingTuple;
at org.eclipse.jetty.util.log.JettyAwareLogger.log(JettyAwareLogger.java:613)
at org.eclipse.jetty.util.log.JettyAwareLogger.debug(JettyAwareLogger.java:200)
at org.eclipse.jetty.util.log.Slf4jLog.debug(Slf4jLog.java:84)
at org.eclipse.jetty.util.component.Container.add(Container.java:201)
at org.eclipse.jetty.util.component.Container.update(Container.java:164)
at org.eclipse.jetty.util.component.Container.update(Container.java:106)
at org.eclipse.jetty.server.Server.setConnectors(Server.java:183)
at org.eclipse.jetty.server.Server.addConnector(Server.java:157)
at com.michelboudreau.alternator.AlternatorDB.(AlternatorDB.java:41)
at com.michelboudreau.alternator.AlternatorDB.(AlternatorDB.java:24)
at com.trymph.user.server.persistence.DynamoDBMapperUserTest.setUp(DynamoDBMapperUserTest.java:27)
at junit.framework.TestCase.runBare(TestCase.java:128)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

@inder123
Copy link
Contributor Author

These additional dependencies did the trick for me:

<dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>slf4j-api</artifactId>
  <version>1.6.6</version>
</dependency>
<dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>log4j-over-slf4j</artifactId>
  <version>1.6.6</version>
</dependency>

The issue is discussed in: http://stackoverflow.com/questions/7165633/exception-thrown-while-using-logback-slf4j

@mboudreau
Copy link
Owner

Are you having this problem in the alternator project itself or in the app running it?

@mboudreau
Copy link
Owner

Was missing the log4j-over-slf4j dependency in pom file. It was working in our application because dependency was already present. Fixed in 0.2.7-SNAPSHOT.

@inder123
Copy link
Contributor Author

I had this problem in my project, not in Alternator.

@mboudreau
Copy link
Owner

Let me try it out in a new project to test it out.

@mboudreau
Copy link
Owner

Are you sure you incremented the version number to 0.2.7-SNAPSHOT? I just tried it on a new project which it started and stopped without issue.

@inder123
Copy link
Contributor Author

yes, I tried it with 0.2.7-SNAPSHOT.
I am able to continue forward by adding those dependencies in my pom.xml as well, so it is not a blocker for me.
This was mainly FYI.
Thanks.

@mboudreau
Copy link
Owner

I can't reproduce this error at all, if you can provide me with a small project that creates the error, I can find out what's the cause.

@inder123
Copy link
Contributor Author

inder123 commented Sep 7, 2012

I think the following two dependencies should be scoped to test instead of runtime or compile.
Only slf4j-api dependency should be set to compile.

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>log4j-over-slf4j</artifactId>
        <version>${slf4j.version}</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>1.0.0</version>
    </dependency>

Based on the guidelines in this doc:
http://veithen.blogspot.com/2009/10/taming-beast-managing-slf4j.html

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

No branches or pull requests

2 participants