-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi !!
I'm still working on a clustering example, this is my new issue (thanks for the last help) :D
I will omit all the clustering configuration (unless you need this information). Here is a .zul fragment:
<label id="myLabel" value="0"/>
<button id="myButton" label="Generate Value (smart)" forward="onClick=onClickGenerate()">
<attribute w:name="onClick">
<![CDATA[
var value = 'XXX';
var myLabel = this.$f('myLabel');
myLabel.setValue(value);
myLabel.smartUpdate('value', value);
]]>
</attribute>
</button>
<button label="Generate Value (server)" forward="onClick=onClickGenerate2()"/>
Here is a java bean fragment:
public class MyBean extends GenericForwardComposer implements Serializable {
private Label myLabel;
public void doAfterCompose(Component comp) {
try {
super.doAfterCompose(comp);
myLabel.setAttribute("org.zkoss.zk.ui.updateByClient", true);
} catch (Exception e) {}
}
public void onClickGenerate(ForwardEvent event){
System.out.println("Label value: " + myLabel.getValue());
}
public void onClickGenerate2(ForwardEvent event){
myLabel.setValue("ZZZ");
}
}
The zk.xml
<zk>
<system-config>
<ui-factory-class>org.zkoss.zk.ui.http.SerializableUiFactory</ui-factory-class>
</system-config>
<listener>
<listener-class>org.zkoss.zkplus.cluster.ClusterSessionPatch</listener-class>
</listener>
<device-config>
<device-type>ajax</device-type>
<timeout-uri>/timeout.zul</timeout-uri>
</device-config>
</zk>
As you can see, it only has two ways of updating the label value (through smartUpdate in the client side or invoking the server side).
There're two test cases:
1. Two Tomcat nodes in the same machine.
2. Two Tomcat nodes in different machines.
In the first case there is no problem, in the second case... when I press a button (no matter which one) I'm redirected to the timeout.zul page with its famous message:
"The page or component you request is no longer available. This is normally caused by timeout, opening too many Web pages, or rebooting the server"
I've tried a lot of alternatives reading other different clustering posts, but without success (maybe I'm missing something).
Any help will be appreciated.
Thank you very much :D
That sounds like the clustering is not working at all, so I don't think this is really a ZK problem. Can you look at Tomcat logs and look for clustering-related info? I haven't used native Tomcat clustering in a while, so I might be wrong, but both nodes should report in their log files that they see the other node. Because case 2 doesn't work, it seems that it's some kind of networking configuration problem. Posting the clustering configuration might help in this case.
Here's one more thing you can try: Try running this code on both servers:
System.out.println(java.net.InetAddress.getLocalHost().getHostAddress())
That's the address which will be considered the default "external IP" where the other node will try to connect. If you get strange IPs or 127.0.0.1, that's the reason for your problems. The external IP must be something the other node can connect to, and it can be forced to a fixed value in Tomcat cluster configuration if the automatic value is not correct (set the address attribute in the Receiver element).
Have you this tag in your web.xml?
web.xml
<distributable/>
best Stephan
Same problem occurred with Jboss also.Its work with jsp but whenever we move to zul it occures timeout.(Simple Button click events gives the same result). Your help will appreciated , Thanks !!
natoosandeep ( 2013-08-12 08:06:50 +0800 )editSame problem occurred with Jboss also.Its work with jsp but whenever we move to zul it occures timeout.(Simple Button click events gives the same result). Your help will appreciated , Thanks !!
Hello carpolva,
Please refer to the following url's in order to configure your installation:
http://books.zkoss.org/wiki/ZKInstallationGuide/SettingupServers/Tomcat_Cluster
http://books.zkoss.org/wiki/SmallTalks/2007/April/HowtoRunZKonApache%2BTomcatclustering,Part_I
If you still have issues, then please post your configuration.
Best Regards,
Darksu
Asked: 2013-01-29 20:31:51 +0800
Seen: 68 times
Last updated: Jan 18 '15
ZK Clustering, Session Replication Question [closed]
ZK how to stop OnClick event of tab? [closed]
Execute Javascript on component visible
How do I prevent dynamic tooltip to show when there is no text?
Search button in tutorial does not work
Issue in Tab close event enhancement