google-code-export / gwt-test-utils

Automatically exported from code.google.com/p/gwt-test-utils
1 stars 0 forks source link

com.googlecode.gwt.test.exceptions.GwtTestPatchException: Error while scanning package 'com.googlecode.gwt.test.internal.patchers' #168

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. ant junit test runner with gwt-test-utils-0.41

What is the expected output? What do you see instead?
Expect it to compile and run.  Note that this is a different exception from 
when I use gwt-test-utils-0.38 in ant.  However, the identical classpath with 
the 0.38 jar in eclipse works perfectly (as long as I use module-file and not 
gwt-module in the properties file.)  The failure to run the test by ant with 
0.38 but successfully in eclipse is a separate problem that I've spent many 
days trying to track down.

What version of the product are you using? On what operating system?
gwt-2.4 with gwt-test-utils-0.41

Please provide any additional information below.
ant build particulars:
    <path id="gwt.classpath" cache="true">
        <pathelement location="${gwt.sdk}/gwt-user.jar" />
        <pathelement location="${gwt.sdk}/gwt-dev.jar" />
        <pathelement location="${gwt.sdk}/gwt-servlet.jar" />
        <pathelement location="${gwt.sdk}/gwt-servlet-deps.jar" />
        <pathelement location="${gwt.sdk}/validation-api-1.0.0.GA.jar" />
        <pathelement location="${gwt.sdk}/validation-api-1.0.0.GA-sources.jar" />
    </path>

    <path id="project.classpath" cache="true">
        <pathelement location="${src.dir}" />
        <pathelement location="${classes.dir}" />
        <pathelement location="${lib.dir}/logging/slf4j-api-1.6.6.jar" />
        <pathelement location="${lib.dir}/logging/slf4j-simple-1.6.6.jar" />
        <path refid="gwt.classpath" />
...
    </path>

    <path id="testing.classpath" cache="true">
        <path refid="project.classpath" />
        <pathelement path="${junit.output.dir}" />
        <pathelement location="${lib.dir}/gwt-testing/gwt-test-utils-0.41.jar" />
        <pathelement location="${lib.dir}/junit/junit-4.10.jar" />
        <pathelement location="${lib.dir}/junit/ant-junit4.jar" />
        <pathelement location="${lib.dir}/powermock-easymock/cglib-nodep-2.2.2.jar" />
        <pathelement location="${lib.dir}/powermock-easymock/easymock-3.1.jar" />
        <pathelement location="${lib.dir}/powermock-easymock/javassist-3.16.1-GA.jar" />
        <pathelement location="${lib.dir}/powermock-easymock/objenesis-1.2.jar" />
        <pathelement location="${lib.dir}/powermock-easymock/powermock-easymock-1.4.12-full.jar" />
    </path>

    <target name="gwt.unit.tests"
            depends="compile.tests"
            description="gwt unit tests run in dev mode">

        <copy todir="${junit.output.dir}">
            <fileset dir="${tests.dir}" excludes="*.java" />
        </copy>

        <mkdir dir="${gwt.tests.dir}" />
        <junit fork="no"
               dir="${junit.output.dir}"
               printsummary="withOutAndErr"
               haltonerror="true"
               haltonfailure="true"
               includeantruntime="true"
               showoutput="true">
            <jvmarg line="-Xmx256m" />
            <sysproperty key="gwt.args"
                         value="-standardsMode -logLevel DEBUG -war build/junit ${gwt.compile.mode}" />
            <sysproperty key="java.awt.headless" value="true" />

            <jvmarg value="${gwt.test.args}" />

            <classpath refid="testing.classpath" />

            <test name="com.xxx.SearchServiceTest"
                  todir="${gwt.tests.dir}">
                <formatter type="xml" />
            </test>
        </junit>
    </target>

