2016-09-14 9 views
0

オクラホマGWTで味付けされているわけではありません。往来し続けます。GWTエラー:「クラスはジンで使​​用されていますが、GWTクライアントコードでは使用できません」

私は春にArcbees GWTP Frameworkを使用しています。私のコードはとてもシンプルです。私は私のプレゼンタークラスで

public class EmailTask implements Serializable{ 
private static final long serialVersionUID = 2395809310736629787L; 

private Integer publisherId; 
private String targetPublisherId; 

public Integer getPublisherId() { 
    return publisherId; 
} 

public void setPublisherId(Integer publisherId) { 
    this.publisherId = publisherId; 
} 

public String getTargetPublisherId() { 
    return targetPublisherId; 
} 

public void setTargetPublisherId(String targetPublisherId) { 
    this.targetPublisherId = targetPublisherId; 
} 
} 

が、私はそうのように、コントローラへの非同期呼び出しを使用して、このPOJOのインスタンスを渡しているような単純なPOJOを持っています。

@Inject TaskServiceAsync taskServiceAsync; 

private void myTask(){ 
    taskServiceAsync.executeTask(emailTaskInstance, new AsyncCallback<String>() { 
       @Override 
       public void onSuccess(String result) { 
        Window.alert("Success"); 
       } 

       @Override 
       public void onFailure(Throwable caught) { 
        Window.alert("Failure!"); 
       } 
      }); 
} 

コントローラー:

@Controller 
@RequestMapping("/task") 
public class TaskController extends BaseRemoteService implements TaskService { 
    private static final long serialVersionUID = -325150527276255072L; 

    @Override 
    public String executeTask(EmailTask emailTask) { 
     //TODO: Doing something here 
    } 
} 

あなたが見ることができるように、派手すぎ何も。しかし、コンパイルで次のエラーが表示されます。

[INFO] --- gwt-maven-plugin:2.7.0:compile (default) @ statistics --- 

[INFO] Compiling module de.it2media.dps.statistics.DPSStatistics 

[INFO] Ignored 8 units with compilation errors in first pass. 

[INFO] Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors. 

[INFO] Computing all possible rebind results for 'com.gwtplatform.mvp.client.DesktopGinjector' 

[INFO]  Rebinding com.gwtplatform.mvp.client.DesktopGinjector 

[INFO]   Invoking generator 
com.google.gwt.inject.rebind.GinjectorGenerator 

[INFO]    [WARN] Class de.it2media.dps.statistics.server.jobs.EmailTask is used in Gin, but not available in GWT client code. 

[INFO]    [ERROR] Error injecting de.it2media.dps.statistics.client.application.settings.SettingsPresenter$MyProxy: Unable to create or inherit binding: No @Inject or default constructor found for de.it2media.dps.statistics.client.application.settings.SettingsPresenter$MyProxy 

私の単純な不平を許しても、私はここで間違っているのは得られません。私は前に同様のコードを書いており、それは完全に働いています。誰かがエラーClass is used in Gin, but not available in GWT client codeの意味を説明してください。どういうわけかどこかにオートワイヤリングする必要がありますか?

答えて

1

まず、実行中のGWTのlogLevelをTRACEに設定する必要があります。

TRACEを使用すると、クラス名と行番号でエラーが表示されます。

メッセージは、クラスde.it2media.dps.statistics.server.jobs.EmailTask がGIN(クライアント側)によって使用されているが、GWTによってコンパイルされるソースコードの一部ではないことを伝えます。

EmailTaskクラスを共有パッケージに入れて、メッセージを削除する必要があります。

+1

EmailTask​​のパッケージ自体は 'server'パッケージの中に何か問題があることを伝えるべきです。この回答のように、実際にどのように使用されることが予想されるかに応じて、共有またはクライアントに移動するか、クライアントコードからの参照をやめ、機能を構築する別の方法を見つけます。 –

関連する問題