My very simple test messaging system works perfectly fine in "development" mode when using the built-in "jetty" j2ee server for GWT under Eclipse. I can send and receive messages fine. When I build and run the code on tomcat, though, I can send messages (no errors) but I don't ever receive them (still no errors). I tried switching to the ActiveMQ enterprise messaging system (and followed the documentation described in the link https://isomorphic.atlassian.net/wiki/plugins/servlet/mobile#content/view/525029), but it's the same problem: no errors with either sending or attempt to receive, but I simply don't receive any messages. My Tomcat installation is pretty vanilla. Here's my test code to send:
and
And in case it helps, here's the key part in my tomcat configuration:
As well, here's some additional background info:Additional details:
======================
SmartGWT (not smartclient) Version: SmartClient Version: v8.3p_2012-11-26/PowerEdition Deployment (built 2012-11-26)
...
Browser: Chrome on Win 7
GWT SDK: 2.5.0rc2
Sun JDK 1.6.0_13
J2EE: Tomcat 6
OS: Centos 6.x
IDE: MyEclipse 10.6 with Google Plugin for Eclipse (3.1.0)
Code:
package com.smartgwt.sample.client.components;
import com.smartgwt.client.rpc.MessagingCallback;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.Button;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.sample.client.WnDialog;
import com.smartgwt.sample.client.util.SubscriberUtil;
public class MessageTestWindow extends WnDialog {
private DynamicForm dynamicForm;
private TextItem textItem;
private Button subscribeBtn;
private Button sendBtn;
private MessagingCallback messagingCallback;
private final String CHANNEL = "testChannel";
public MessageTestWindow() {
super(350, 250, "Message Test", "icons/Delete.png");
initialize();
initClickHandler();
}
private void initialize() {
this.subscribeBtn = new Button("Subscribe");
this.sendBtn = new Button("Send");
this.dynamicForm = new DynamicForm();
this.textItem = new TextItem("SendText");
this.textItem.setTitle("Send Text");
this.dynamicForm.setItems(textItem);
vsRoot.addMember(subscribeBtn);
vsRoot.addMember(dynamicForm);
vsRoot.addMember(sendBtn);
this.messagingCallback = new MessagingCallback() {
@Override
public void execute(Object data) {
SC.say("Message received: " + data);
}
};
}
private void initClickHandler() {
subscribeBtn.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
SubscriberUtil.subscribeToChannel(CHANNEL, messagingCallback);
}
});
sendBtn.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
String text = textItem.getValueAsString();
SubscriberUtil.sendMessage(CHANNEL, text);
}
});
}
}
Code:
package com.smartgwt.sample.client.util;
import com.smartgwt.client.rpc.Messaging;
import com.smartgwt.client.rpc.MessagingCallback;
import com.smartgwt.client.rpc.RPCCallback;
import com.smartgwt.client.rpc.RPCRequest;
import com.smartgwt.client.rpc.RPCResponse;
import com.smartgwt.client.util.SC;
import com.smartgwt.sample.client.IAConstants;
public class SubscriberUtil {
private static MessagingCallback messagingCallback = new MessagingCallback() {
@Override
public void execute(Object data) {
disconnect();
}
};
private static void disconnect() {
IAConstants.logOut(true);
}
public static void subscribeToChannel(String channel) {
Messaging.subscribe(channel, messagingCallback);
}
public static void subscribeToChannel(String channel,
MessagingCallback callback) {
Messaging.subscribe(channel, callback);
}
public static void unSubscribeFromChannel(String channel) {
Messaging.unsubscribe(channel);
}
public static void sendMessage(String channel, String message) {
Messaging.send(channel, message, new RPCCallback() {
@Override
public void execute(RPCResponse response, Object rawData,
RPCRequest request) {
if (response.getStatus() != RPCResponse.STATUS_SUCCESS)
SC.say("Failed to send message to server.");
}
});
}
public static void sendLoginMessage(String channel) {
Messaging.send(channel, "newSession", new RPCCallback() {
@Override
public void execute(RPCResponse response, Object rawData,
RPCRequest request) {
if (response.getStatus() != RPCResponse.STATUS_SUCCESS)
SC.say("Failed to send message to server.");
}
});
}
}
Code:
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<Connector className="org.apache.catalina.connector.http.HttpConnector"
port="8081" scheme="https" secure="true" protocol="HTTP/1.1"
connectionTimeout="20000"
proxyName="192.168.1.181"
proxyPort="8080"/>
======================
SmartGWT (not smartclient) Version: SmartClient Version: v8.3p_2012-11-26/PowerEdition Deployment (built 2012-11-26)
...
Browser: Chrome on Win 7
GWT SDK: 2.5.0rc2
Sun JDK 1.6.0_13
J2EE: Tomcat 6
OS: Centos 6.x
IDE: MyEclipse 10.6 with Google Plugin for Eclipse (3.1.0)
Comment