ClassNotFoundException with "use"

asked 2009-01-16 20:57:00 +0800

james gravatar image james
255 2

updated 2009-01-16 22:55:37 +0800

I am sorry if this question seems a bit rediculous, but I'm still pretty new to ZK, and java in general.
I am consistently been unsuccessful with "use"ing or "apply"ing classes. I tried this little tutorial, as an example...
How to load tab contents on demand http://www.zkoss.org/smalltalks/netbeans2/netbeans2.dsp
And I get this as an exception "org.zkoss.zk.ui.UiException: java.lang.ClassNotFoundException: com.MyTabbox"
Likewise, this is the root cause "java.lang.ClassNotFoundException: com.MyTabbox"

When I try to use or apply a class the normal error is the 'ClassNotFoundException:' for what ever the name of the class is
Can anyone help me understand why I'm not able to use or apply classes?
I use tomcat 6, if that makes much of difference.
Thank you for any and all of your help

delete flag offensive retag edit

6 Replies

Sort by ยป oldest newest

answered 2009-01-17 02:25:40 +0800

RyanWu gravatar image RyanWu
533 2

updated 2009-01-17 02:25:48 +0800

can you provide you project config and test code ?
i think you didn't have right classpath or compile the source correctly .

link publish delete flag offensive edit

answered 2009-01-19 17:08:07 +0800

james gravatar image james
255 2

Here is the code...


    <window id="root">    
        <tabbox use="com.MyTabbox" id="tabbox" width="100%" >  
                <tab label="Preload"/>  
                <tab label="OnDemand 1"/>  
                <tab label="OnDemand 2"/>  
                    This panel is pre-loaded.  
                <tabpanel id="second"> 
                    <include id="secondContent" src=""/>
                <tabpanel id="third"> 
                    <include id="thirdContent" src=""/>

package com;

import org.zkoss.zk.ui.Desktop;
import org.zkoss.zk.ui.Path;
import org.zkoss.zul.Include;
import org.zkoss.zul.Tabpanel;

public class MyTabbox extends org.zkoss.zul.Tabbox {
private int i=0;
    public void onSelect() {
        Tabpanel item = getSelectedPanel();
        Desktop desktop = this.getDesktop();
        if(item != null && item.getId().equals("second")) {
            Include inc = (Include)Path.getComponent("/root/secondContent");
        if(item != null && item.getId().equals("third")) {
            Include inc = (Include)Path.getComponent("/root/thirdContent");

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
	<display-name>testing with the load on demand</display-name>
		Used to cleanup when a session is destroyed</description>
		ZK Session Cleaner</display-name>
		The servlet loads the DSP pages.</description>
		ZK loader for ZUML pages</description>
		The asynchronous update engine for ZK</description>

link publish delete flag offensive edit

answered 2009-01-19 17:22:53 +0800

mjablonski gravatar image mjablonski
1284 3 5

Hi James,

can you check, that there's a file called MyTabbox.class in tomcat/webapps/YourApplication/WEB-INF/classes/com? If not, you'll have to change your deployment to make it work.

Cheers, Maik

link publish delete flag offensive edit

answered 2009-01-19 20:08:14 +0800

james gravatar image james
255 2

there was not.
I've tried a couple of different deployment options, non of which created that file. I created one... not sure what all was supposed to be in it, but i put the same code as MyTabbox.java.
I got this error...
java.lang.ClassFormatError: Incompatible magic value 1885430635 in class file com/MyTabbox

link publish delete flag offensive edit

answered 2009-01-20 01:10:52 +0800

RyanWu gravatar image RyanWu
533 2

if you use eclipse
you should use Dynamic Web Project
or you have to copy the class to your classpath
(Default is WEB-INF/classes/ )

link publish delete flag offensive edit

answered 2009-01-20 16:58:36 +0800

james gravatar image james
255 2

Hey... You know, I have been using the "Dynamic Web Project" and it hasn't worked. When I did it again, just to be sure and do as you said, I noticed this little option "Dynamic Web Module version" it defaults to 2.4 I changed it to 2.5 and it works now. I had previously just kept it as the default.
Thanks everyone for your time and help.
It works now

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




Asked: 2009-01-16 20:57:00 +0800

Seen: 669 times

Last updated: Jan 20 '09

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