0

richlet problem

asked 2011-07-01 03:47:39 +0800

mityh gravatar image mityh
21

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)

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2011-07-04 06:39:02 +0800

matthewgo gravatar image matthewgo
375

updated 2011-07-04 06:40:16 +0800

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

link publish delete flag offensive edit

answered 2011-07-04 09:23:14 +0800

mityh gravatar image mityh
21

I am not using Eclipse,
But I recognized that, it is due to the classes directory under WEB-INF
was not cleaned, There was a remained class with the same name but not
defined "public"

thanks very much.

link publish delete flag offensive edit
Your reply
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

Follow

RSS

Stats

Asked: 2011-07-01 03:47:39 +0800

Seen: 163 times

Last updated: Jul 04 '11

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