Sharing zk libs on Payara Server lead to "Unknown message code"

asked 2023-05-25 22:41:44 +0800

GiovanniDeMarco gravatar image GiovanniDeMarco
151 1

updated 2023-05-25 22:46:40 +0800

Hi everybody!

I want to share the ZK libraries (jars) among different web applications (wars) running on the Payara/Glassfish Application Server. I copied all the ZK jars in the "domains/myDomain/lib" folder and deployed my applications that uses ZK. At first all works fine but when i re-deploy any of the applications, the ZK framework fails somehow to retrieve the correct messages: i.e. when showing a messagebox the "OK" button is shown with the label "Unknown message code: 27112200".

The strangest thing is that if I restart the server the problem disappear (I have a proper "OK" button), but when deploying a new application or re-deploying an existing one, the messages return to be broken.

I don't know if the problem exists only in Payara Server or also in other Application Servers. There's a post on StackOverflow and it seems that the problem exists also in Tomcat Server (Sorry, I am not able to post the link because "my karma is insufficient to publish links").

Do you have any suggestions? I have to share the ZK framework jars because I want to share a common library for all the application with base Macro Components that all the applications have to use.

Thanks in advance for your help.

delete flag offensive retag edit


increased karma for posting images and links

jeanher ( 2023-05-26 09:43:05 +0800 )edit

Could you show the error stack trace in server console log if any?

hawk ( 2023-05-26 12:00:46 +0800 )edit

Here is the link of the Stack Overflow post with similar problem in Tomcat. In my case I have no Exceptions in the Server logs!

GiovanniDeMarco ( 2023-05-26 16:43:43 +0800 )edit

Thanks hawk for the link. I'm just a little confused: I'm not deploying EAR applications but WARs. As I said the reason I have to share ZK is 'cause I want to share Macro Components among different WARs. No problem for ZUL files but the Java classes of components won't work without sharing ZK jars.

GiovanniDeMarco ( 2023-05-26 22:09:47 +0800 )edit

4 Answers

Sort by ยป oldest newest most voted

answered 2023-05-29 17:05:02 +0800

hawk gravatar image hawk
3185 1 5
http://hawkphoenix.blogsp... ZK Team

For WAR case, you can put your macro component jar in a shared lib folder, separately from your WAR. For example.

[Tomcat HOME]
/lib / macro.jar
/webapp / yourapp.war

see https://github.com/zkoss/zkbooks/tree/master/mymodule

link publish delete flag offensive edit


Thank You hawk for the great example! This is exactly what I'm doing, except for the fact that my components are Java components and they are developed using a MVVM approach. So in the "macro.jar" I have to include also java classes (the java class of each component and the view models) .

GiovanniDeMarco ( 2023-05-29 17:47:54 +0800 )edit

So I have to "share" the ZK jars (otherwise I have a "ClassNotFound" exception for the ZK classes when I use my components).I tried to include them in the "macro.jar" and to directly put all the zk jars in the "lib" folder but the result is the same: after a deploy the "unknown message code" appears

GiovanniDeMarco ( 2023-05-29 17:49:43 +0800 )edit

answered 2023-05-30 13:58:15 +0800

GiovanniDeMarco gravatar image GiovanniDeMarco
151 1

updated 2023-05-30 16:46:25 +0800

hawk gravatar image hawk
3185 1 5
http://hawkphoenix.blogsp... ZK Team

These are the steps to reproduce the problem (using NetBeans):

  • Download Payara Server
  • Copy the ZK jars in the shared lib folder of Payara (payara_installation_dir/glassfish/domains/domain1/lib)
  • Add a reference to Payara in NetBeans (in Services Tabs - Servers - Add Server)
  • Create a sample ZK project as a Maven Web Application setting all the ZK dependencies as "<scope>provided</scope>"
  • In the "Properties" of the application
  • "Run" tab set the application to run on the Payara server
  • Create a simple zul page with a button that shows a message box
  • Run the application: this will start Payara and deploy the application
  • All is OK

image description

  • Run the application again: this will undeploy the application and redeploy it again
    • The message problem appears

image description

link publish delete flag offensive edit

answered 2023-05-30 17:25:45 +0800

hawk gravatar image hawk
3185 1 5
http://hawkphoenix.blogsp... ZK Team

updated 2023-05-30 17:26:06 +0800

If your Unknown message code: 27112200 is caused by the same error:

java.lang.IllegalStateException: The resources may not be accessed if they are not currently started.

It's not a zk-spefic issue, I found there are similar cases:

Since you mention "if I restart the server the problem disappear", I think it might be similar to this issue https://forum.zkoss.org/question/112063/zk9-internationalization-javalangillegalstateexception/ which is caused by classloading.

link publish delete flag offensive edit


In my case the server doesn't log any Exception. Yes I think is a classloading problem similar to the one in the last link you posted. Unfortunately I'm not using Spring or Spring Boot so I don't know what to do. I tried to disable caches as stated in the link but nothing changed.

GiovanniDeMarco ( 2023-05-30 18:13:37 +0800 )edit

answered 2023-05-31 11:06:34 +0800

hawk gravatar image hawk
3185 1 5
http://hawkphoenix.blogsp... ZK Team

updated 2023-05-31 11:06:58 +0800

If it's caused by classloading, I assume Payara server might behave similarly to spring-boot regarding reloading classes. maybe you can find a similar setting as spring-boot to always reload zk classes

see https://docs.payara.fish/community/docs/5.2021.5/documentation/payara-server/classloading.html

Otherwise, you need to restart every deployment.

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

1 follower



Asked: 2023-05-25 22:41:44 +0800

Seen: 16 times

Last updated: May 31

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More