Produces this stack trace:
com.googlecode.gwt.test.exceptions.GwtTestPatchException: Error while scanning 
package 'com.googlecode.gwt.test.internal.patchers'
    at com.googlecode.gwt.test.internal.ClassesScanner.scanPackages(ClassesScanner.java:68)
    at com.googlecode.gwt.test.internal.ConfigurationLoader.visitPatchClasses(ConfigurationLoader.java:197)
    at com.googlecode.gwt.test.internal.ConfigurationLoader.<init>(ConfigurationLoader.java:57)
    at com.googlecode.gwt.test.internal.GwtFactory.<init>(GwtFactory.java:87)
    at com.googlecode.gwt.test.internal.GwtFactory.initializeIfNeeded(GwtFactory.java:45)
    at com.googlecode.gwt.test.internal.junit.AbstractGwtRunner.<init>(AbstractGwtRunner.java:30)
    at com.googlecode.gwt.test.GwtRunner.<init>(GwtRunner.java:19)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.eclipse.ant.internal.core.ant.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
    at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:672)
    at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:498)
    at org.eclipse.ant.core.AntRunner.run(AntRunner.java:378)
    at org.eclipse.ant.internal.launching.launchConfigurations.AntLaunchDelegate$1.run(AntLaunchDelegate.java:298)
    at java.lang.Thread.run(Unknown Source)
Caused by: com.googlecode.gwt.test.exceptions.GwtTestPatchException: Cannot 
find class in the classpath : 
'com.googlecode.gwt.test.internal.patchers.AbstractHasDataPatcher'
    at com.googlecode.gwt.test.internal.GwtClassPool.getClass(GwtClassPool.java:27)
    at com.googlecode.gwt.test.internal.ClassesScanner.visitClass(ClassesScanner.java:107)
    at com.googlecode.gwt.test.internal.ClassesScanner.scanClassesFromJarFile(ClassesScanner.java:99)
    at com.googlecode.gwt.test.internal.ClassesScanner.scanPackages(ClassesScanner.java:62)

Original issue reported on code.google.com by rco...@gmail.com on 23 Oct 2012 at 6:22

GoogleCodeExporter commented 9 years ago
Note that that stack trace came from using eclipse's ant builder.  This one I 
get from running ant standalone:
com.googlecode.gwt.test.exceptions.GwtTestPatchException: Error while scanning 
package 'com.googlecode.gwt.test.internal.patchers'
    at com.googlecode.gwt.test.internal.ClassesScanner.scanPackages(ClassesScanner.java:68)
    at com.googlecode.gwt.test.internal.ConfigurationLoader.visitPatchClasses(ConfigurationLoader.java:197)
    at com.googlecode.gwt.test.internal.ConfigurationLoader.<init>(ConfigurationLoader.java:57)
    at com.googlecode.gwt.test.internal.GwtFactory.<init>(GwtFactory.java:87)
    at com.googlecode.gwt.test.internal.GwtFactory.initializeIfNeeded(GwtFactory.java:45)
    at com.googlecode.gwt.test.internal.junit.AbstractGwtRunner.<init>(AbstractGwtRunner.java:30)
    at com.googlecode.gwt.test.GwtRunner.<init>(GwtRunner.java:19)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
Caused by: com.googlecode.gwt.test.exceptions.GwtTestPatchException: Cannot 
find class in the classpath : 
'com.googlecode.gwt.test.internal.patchers.AbstractHasDataPatcher'
    at com.googlecode.gwt.test.internal.GwtClassPool.getClass(GwtClassPool.java:27)
    at com.googlecode.gwt.test.internal.ClassesScanner.visitClass(ClassesScanner.java:107)
    at com.googlecode.gwt.test.internal.ClassesScanner.scanClassesFromJarFile(ClassesScanner.java:99)
    at com.googlecode.gwt.test.internal.ClassesScanner.scanPackages(ClassesScanner.java:62)

Original comment by rco...@gmail.com on 23 Oct 2012 at 6:27

