-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I implemented the Richlet example:
(I am using apache-tomcat-7.0.8 with zk-5.0.7.1)
1 package hpcgateway.workspace.worker;
2
3 import org.zkoss.zk.ui.Page;
4 import org.zkoss.zk.ui.GenericRichlet;
5 import org.zkoss.zk.ui.event.*;
6 import org.zkoss.zul.*;
7
8
9 public class Main extends GenericRichlet {
10 public void service(Page page) {
11 page.setTitle("Hpcgateway Workspace");
12 final Window w = new Window("main window", "normal", false);
13 new Label("start").setParent(w);
14 final Label l = new Label();
15 l.setParent(w);
16
17 final Button b = new Button("change");
18 b.addEventListener(Events.ON_CLICK, new EventListener() {
19 int count;
20 public void onEvent(Event et) {
21 l.setValue("" + count);
22 }
23 });
24 b.setParent(w);
25 w.setPage(page);
26 }
27 }
and zk.xml:
1 <?xml version="1.0" encoding="UTF-8"?>
2 <zk>
3 <richlet>
4 <richlet-name>Test</richlet-name>
5 <richlet-class>hpcgateway.workspace.worker.Main</richlet-class>
6 </richlet>
7 <richlet-mapping>
8 <richlet-name>Test</richlet-name>
9 <url-pattern>/test</url-pattern>
10 </richlet-mapping>
11 </zk>
web.xml:
....
39 <servlet-name>zkLoader</servlet-name>
40 <url-pattern>/do/*</url-pattern>
41 </servlet-mapping>
....
but when access the address http://localhost/services/do/test
it reports an exception:
java.lang.IllegalAccessException: Class org.zkoss.zk.ui.util.Configuration can not access a member of class hpcgateway.workspace.worker.Main with modifiers ""
sun.reflect.Reflection.ensureMemberAccess(Reflection.java:95)
java.lang.Class.newInstance0(Class.java:366)
java.lang.Class.newInstance(Class.java:325)
org.zkoss.zk.ui.util.Configuration.getRichlet(Configuration.java:2241)
org.zkoss.zk.ui.util.Configuration.getRichletByPath0(Configuration.java:2284)
org.zkoss.zk.ui.util.Configuration.getRichletByPath(Configuration.java:2272)
org.zkoss.zk.ui.impl.AbstractUiFactory.getRichlet(AbstractUiFactory.java:59)
org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:208)
org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:146)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
Hi
It is strange..
I run your code in the same environment , it works well!
your exception report repressent that you have a wrong modifier ""
but I see it is "public" .
if you are using eclipse , you can clean tomcat and retry
Asked: 2011-07-01 03:47:39 +0800
Seen: 163 times
Last updated: Jul 04 '11