forgot to mention, if you need dedicated help please contact our support https://www.zkoss.org/support
cor3000 ( 2020-10-28 10:31:09 +0800 )edit-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi all,
after 10 years we have migrated our UI from ZK 3.6 to 8.5
I guess something fundamentally must have changed? When I try to invoke a function on an object I get the following error:
Attempt to resolve method: onSelectListbox() on undefined variable or class name: AppListWindow
Our zul code is unchanged and worked with version 3.6:
<window
use="de.xxx.xxx.admin.zk.controller.AppListWindow"
xmlns:h="...//www.w3.org/1999/xhtml" id="AppListWindow">
...
...
...
<hbox>
<vbox>
<listbox model="@{appList}"
selectedItem="@{AppListWindow.selectedApp}"
id="appListbox"
onSelect="AppListWindow.onSelectListbox()"
width="450px">
So why does it claim that AppListWindow is undefined? Any advices?
Regards Jens
no idea/suggestion yet why this fails in your case. I tried a simplified version of what you presented in this zkfiddle, where it works (you can pick a specific ZK version there).
So technically this can work. On your side there must be something not covered in my simple version that makes it fail. Can you add the missing bits to reproduce the failure in zkfiddle? (I'll increase your Karma so you can post links).
In case you can't share more code in public -> please contact our support.
Hi,
in the meanwhile I got rid of this error but ran into a new one. But I think they are linked somehow.
Before I got this "undefined class name" error I had a "bsh namespace error". So after some googling I found out that I have to include BSH as dependency in my pom.xml. Which I already found suspicious. Why is ZK not providing its own BSH? So I included this:
<dependency>
<groupId>bsh</groupId>
<artifactId>bsh</artifactId>
<version>1.3.0</version>
</dependency>
Which lead to above undefined error. After changing the version to the newest version 2.0b4 this error was gone. But now im running into a "Not unique in ID space" which can't be the true error, because every ID is unique (it would have been also a problem with the old ZK version). Looking at the stacktrace I see that there is also again BSH involved. So I guess it is still coming from this.
So my question now is: why did I need to provide BSH in the first place? Does this indicate that there is something wrong in my setup?
Currently it looks like this:
<!-- ZK start -->
<dependency>
<groupId>org.zkoss.zk</groupId>
<artifactId>zk</artifactId>
<version>${zk.version}</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/webapp/lib/zk-8.5.0.jar</systemPath>
</dependency>
<dependency>
<groupId>org.zkoss.zk</groupId>
<artifactId>zul</artifactId>
<version>${zk.version}</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/webapp/lib/zul-8.5.0.jar</systemPath>
</dependency>
<dependency>
<groupId>org.zkoss.common</groupId>
<artifactId>zcommon</artifactId>
<version>${zk.version}</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/webapp/lib/zcommon-8.5.0.jar</systemPath>
</dependency>
<dependency>
<groupId>org.zkoss.zk</groupId>
<artifactId>zkbind</artifactId>
<version>8.5.0</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/webapp/lib/zkbind-8.5.0.jar</systemPath>
</dependency>
<dependency>
<groupId>org.zkoss.zk</groupId>
<artifactId>zhtml</artifactId>
<version>${zk.version}</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/webapp/lib/zhtml-8.5.0.jar</systemPath>
</dependency>
<dependency>
<groupId>org.zkoss.zk</groupId>
<artifactId>zkplus</artifactId>
<version>${zk.version}</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/webapp/lib/zkplus-8.5.0.jar</systemPath>
</dependency>
<dependency>
<groupId>org.zkoss.zk</groupId>
<artifactId>zkspring-core</artifactId>
<version>4.0.0</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/webapp/lib/zkspring-core-4.0.0.jar</systemPath>
</dependency>
<dependency>
<groupId>org.zkoss.zk</groupId>
<artifactId>zkspring-security</artifactId>
<version>4.0.0</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/webapp/lib/zkspring-security-4.0.0.jar</systemPath>
</dependency>
<dependency>
<groupId>org.zkoss.zkforge.el</groupId>
<artifactId>zcommons-el</artifactId>
<version>1.1.0</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/webapp/lib/zcommons-el-1.1.0.jar</systemPath>
</dependency>
<dependency>
<groupId>org.zkoss.common</groupId>
<artifactId>zweb</artifactId>
<version>${zk.version}</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/webapp/lib/zweb-8.5.0.jar</systemPath>
</dependency>
<dependency>
<groupId>org.zkoss.zk</groupId>
<artifactId>zkex</artifactId>
<version>3.6.3</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/webapp/lib/zkex-3.6.3.jar</systemPath>
</dependency>
<dependency>
<groupId>bsh</groupId>
<artifactId>bsh</artifactId>
<version>2.0b4</version>
</dependency>
<!-- ZK end -->
Your maven config looks a bit 'unusual', basically undermining one of the core maven features: the automatic dependency resolution. By specifying every ZK dependency as <scope>system</scope>
you effectively disable the transitive dependencies.
Please remove those and instead add the zk repositories to your pom file so that dependencies (and their nested dependencies) are downloaded instead of referring to them inside your source code.
That's the job of the maven war plugin to move the dependency jars into the WEB-INF/lib folder. Then also the bsh2.0b4.jar will be included.
Next thing: don't mix ZK jar versions. zul/zk.jar... 8.5.0 won't cooperate with zkex 3.6.3 ... not a chance.
here ZK maven structure documented: https://www.zkoss.org/wiki/ZKInstallationGuide/SettingupIDE/Maven/ResolvingZKFrameworkArtifactsvia_Maven
forgot to mention, if you need dedicated help please contact our support https://www.zkoss.org/support
cor3000 ( 2020-10-28 10:31:09 +0800 )editThanks for your answer.
Unfortunately I cannot use remote maven repositories outside of our company network. And our company maven repository doesn't include zk dependencies. So I have to provide those jars by myself.
After switching to the new zkex version it looks much better now and I get more reasonable exceptions like: "Method setValign not found for class org.zkoss.zul.Hbox". Which looks like normal migration work for me.
But I still have some weird behavior. When clicking a certain button the first click after server start always leads to a Null Pointer Exception (still have to investigate what happens there) and every further click on this button leads to this "not unique in ID space".
So I guess I will have to investigate further and will come back here if I found out something new.
OK understand ... yes then if that's the limitation of your current environment, there are little options, between system scoped dependencies or a local maven repository folder with manually installed dependencies. anyway sounds like you're on the right track ...
cor3000 ( 2020-10-28 18:16:03 +0800 )editI see that my new issue is that I am getting a Null Pointer Exception when trying to get a component via Path.getComponent('someString'). (But no in every case, which is strange). And when debugging into ZK I see that there are only two windows registered as fellows. The one I am opening currently and the 'main' window. But the window I initiated the opening of the new window from is missing. I even tried setting the new ID manually via constructor of the new component. In debug I see that the constructor is called and the ID is set. But later when I try to find it in the ID space... it is gone.
So my next question is. Has something changed in ZK8 on how to register new components in the id space?
the major changes happened between 3.6 and 5, whether that affects ID spaces I can't tell (too long ago to even remember) can you provide some kind of zul structure illustrating your problem? especially showing the nesting structure of "normal" components and components implementing IdSpace
cor3000 ( 2020-10-30 10:51:12 +0800 )edithere the current documentation regarding IdSpaces and how to locate components by Path or query https://www.zkoss.org/wiki/ZKDeveloper'sReference/UIComposing/IDSpace In case you remember the logic from 3.6 you'll see what's different.
cor3000 ( 2020-10-30 10:53:10 +0800 )editAsked: 2020-10-26 21:21:21 +0800
Seen: 21 times
Last updated: Oct 29 '20
[Announcement] ZK 8.5.1 is now available!
Highlight new release changes/new features in demo app
How can I make a button change its image by clicking on the same button?
Problems calling function 'sec:isAnyGranted' with zkspring 3.2 and Spring Security 4
webapp folder of ZK spring boot?
Can I set in runtime a new value to library property: org.zkoss.zk.ui.processMask.enabled:
Package ZK Eclipse Tomcat Project For Deployment
AImage org.zkoss.zk.ui.UiException: java.io.FileNotFoundException