有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java我们不能在GAE中使用集合或集合作为返回类型吗?

在我的代码中,我使用了Set<Employees>作为函数addEmp()的返回类型

所以,我遇到了一个编译错误。错误是:

Compiling module com.employeedepartmentgae.Employeedepartmentgae
   Refreshing module from source
      Validating newly compiled units
         Removing units with errors
            [ERROR] Errors in 'file:/home/wissen18/employeedepartmentgae/src/com/employeedepartmentgae/client/GreetingServiceAsync.java'
               [ERROR] Line 6: The import com.employeedepartmentgae.server.domainobject.Employee cannot be resolved
               [ERROR] Line 18: Employee cannot be resolved to a type
            [ERROR] Errors in 'file:/home/wissen18/employeedepartmentgae/src/com/employeedepartmentgae/client/GreetingService.java'
               [ERROR] Line 6: The import com.employeedepartmentgae.server.domainobject.Employee cannot be resolved
               [ERROR] Line 20: Employee cannot be resolved to a type
            [ERROR] Errors in 'file:/home/wissen18/employeedepartmentgae/src/com/employeedepartmentgae/client/EmployeeWidget.java'
               [ERROR] Line 12: The import com.employeedepartmentgae.server.domainobject.Employee cannot be resolved
               [ERROR] Line 75: The method addEmp(String, String, String, AsyncCallback>) from the type GreetingServiceAsync refers to the missing type Employee
               [ERROR] Line 75: The type new AsyncCallback>(){} must implement the inherited abstract method AsyncCallback>.onSuccess(Set)
               [ERROR] Line 75: Employee cannot be resolved to a type
               [ERROR] Line 94: The method onSuccess(Set) of type new AsyncCallback>(){} must override or implement a supertype method
               [ERROR] Line 94: Employee cannot be resolved to a type
               [ERROR] Line 96: Employee cannot be resolved to a type
               [ERROR] Line 96: Employee cannot be resolved to a type
               [ERROR] Line 98: Employee cannot be resolved to a type
         Removing invalidated units
            [WARN] Compilation unit 'file:/home/wissen18/employeedepartmentgae/src/com/employeedepartmentgae/client/Employeedepartmentgae.java' is removed due to invalid reference(s):
               [WARN] file:/home/wissen18/employeedepartmentgae/src/com/employeedepartmentgae/client/EmployeeWidget.java
            [WARN] Compilation unit 'file:/home/wissen18/employeedepartmentgae/src/com/employeedepartmentgae/client/DepartmentWidget.java' is removed due to invalid reference(s):
               [WARN] file:/home/wissen18/employeedepartmentgae/src/com/employeedepartmentgae/client/GreetingService.java
               [WARN] file:/home/wissen18/employeedepartmentgae/src/com/employeedepartmentgae/client/GreetingServiceAsync.java
   Computing all possible rebind results for 'com.employeedepartmentgae.client.Employeedepartmentgae'
      Rebinding com.employeedepartmentgae.client.Employeedepartmentgae
         Checking rule 
            [ERROR] Unable to find type 'com.employeedepartmentgae.client.Employeedepartmentgae'
               [ERROR] Hint: Previous compiler errors may have made this type unavailable
               [ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly

所以请帮帮我


共 (1) 个答案

  1. # 1 楼答案

    这不是GAE问题,但您没有提到您使用的GWT存在问题

    从堆栈跟踪来看,Employee类似乎使用了未正确实现的AsyncCallback


    [错误]第75行:键入new AsyncCallback>;(){}必须实现继承的抽象方法AsyncCallback>;。成功(套) ...

    我的建议是查看GWT文档,并创建HelloWorld应用程序,它将在其中创建一个示例RPC