简体   繁体   中英

GWT Compile Failure on gwt-UnitCache

This is related to a previous question I had about a Maven/Spring MVC GWT 2.6.1 project that I have.

For starters, ONLY Jdk 1.7 is installed on the machine, all others have been cleared out. I deleted any older versions of Eclipse or STS on my machine, so along with that there should be no previous installations of GWT SDK on this machine at all.

I deleted the .eclipse directory, and re-installed STS. Then I pulled down the 4.4 (Luna) GWT SDK and installed that. I have confirmed that this project cleans/compiles under the jdk 1.7.

So, The maven process works well compiling the code with jdk 1.7, the unit tests run, and everything seems fine until I get to the get:compile process.

I have turned on the all the logging, deleted the gwt-UnitCache directory, and still I get an issue.

Error saving unit to cache in: C:\Users\tholmes\git\rm_ui\target\gwt-unitCache
[INFO] java.io.EOFException
[INFO]  at java.io.RandomAccessFile.readInt(RandomAccessFile.java:827)
[INFO]  at com.google.gwt.dev.util.DiskCache.transferToStream(DiskCache.java:186)
[INFO]  at com.google.gwt.dev.util.DiskCacheToken.writeObject(DiskCacheToken.java:73)
[INFO]  at sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source)
[INFO]  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[INFO]  at java.lang.reflect.Method.invoke(Method.java:606)
[INFO]  at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988)
[INFO]  at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1495)
[INFO]  at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
[INFO]  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
[INFO]  at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547)
[INFO]  at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508)
[INFO]  at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
[INFO]  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
[INFO]  at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
[INFO]  at java.util.ArrayList.writeObject(ArrayList.java:742)
[INFO]  at sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source)
[INFO]  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[INFO]  at java.lang.reflect.Method.invoke(Method.java:606)
[INFO]  at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988)
[INFO]  at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1495)
[INFO]  at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
[INFO]  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
[INFO]  at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
[INFO]  at com.google.gwt.dev.javac.CachedCompilationUnit.writeObject(CachedCompilationUnit.java:223)
[INFO]  at sun.reflect.GeneratedMethodAccessor29.invoke(Unknown Source)
[INFO]  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[INFO]  at java.lang.reflect.Method.invoke(Method.java:606)
[INFO]  at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988)
[INFO]  at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1495)
[INFO]  at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
[INFO]  at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
[INFO]  at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
[INFO]  at com.google.gwt.dev.javac.PersistentUnitCache$6.run(PersistentUnitCache.java:492)
[INFO]  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
[INFO]  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
[INFO]  at java.lang.Thread.run(Thread.java:744)

If I go into the pom.xml and add: false I will no longer see this error message, but maven will fail nonetheless.

I'm now adding: c:/TMP to see if this helps. Any other suggestions are most welcome.

After a lot of research I finally found the answer.

This UI project is at the end of several other JARS that get created before the WAR is built.

I believe that one of those jars pulled in something that broke the GWT compile.

This web-site showed a similar problem:

http://grokbase.com/t/gg/google-web-toolkit/133sz6p6nx/java-lang-nullpointerexception-at-com-google-gwt-dev-util-diskcache-transfertostream-diskcache-java-187

And, so in the pom.xml of the GWT UI app, under the gwt-maven-plugin, under the configuration, I included:

<gwtSdkFirstInClasspath>true</gwtSdkFirstInClasspath>

and that solved the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM