最近Grailsを使用しようとしましたが、gwtクライアント部分をgrailsプロジェクトに統合したいと考えています。私は、GrailsのGWTプラグインを使用していますが、最終的にこの1を除いて、すべてのコンパイルエラーを修正していますGrails gwtモジュールでClassNotFoundExceptionが発生しました
Compiling module com.CalendarMVP
| Resolving com.client.mvp.AppPlaceHistoryMapper
| Found type 'com.client.mvp.AppPlaceHistoryMapper'
| [ERROR] Annotation error: cannot resolve com.client.place.HelloPlace$Tokenizer
| java.lang.ClassNotFoundException: com.client.place.HelloPlace$Tokenizer
そして、私はまた、受け取ることを除いてGreetingsPlace $トークナイザとUserPlace $トークナイザで同じ繰り返し、:
[ERROR] Annotation error: expected class java.lang.Class, got null
このクラスはAppPlaceHistoryMapper用ビルトインActivitiesAndPlaces framework.Theコードを使用して自分のMVPパターン実現の一部は、このようなあるある:
package com.client.mvp;
import com.google.gwt.place.shared.PlaceHistoryMapper;
import com.google.gwt.place.shared.WithTokenizers;
import com.client.place.GoodbyePlace;
import com.client.place.GreetingsPlace;
import com.client.place.HelloPlace;
import com.client.place.ManagerCalendarPlace;
import com.client.place.ManagerPlace;
import com.client.place.UserPlace;
@WithTokenizers({ HelloPlace.Tokenizer.class, GoodbyePlace.Tokenizer.class,
GreetingsPlace.Tokenizer.class, ManagerPlace.Tokenizer.class,
UserPlace.Tokenizer.class, ManagerCalendarPlace.Tokenizer.class
})
public interface AppPlaceHistoryMapper extends PlaceHistoryMapper {
}
とHelloPlaceのために:
package com.client.place;
import com.google.gwt.place.shared.Place;
import com.google.gwt.place.shared.PlaceTokenizer;
public class HelloPlace extends Place {
private String helloName;
public HelloPlace(String token)
{
this.helloName = token;
}
public String getHelloName()
{
return helloName;
}
public static class Tokenizer implements PlaceTokenizer<HelloPlace>
{
@Override
public String getToken(HelloPlace place)
{
return place.getHelloName();
}
@Override
public HelloPlace getPlace(String token)
{
return new HelloPlace(token);
}
}
}
エラーリストの最後に、私も持っている:
Computing all possible rebind results for 'com.client.mvp.AppPlaceHistoryMapper'
| Rebinding com.client.mvp.AppPlaceHistoryMapper
| Invoking generator com.google.gwt.place.rebind.PlaceHistoryMapperGenerator
| [ERROR] Generator 'com.google.gwt.place.rebind.PlaceHistoryMapperGenerator' threw an exception while rebinding 'com.client.mvp.AppPlaceHistoryMapper'
| java.lang.NullPointerException
と:
onModuleLoad()私は、このような方法でAppPlaceHistoryMapperを作成するには[WARN] For the following type(s), generated source was never committed (did you forget to call commit()?)
| [WARN] com.client.mvp.AppPlaceHistoryMapperImpl
| [ERROR] Errors in 'file:/D:/Naukma/Programing/JavaEE/STSworkspace/SocSystemGrails/src/gwt/com/client/CalendarMVP.java'
| [ERROR] Line 47: Failed to resolve 'com.client.mvp.AppPlaceHistoryMapper' via deferred binding
:
public void onModuleLoad()
{
ClientFactory clientFactory = GWT.create(ClientFactoryImpl.class);
EventBus eventBus = clientFactory.getEventBus();
PlaceController placeController = clientFactory.getPlaceController();
ActivityMapper activityMapper = new AppActivityMapper(clientFactory);
ActivityManager activityManager = new ActivityManager(activityMapper, eventBus);
activityManager.setDisplay(appWidget);
AppPlaceHistoryMapper historyMapper= GWT.create(AppPlaceHistoryMapper.class);
PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper);
historyHandler.register(placeController, eventBus, defaultPlace);
RootPanel.get().add(appWidget);
// Goes to place represented on URL or default place
historyHandler.handleCurrentHistory();
}
Grailsとの作業を開始し、おそらく私は何かを手掛けています。誰か助けてくれますか?
あなたの 'client'フォルダの下に' AppPlaceHistoryMapper'がありますか? – Strelok
はい、私のMVPクラスはすべて "client"フォルダにあります。com.client。*のようなパッケージになっています。*はexmpleの場所です。 AppPlaceHistoryMapperはcom.client.mvpにあります。また、 "client"フォルダはGrails GWTプラグインによって自動的に作成された "gwt"フォルダにあります。 – ferbolg