GoogleCodeExporter commented 9 years ago
gwt.unit.tests:
[echo] Classpath = C:\Users\xxx\src;
C:\Users\xxx\build\war\WEB-INF\classes;
C:\Users\xxx\libs\java\logging\slf4j-api-1.6.6.jar;
C:\Users\xxx\libs\java\logging\slf4j-simple-1.6.6.jar;
C:\Users\xxx\libs\java\gwt-2.4.0\gwt-user.jar;
C:\Users\xxx\libs\java\gwt-2.4.0\gwt-dev.jar;
C:\Users\xxx\libs\java\gwt-2.4.0\gwt-servlet.jar;
C:\Users\xxx\libs\java\gwt-2.4.0\gwt-servlet-deps.jar;
C:\Users\xxx\libs\java\gwt-2.4.0\validation-api-1.0.0.GA.jar;
C:\Users\xxx\libs\java\gwt-2.4.0\validation-api-1.0.0.GA-sources.jar;
C:\Users\xxx\build\junit;
C:\Users\xxx\libs\java\gwt-testing\gwt-test-utils-0.41.jar;
C:\Users\xxx\libs\java\junit\junit-4.10.jar;
C:\Users\xxx\libs\java\junit\ant-junit4.jar;
C:\Users\xxx\libs\java\powermock-easymock\cglib-nodep-2.2.2.jar;
C:\Users\xxx\libs\java\powermock-easymock\easymock-3.1.jar;
C:\Users\xxx\libs\java\powermock-easymock\javassist-3.16.1-GA.jar;
C:\Users\xxx\libs\java\powermock-easymock\objenesis-1.2.jar;
C:\Users\xxx\libs\java\powermock-easymock\powermock-easymock-1.4.12-full.jar
    [junit] dir attribute ignored if running in the same VM
    [junit] Running xxx.searchportal.client.SearchServiceTest
    [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0.063 sec

Original comment by rco...@gmail.com on 23 Oct 2012 at 6:56

GoogleCodeExporter commented 9 years ago
Okay, I found what caused this stack trace.  I had an @Ignore attached to the 
test.  I guess I did that to avoid the build error I must have forgotten about. 
 So, without the @Ignore on the test, the ant build runs with test-utils-0.38 
in the classpath.  So, eclipse and ant both behave well with identical 
classpaths.

However, changing the test-utils from 0.38 to 0.41 causes the build to fail, 
with this stack trace:
com.googlecode.gwt.test.exceptions.GwtTestException: Error while generating 
gwt-test-utils prerequisites
    at com.googlecode.gwt.test.internal.GwtFactory.<init>(GwtFactory.java:113)
    at com.googlecode.gwt.test.internal.GwtFactory.initializeIfNeeded(GwtFactory.java:45)
    at com.googlecode.gwt.test.internal.junit.AbstractGwtRunner.<init>(AbstractGwtRunner.java:30)
    at com.googlecode.gwt.test.GwtRunner.<init>(GwtRunner.java:19)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
Caused by: com.google.gwt.core.ext.UnableToCompleteException: (see previous log 
entries)
    at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:278)
    at com.google.gwt.dev.cfg.ModuleDefLoader$2.load(ModuleDefLoader.java:217)
    at com.google.gwt.dev.cfg.ModuleDefLoader.doLoadModule(ModuleDefLoader.java:324)
    at com.google.gwt.dev.cfg.ModuleDefLoader.createSyntheticModule(ModuleDefLoader.java:107)
    at com.googlecode.gwt.test.internal.GwtFactory.createModuleDef(GwtFactory.java:158)
    at com.googlecode.gwt.test.internal.GwtFactory.<init>(GwtFactory.java:105)

To repeat, the ONLY change between a working build and a non-working build is 
the change from gwt-test-utils-0.38.jar to gwt-test-utils-0.41.jar.

Original comment by rco...@gmail.com on 23 Oct 2012 at 7:45

GoogleCodeExporter commented 9 years ago
Could you please give the lastest 0.42-SNAPSHOT version a try ? I fixed some 
classpath issue a few days ago.

