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

Guice configuration error #19

Closed
Hapi opened this issue Oct 22, 2010 · 4 comments
Closed

Guice configuration error #19

Hapi opened this issue Oct 22, 2010 · 4 comments

Comments

@Hapi
Copy link

Hapi commented Oct 22, 2010

Environment

  • Mac OSX 10.6.4
  • Java version: 1.6.0_20
  • Apache Maven 2.2.0 (r788681; 2009-06-26 16:04:01+0300)
  • Eclipse Helios: Build id: 20100917-0705
  • TestNG 5.14.2
  • TesNG Eclipse plugin 5.14.2.9
  • pom.xml (see below)

Issue

Even the simplest project cannot be run because of the Guice configuration error. The same is true no matter are tests run from Eclipse or from command line using Maven. The test class contains a single static method is tested with a single test method (i.e. the simplest possible test configuration).

The latest working version of TestNG on my env is 5.11.

pom.xml

4.0.0 com.hapiware.test testng-tester 1.0-SNAPSHOT
<build>
    <finalName>testng-tester</finalName>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.5</source>
                <target>1.5</target>
            </configuration>
        </plugin>
        <plugin>
            <inherited>true</inherited>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <executions>
                <execution>
                    <id>attach-sources</id>
                    <goals>
                        <goal>jar</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
                <archive>
                    <manifest>
                        <mainClass>com.hapiware.test.tester</mainClass>
                    </manifest>
                    <manifestEntries>
                        <Implementation-Title>${build.finalName}</Implementation-Title> 
                        <Implementation-Version>${project.version}</Implementation-Version>
                        <Implementation-Vendor>http://www.hapiware.com</Implementation-Vendor>
                    </manifestEntries>
                </archive>
            </configuration>
        </plugin>
    </plugins>
</build>

<dependencies>
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>[5.0,)</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>[4.0,)</version>
        <scope>test</scope>
    </dependency>
</dependencies>

<reporting>
    <outputDirectory>target/site</outputDirectory>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-project-info-reports-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jxr-maven-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-pmd-plugin</artifactId>
            <configuration>
                <targetJdk>1.5</targetJdk>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <configuration>
              <maxmemory>1024m</maxmemory>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-report-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>cobertura-maven-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>findbugs-maven-plugin</artifactId>
            <configuration>
                <threshold>Normal</threshold>
            </configuration>
        </plugin>
    </plugins>
</reporting>
## Stack trace
Setting connection parameters:127.0.0.1:59020
com.google.inject.CreationException: Guice configuration errors:

1) Error at org.testng.internal.Configuration.m_configurable(Configuration.java:54):
 Binding to org.testng.IConfigurable not found. No bindings to that type were found.

2) Error at org.testng.internal.Configuration.m_hookable(Configuration.java:44):
 Binding to org.testng.IHookable not found. No bindings to that type were found.

3) Error at org.testng.internal.Configuration.m_objectFactory(Configuration.java:10):
 Binding to org.testng.IObjectFactory not found. No bindings to that type were found.

4) Error at org.testng.internal.annotations.JDK15AnnotationFinder.m_transformer(JDK15AnnotationFinder.java:51):
 Binding to org.testng.IAnnotationTransformer not found. No bindings to that type were found.

4 error[s]
    at com.google.inject.BinderImpl.createInjector(BinderImpl.java:277)
    at com.google.inject.Guice.createInjector(Guice.java:79)
    at com.google.inject.Guice.createInjector(Guice.java:53)
    at com.google.inject.Guice.createInjector(Guice.java:43)
    at org.testng.TestNG.initializeInjector(TestNG.java:791)
    at org.testng.TestNG.createSuiteRunner(TestNG.java:1044)
    at org.testng.TestNG.createSuiteRunners(TestNG.java:1031)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:877)
    at org.testng.TestNG.run(TestNG.java:818)
    at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:89)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:144)
@cbeust
Copy link
Collaborator

cbeust commented Oct 22, 2010

Could you include your test file as well, so I can reproduce exactly what you are seeing?

Thanks.

@cbeust
Copy link
Collaborator

cbeust commented Oct 22, 2010

