0

Access zk Page from pure java project

asked 2011-04-11 02:25:53 +0800

Neus gravatar image Neus
1415 14

Hi,
From my zk webapp I'm calling a function in a pure java project and passing as a parameter a Page.
In this project I add to the buildpath the zk.jar but when the function try to use the Page I get a NoClassDefFoundError.

java.lang.ClassNotFoundException: org.zkoss.zk.ui.Page
>>	at java.net.URLClassLoader$1.run(Unknown Source)
>>	at java.security.AccessController.doPrivileged(Native Method)
>>	at java.net.URLClassLoader.findClass(Unknown Source)
>>	at java.lang.ClassLoader.loadClass(Unknown Source)
>>	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
>>	at java.lang.ClassLoader.loadClass(Unknown Source)
>>	at org.sts.recursosComunes.accesoDatos.BD.<init>(BD.java:94)
>>	at org.sts.recursosComunes.Entidad.UsuarioBD.<init>(UsuarioBD.java:32)
>>	at org.sts.recursosComunes.Entidad.Usuario.<init>(Usuario.java:64)
>>	at org.sts.recursosComunes.conexionesFuentesDatos.UsuarioLogin.logarUsuarioBD(UsuarioLogin.java:56)
>>	at org.sts.Login.LoginUsuario.LogarUsuario(LoginUsuario.java:45)
>>	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>>	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>>	at java.lang.reflect.Method.invoke(Unknown Source)
>>	at bsh.Reflect.invokeMethod(Unknown Source)
>>	at bsh.Reflect.invokeStaticMethod(Unknown Source)
>>	at bsh.Name.invokeMethod(Unknown Source)
>>	at bsh.BSHMethodInvocation.eval(Unknown Source)
>>	at bsh.BSHPrimaryExpression.eval(Unknown Source)
>>	at bsh.BSHPrimaryExpression.eval(Unknown Source)
>>	at bsh.BSHVariableDeclarator.eval(Unknown Source)
>>	at bsh.BSHTypedVariableDeclaration.eval(Unknown Source)
>>	at bsh.BSHBlock.evalBlock(Unknown Source)
>>	at bsh.BSHBlock.eval(Unknown Source)
>>	at bsh.BSHBlock.eval(Unknown Source)
>>	at bsh.BSHIfStatement.eval(Unknown Source)
>>	at bsh.BSHBlock.evalBlock(Unknown Source)
>>	at bsh.BSHBlock.eval(Unknown Source)
>>	at bsh.BshMethod.invokeImpl(Unknown Source)
>>	at bsh.BshMethod.invoke(Unknown Source)
>>	at bsh.BshMethod.invoke(Unknown Source)
>>	at bsh.Name.invokeLocalMethod(Unknown Source)
>>	at bsh.Name.invokeMethod(Unknown Source)
>>	at bsh.BSHMethodInvocation.eval(Unknown Source)
>>	at bsh.BSHPrimaryExpression.eval(Unknown Source)
>>	at bsh.BSHPrimaryExpression.eval(Unknown Source)
>>	at bsh.Interpreter.eval(Unknown Source)
>>	at bsh.Interpreter.eval(Unknown Source)
>>	at org.zkoss.zk.scripting.bsh.BSHInterpreter.exec(BSHInterpreter.java:134)
>>	at org.zkoss.zk.scripting.util.GenericInterpreter.interpret(GenericInterpreter.java:341)
>>	at org.zkoss.zk.ui.impl.PageImpl.interpret(PageImpl.java:857)
>>	at org.zkoss.zk.ui.impl.EventProcessor.process0(EventProcessor.java:180)
>>	at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:138)
>>	at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.process0(EventProcessingThreadImpl.java:517)
>>	at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.run(EventProcessingThreadImpl.java:444)

Does anyone knows why?Maybe I can't use zk jar in a non WebApp project?

Thank you!

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2011-04-11 07:49:10 +0800

caclark gravatar image caclark
1753 2 5
http://clarktrips.intltwi...

1) What's your IDE? Is it Eclipse, Netbeans, something else?
2) "In this project I add to the buildpath the zk.jar but when the function try to use the Page I get a NoClassDefFoundError." Which project, the web app or Java project?
3) Did you put more than zk.jar in the classpath? ZK is comprised of multiple jar files.
4) If your IDE is Eclipse, do you realize that the buildpath is different from the runtime classpath? The buildpath tells Eclipse where the jars are so it can compile the project. For web apps, if you put the jar's into WEB-INF/lib, it will set both paths for you.

link publish delete flag offensive edit

answered 2011-04-11 08:00:54 +0800

mjablonski gravatar image mjablonski
1284 3 5
http://www.jease.org/

> Maybe I can't use zk jar in a non WebApp project?

Using ZK (= Web Application Framework) in a standalone Java application (which is not a web application) doesn't make any sense. Can you describe your use-case?

Cheers, Maik

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-04-11 02:25:53 +0800

Seen: 175 times

Last updated: Apr 11 '11

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