Original comment by gael.laz...@gmail.com on 25 Oct 2012 at 3:19

GoogleCodeExporter commented 9 years ago
Tried the new 0.42 released library and received the same exception.  
Specifically, the error is thrown in the GwtFactory on line 158, 

ModuleDefLoader.createSyntheticModule(GwtTreeLogger.get(),
               "com.googlecode.gwt.test.Aggregator", inherits, false)

throws:

com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
    at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:278)
    at com.google.gwt.dev.cfg.ModuleDefLoader$2.load(ModuleDefLoader.java:217)
    at com.google.gwt.dev.cfg.ModuleDefLoader.doLoadModule(ModuleDefLoader.java:324)
    at com.google.gwt.dev.cfg.ModuleDefLoader.createSyntheticModule(ModuleDefLoader.java:107)
    at com.googlecode.gwt.test.internal.GwtFactory.createModuleDef(GwtFactory.java:158)
    at com.googlecode.gwt.test.internal.GwtFactory.<init>(GwtFactory.java:105)
    at com.googlecode.gwt.test.internal.GwtFactory.initializeIfNeeded(GwtFactory.java:45)
    at com.googlecode.gwt.test.internal.junit.AbstractGwtRunner.<init>(AbstractGwtRunner.java:30)
    at com.googlecode.gwt.test.GwtRunner.<init>(GwtRunner.java:19)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
    at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
    at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
    at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
    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)

The final stack trace looks like:
com.googlecode.gwt.test.exceptions.GwtTestException: Error while generating 
gwt-test-utils prerequisites
    at com.googlecode.gwt.test.internal.GwtFactory.<init>(GwtFactory.java:113)
    at com.googlecode.gwt.test.internal.GwtFactory.initializeIfNeeded(GwtFactory.java:45)
    at com.googlecode.gwt.test.internal.junit.AbstractGwtRunner.<init>(AbstractGwtRunner.java:30)
    at com.googlecode.gwt.test.GwtRunner.<init>(GwtRunner.java:19)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
    at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
    at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
    at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
    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)
Caused by: com.google.gwt.core.ext.UnableToCompleteException: (see previous log 
entries)
    at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:278)
    at com.google.gwt.dev.cfg.ModuleDefLoader$2.load(ModuleDefLoader.java:217)
    at com.google.gwt.dev.cfg.ModuleDefLoader.doLoadModule(ModuleDefLoader.java:324)
    at com.google.gwt.dev.cfg.ModuleDefLoader.createSyntheticModule(ModuleDefLoader.java:107)
    at com.googlecode.gwt.test.internal.GwtFactory.createModuleDef(GwtFactory.java:158)
    at com.googlecode.gwt.test.internal.GwtFactory.<init>(GwtFactory.java:105)
    ... 21 more

Original comment by rco...@gmail.com on 29 Oct 2012 at 2:51

GoogleCodeExporter commented 9 years ago
When a UnableToCompleteException is throws, the actual error message is logged 
by a TreeLogger object from the GWT compiler API. gwt-test-utils provides an 
implemention of the TreeLogger interface which redirects logged error to slf4j. 
You could add a specific appender for the com.googlecode.gwt.test.GwtTreeLogger 
logger so you would have the original error message (which by default is 
redirected to System.out).

Could you copy past this error message ?

Original comment by gael.laz...@gmail.com on 29 Oct 2012 at 2:57

GoogleCodeExporter commented 9 years ago
Sorry if Im preaching to the converted but another way is just click on the 
exception stack trace in eclipse and setup a breakpoint on the gwt logger and 
take a peek at its error buffer.. 

This extends generally to all debugging...

Original comment by benjamin...@gmail.com on 9 Nov 2012 at 4:42

GoogleCodeExporter commented 9 years ago
K, I'm back working on this project and am looking for help solving my problem. 
 I upgraded to gwt 2.5 and test-utils-0.43 and have spent some time looking at 