One more thing: the stack trace is showing RemoteTestNG, which is only used by the Eclipse plug-in. How are you invoking TestNG exactly?

@Hapi
Copy link
Author

Hapi commented Oct 22, 2010

Here is the main class:
package com.hapiware.test;

public class tester
{
    public static void main(String[] args)
    {
        System.out.println(add(1, 3));

    }
    public static int add(int a, int b)
    {
        return a + b;
    }
}

And here is the test class:
package com.hapiware.test;

import org.testng.annotations.Test;

public class TesterTest
{
    @Test
    public void test()
    {
        tester.add(1, 2);
    }
}

Notice

Exactly the same result can be achieved by using maven: mvn clean test

The result is then something like this:

...-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running TestSuite
org.apache.maven.surefire.booter.SurefireExecutionException: Guice configuration errors:

1) Error at org.testng.internal.Configuration.m_configurable(Configuration.java:54):
 Binding to org.testng.IConfigurable not found. No bindings to that type were found.

2) Error at org.testng.internal.Configuration.m_hookable(Configuration.java:44):
 Binding to org.testng.IHookable not found. No bindings to that type were found.

3) Error at org.testng.internal.Configuration.m_objectFactory(Configuration.java:10):
 Binding to org.testng.IObjectFactory not found. No bindings to that type were found.

4) Error at org.testng.internal.annotations.JDK15AnnotationFinder.m_transformer(JDK15AnnotationFinder.java:51):
 Binding to org.testng.IAnnotationTransformer not found. No bindings to that type were found.

4 error[s]; nested exception is com.google.inject.CreationException: Guice configuration errors:

1) Error at org.testng.internal.Configuration.m_configurable(Configuration.java:54):
 Binding to org.testng.IConfigurable not found. No bindings to that type were found.

2) Error at org.testng.internal.Configuration.m_hookable(Configuration.java:44):
 Binding to org.testng.IHookable not found. No bindings to that type were found.

3) Error at org.testng.internal.Configuration.m_objectFactory(Configuration.java:10):
 Binding to org.testng.IObjectFactory not found. No bindings to that type were found.

4) Error at org.testng.internal.annotations.JDK15AnnotationFinder.m_transformer(JDK15AnnotationFinder.java:51):
 Binding to org.testng.IAnnotationTransformer not found. No bindings to that type were found.

4 error[s]
com.google.inject.CreationException: Guice configuration errors:

1) Error at org.testng.internal.Configuration.m_configurable(Configuration.java:54):
 Binding to org.testng.IConfigurable not found. No bindings to that type were found.

2) Error at org.testng.internal.Configuration.m_hookable(Configuration.java:44):
 Binding to org.testng.IHookable not found. No bindings to that type were found.

3) Error at org.testng.internal.Configuration.m_objectFactory(Configuration.java:10):
 Binding to org.testng.IObjectFactory not found. No bindings to that type were found.

4) Error at org.testng.internal.annotations.JDK15AnnotationFinder.m_transformer(JDK15AnnotationFinder.java:51):
 Binding to org.testng.IAnnotationTransformer not found. No bindings to that type were found.

4 error[s]
        at com.google.inject.BinderImpl.createInjector(BinderImpl.java:277)
        at com.google.inject.Guice.createInjector(Guice.java:79)
        at com.google.inject.Guice.createInjector(Guice.java:53)
        at com.google.inject.Guice.createInjector(Guice.java:43)
        at org.testng.TestNG.initializeInjector(TestNG.java:787)
        at org.testng.TestNG.initializeCommandLineSuites(TestNG.java:720)
        at org.testng.TestNG.run(TestNG.java:796)
        at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:62)
        at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:141)
        at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
        at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] There are test failures.
...

@Hapi
Copy link
Author

Hapi commented Oct 22, 2010

Forgot to add Eclipse commands. The procedure was:

  1. Cmd-Shift-F11 (Run Last Launched)
  2. Select TestNG, if asked

Then later on, Cmd-Shift-F11

I have built up the Eclipse environment by using Maven: mvn eclipse:clean eclipse:eclipse and then using Import... command from Eclipse.

This issue was closed.
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