Hi
I've got another problem with errai, right know I wanted to test calling rpc in errai way, but unfortunately with no luck. Here is
the simple class which I'm using to test rpc communication :
@EntryPoint
public class Test {
private MessageBus bus;
/**
* @param bus
*/
@Inject
public Test(MessageBus bus) {
super();
this.bus = bus;
}
/*
* (non-Javadoc)
*
* @see com.google.gwt.core.client.EntryPoint#onModuleLoad()
*/
@PostConstruct
public void init() {
final VerticalPanel panel = new VerticalPanel();
final TextBox inputBox = new TextBox();
final Button sendBroadcast = new Button("Broadcast!");
sendBroadcast.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
System.out.println("click");
MessageBuilder.createMessage().toSubject("BroadcastService")
.signalling().with("BroadcastText", inputBox.getText())
.noErrorHandling().sendNowWith(bus);
}
});
final Label broadcastReceive = new Label();
bus.subscribe("BroadcastReceiver", new MessageCallback() {
@Override
public void callback(Message message) {
String broadcastText = message.get(String.class,"BroadcastText");
broadcastReceive.setText(broadcastText);
}
});
panel.add(inputBox);
panel.add(sendBroadcast);
panel.add(broadcastReceive);
final Button callRpcButton = new Button("Call rpc");
final Label callRpcLabel = new Label();
final UserAssignmentManager call;
try {
call = MessageBuilder.createCall(new RemoteCallback<Boolean>() {
@Override
public void callback(Boolean response) {
if (response) {
callRpcLabel.setText("Yes");
} else {
callRpcLabel.setText("No");
}
}
}, UserAssignmentManager.class);
callRpcButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
call.isFirstRun();
}
});
} catch (RuntimeException e) {
e.printStackTrace();
}
panel.add(callRpcButton);
panel.add(callRpcLabel);
RootPanel.get().add(panel);
}
}
As you can see this is very simple scenario, first to check if errai works at all I'm sending and receiving broadcast message and it works perfectly.
CDI integration on the server side works as expected.
Then I try to test rpc calls and unfortunately I get following RuntimeException with message :
No service definition for: java.lang.Class
This exception comes from line 52 of the AbstractRemoteCallBuilder class.
This message should be :
No service definition for: pl.scentia.smartoffice.test.UserAssignmentManager
But that's not the case, the real problem for me is that it can't obtain proxy object for my class. Everything looks like in the rpc example included in the errai-weld distribution.
UserAssignmentManager has @Remote annotation, the service is properly configured, on the server side everything seems to be all right.
Errai and errai-weld has been build today, so its pretty fresh. The main difference betwen my project and errai-weld example is that I don't have errai-jboss.sar I have errai packaged inside ear. But as I sad sending messages works as expected.
Do you have any suggestions what am I doing wrong ?
Regards
Marcin Misiewicz