the build log that I now write to.  I have set my log4j category thus:
log4j.appender.R = org.apache.log4j.RollingFileAppender
log4j.appender.R.File = build/build.log
log4j.appender.R.layout = org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d [%t] %p %c - %m %n
log4j.category.com.googlecode.gwt.test = ALL, R

When I run my testrunner using ant, I see this stacktrace:
com.googlecode.gwt.test.exceptions.GwtTestPatchException: Error while scanning 
package 'com.googlecode.gwt.test.internal.patchers'
    at com.googlecode.gwt.test.internal.ClassesScanner.scanPackages(ClassesScanner.java:68)
    at com.googlecode.gwt.test.internal.ConfigurationLoader.visitPatchClasses(ConfigurationLoader.java:285)
    at com.googlecode.gwt.test.internal.ConfigurationLoader.<init>(ConfigurationLoader.java:64)
    at com.googlecode.gwt.test.internal.GwtFactory.<init>(GwtFactory.java:87)
    at com.googlecode.gwt.test.internal.GwtFactory.initializeIfNeeded(GwtFactory.java:45)
    at com.googlecode.gwt.test.internal.junit.AbstractGwtRunner.<init>(AbstractGwtRunner.java:30)
    at com.googlecode.gwt.test.GwtRunner.<init>(GwtRunner.java:19)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
Caused by: com.googlecode.gwt.test.exceptions.GwtTestPatchException: Cannot 
find class in the classpath : 
'com.googlecode.gwt.test.internal.patchers.AbstractHasDataPatcher'
    at com.googlecode.gwt.test.internal.GwtClassPool.getClass(GwtClassPool.java:27)
    at com.googlecode.gwt.test.internal.ClassesScanner.visitClass(ClassesScanner.java:107)
    at com.googlecode.gwt.test.internal.ClassesScanner.scanClassesFromJarFile(ClassesScanner.java:99)
    at com.googlecode.gwt.test.internal.ClassesScanner.scanPackages(ClassesScanner.java:62)

and my output looks like:

2013-03-08 13:53:39,541 [main] DEBUG 
com.googlecode.gwt.test.internal.ConfigurationLoader - Load config file 
file:/C:/Users/rcoe/workspace/cadmportal/build/junit/META-INF/gwt-test-utils.pro
perties
2013-03-08 13:53:39,542 [main] DEBUG 
com.googlecode.gwt.test.internal.ConfigurationLoader - File loaded and 
processed 
file:/C:/Users/rcoe/workspace/cadmportal/build/junit/META-INF/gwt-test-utils.pro
perties
2013-03-08 13:53:39,542 [main] DEBUG 
com.googlecode.gwt.test.internal.ConfigurationLoader - Load config file 
jar:file:/C:/Users/rcoe/workspace/cadmportal/libs/java/gwt-test-utils-0.43/gwt-t
est-utils-0.43.jar!/META-INF/gwt-test-utils.properties
2013-03-08 13:53:39,544 [main] DEBUG 
com.googlecode.gwt.test.internal.ConfigurationLoader - File loaded and 
processed 
jar:file:/C:/Users/rcoe/workspace/cadmportal/libs/java/gwt-test-utils-0.43/gwt-t
est-utils-0.43.jar!/META-INF/gwt-test-utils.properties
2013-03-08 13:53:39,549 [main] DEBUG 
com.googlecode.gwt.test.internal.ClassesScanner - Scan package 
com.googlecode.gwt.test.internal.patchers
2013-03-08 13:53:39,551 [main] DEBUG 
com.googlecode.gwt.test.internal.ClassesScanner - Load classes from jar 
/C:/Users/rcoe/workspace/cadmportal/libs/java/gwt-test-utils-0.43/gwt-test-utils
-0.43.jar

Any ideas would be appreciated.

Original comment by rco...@gmail.com on 8 Mar 2013 at 7:19

GoogleCodeExporter commented 9 years ago
Same exception when using maven.
Works fine from Intellij.

Original comment by john.hewison on 7 May 2013 at 1:56