我正在使用ImmutableCollections编写代码。我在我的类路径中包含了gwt-guava,guava和jsr305罐子。我正在使用ant编译并运行测试。我一直从GWT / Junit测试执行阶段得到运行时错误。除了堆栈跟踪本身之外,ForwardingImmutableCollection的代码标记如下,这是否表明在ForwardingImmutableCollection被GWT序列化之前这将不起作用?
// TODO:使这个类GWT可序列化。 class ForwardingImmutableCollection扩展了ImmutableCollection {
运行时错误堆栈跟踪:
[junit] ------------- Standard Output ---------------
[junit] 0 [main] INFO {gwt-log} () - database file path is /Users/glick/alpp-sqlite.db
[junit] 371 [main] INFO {gwt-log} () - ProtocolServiceImpl.init
[junit] 371 [main] WARN {gwt-log} () - This is a 'WARN' test message in ProtocolServiceImpl.init
[junit] 371 [main] ERROR {gwt-log} () - This is a 'ERROR' test message in ProtocolServiceImpl.init
[junit] 371 [main] FATAL {gwt-log} () - This is a 'FATAL' test message ProtocolServiceImpl.init
[junit] 1250 [main] ERROR {gwt-log} () - an UNKNOWN USER was encountered with userId "0"
[junit] 1751 [main] ERROR {gwt-log} () - an UNKNOWN USER was encountered with userId "11"
[junit] 1754 [main] ERROR {gwt-log} () - an UNKNOWN USER was encountered with userId "11"
[junit] 1764 [main] ERROR {gwt-log} () - an UNKNOWN USER was encountered with userId "11"
[junit] logging for HtmlUnit thread
[junit] [WARN] Expected content type of 'application/javascript' or 'application/ecmascript' for remotely loaded JavaScript element at 'http://192.168.1.13:52522/com.abacalab.alpp.ALPP.JUnit/com.abacalab.alpp.ALPP.JUnit.nocache.js', but got 'application/x-javascript'.
[junit] [ERROR] Errors in 'jar:file:/m2-repo/com/google/guava/guava-gwt/10.0.1/guava-gwt-10.0.1.jar!/com/google/common/collect/super/com/google/common/collect/ForwardingImmutableCollection.java'
[junit] [ERROR] Line 21: The import javax.annotation.Nullable cannot be resolved
[junit] [ERROR] Line 42: Nullable cannot be resolved to a type
[junit] [ERROR] Errors in 'jar:file:/m2-repo/com/google/guava/guava-gwt/10.0.1/guava-gwt-10.0.1.jar!/com/google/common/collect/super/com/google/common/collect/ImmutableCollection.java'
[junit] [ERROR] Line 25: The import javax.annotation.Nullable cannot be resolved
[junit] [ERROR] Line 67: Nullable cannot be resolved to a type
[junit] ------------- ---------------- ---------------
[junit] Testcase: testStub(com.abacalab.alpp.client.GwtRpcStubTest): Caused an ERROR
[junit] Remote test failed at 192.168.1.13 / Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.19) Gecko/2010031422 Firefox/3.0.19
[junit] java.lang.RuntimeException: Remote test failed at 192.168.1.13 / Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.19) Gecko/2010031422 Firefox/3.0.19
[junit] at com.google.gwt.junit.JUnitShell.processTestResult(JUnitShell.java:1288)
[junit] at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:1408)
[junit] at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:1309)
[junit] at com.google.gwt.junit.JUnitShell.runTest(JUnitShell.java:653)
[junit] at com.google.gwt.junit.client.GWTTestCase.runTest(GWTTestCase.java:441)
[junit] at com.google.gwt.junit.client.GWTTestCase.run(GWTTestCase.java:296)
[junit] Caused by: java.lang.Error: Unresolved compilation problems:
[junit] The import javax.annotation.Nullable cannot be resolved
[junit] Nullable cannot be resolved to a type
[junit]
[junit] at com.google.common.collect.ForwardingImmutableCollection.<init>(ForwardingImmutableCollection.java:21)
[junit] at com.google.common.collect.ImmutableSet.<init>(ImmutableSet.java:44)
[junit] at com.google.common.collect.ImmutableSet.<init>(ImmutableSet.java:48)
[junit] at com.google.common.collect.EmptyImmutableSet.<init>(EmptyImmutableSet.java:24)
[junit] at com.google.common.collect.EmptyImmutableSet.<clinit>(EmptyImmutableSet.java:26)
[junit] at com.google.common.collect.ImmutableSet.of(ImmutableSet.java:54)
[junit] at com.google.common.collect.ImmutableSet.copyOf(ImmutableSet.java:125)
[junit] at com.google.common.collect.ImmutableSet.copyOf(ImmutableSet.java:120)
[junit] at com.google.common.collect.ImmutableSet.copyOf(ImmutableSet.java:110)
[junit] at com.abacalab.alpp.shared.ConcretePrivilegeSetProvider.getPrivilegeSet(ConcretePrivilegeSetProvider.java:88)
答案 0 :(得分:0)
看起来你只需要将jsr305放入你的类路径中:
Caused by: java.lang.Error: Unresolved compilation problems:
[junit] The import javax.annotation.Nullable cannot be resolved
[junit] Nullable cannot be resolved to a type