zk框架:消息'未知消息代码:<code>&#39; instead of standart labels

时间:2017-04-13 14:51:57

标签: java servlets tomcat8 zk

I'm using ZK 8.0.1 and Tomcat 8.0.30.

I have several applications which are deployed to Tomcat. I put all zk jars to $CATALINA_BASE/lib because I want use one version of zk for all my applications.

My applications start and work fine except one thing. After some time of work I noticed that instead of all standard labels (e.g. label of buttons like 'yes', 'no') I see message in format Unknown message code : *code*. It happens in all zk applications. Right after start of server all labels is displayed correctly.

I detected a moment when I think it starts:

  1. open page of one application and click a button.
  2. event handler throws unhandled runtime exception.
  3. standard error dialog is showed but there is button with text Unknown message code:27112200 instead of OK.

After executing steps above all standard labels in all applications isn't displayed correctly.

A cause this problem is exception: java.lang.IllegalStateException: The resources may not be accessed if they are not currently started.

StackTrace:

org.apache.catalina.webresources.StandardRoot.validate(StandardRoot.java:245),
org.apache.catalina.webresources.StandardRoot.getResource(StandardRoot.java:212),
org.apache.catalina.webresources.StandardRoot.getResource(StandardRoot.java:206),
org.apache.catalina.core.ApplicationContext.getResource(ApplicationContext.java:554),
org.apache.catalina.core.ApplicationContextFacade.getResource(ApplicationContextFacade.java:199),
org.zkoss.web.util.resource.ServletLabelLocator.locate0(ServletLabelLocator.java:90),
org.zkoss.web.util.resource.ServletLabelLocator.locate(ServletLabelLocator.java:75),
org.zkoss.util.resource.impl.LabelLoaderImpl.loadLabels(LabelLoaderImpl.java:260),
org.zkoss.util.resource.impl.LabelLoaderImpl.getLabel(LabelLoaderImpl.java:118),
org.zkoss.util.resource.impl.LabelLoaderImpl.getLabel(LabelLoaderImpl.java:109),
org.zkoss.util.resource.Labels.getLabel(Labels.java:61),
org.zkoss.mesg.Messages.getFromBundle(Messages.java:81),
org.zkoss.mesg.Messages.getNotFound(Messages.java:105),
org.zkoss.mesg.Messages.get(Messages.java:157),
org.zkoss.mesg.Messages.get(Messages.java:52)....

Maybe somebody knows how to resolve this problem and what I do wrong.

1 个答案:

答案 0 :(得分:1)

可能有关系:

我遇到了“未知的消息代码&#39; zk-oss也有错误。当框架试图找到标准对话框按钮的本地化标签时出现这些标签,例如OK,CANCEL,YES,NO等,但无法找到适当的资源。

在debian上,以下内容为我解决了这个问题:

  1. dpkg-reconfigure locales(然后安装&#39; en_US.UTF-8&#39;)
  2. 重启servlet-container