0

HTTP Status 500 - java.lang.ClassNotFoundException: tutorial.SearchController

asked 2013-08-11 09:17:28 +0800

sichtbarer gravatar image sichtbarer
1

Hi,

I am new to ZK, so I downloaded and built the ZK tutorial to get a better understanding. I did not change any line of the code, nevertheless when running the h ttp://localhost:8080/tutorial/searchMvc.zul in my browser I get an error page as return:

HTTP Status 500 - java.lang.ClassNotFoundException: tutorial.SearchController

type Exception report

message java.lang.ClassNotFoundException: tutorial.SearchController

description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.zkoss.zk.ui.UiException: java.lang.ClassNotFoundException: tutorial.SearchController sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) java.lang.reflect.Constructor.newInstance(Constructor.java:525) org.zkoss.lang.Classes.newInstance(Classes.java:73) org.zkoss.lang.Exceptions.wrap(Exceptions.java:161) org.zkoss.zk.ui.UiException$Aide.wrap(UiException.java:44) org.zkoss.zk.ui.metainfo.ComponentInfo.resolveComposer(ComponentInfo.java:315) org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:778) org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:770) org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:679) org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:643) org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:394) org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:316) org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:215) org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:135) javax.servlet.http.HttpServlet.service(HttpServlet.java:621) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) root cause

java.lang.ClassNotFoundException: tutorial.SearchController org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) java.lang.Class.forName0(Native Method) java.lang.Class.forName(Class.java:186) org.zkoss.lang.Classes.forNameByThread(Classes.java:271) org.zkoss.lang.ImportedClassResolver.resolveClass(ImportedClassResolver.java:122) org.zkoss.zk.ui.impl.PageImpl.resolveClass(PageImpl.java:460) org.zkoss.zk.ui.impl.AbstractUiFactory.newComposer(AbstractUiFactory.java:142) org.zkoss.zk.ui.impl.Utils.newComposer(Utils.java:89) org.zkoss.zk.ui.metainfo.ComponentInfo.toComposer(ComponentInfo.java:355) org.zkoss.zk.ui.metainfo.ComponentInfo.toComposers(ComponentInfo.java:323) org.zkoss.zk.ui.metainfo.ComponentInfo.resolveComposer(ComponentInfo.java:310) org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:778) org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:770) org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:679) org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:643) org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:394) org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:316) org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:215) org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:135) javax.servlet.http.HttpServlet.service(HttpServlet.java:621) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) note The full stack trace of the root cause is available in the Apache Tomcat/7.0.40 logs.

Apache Tomcat/7.0.40

searchMvc.zul - btw: When clicking on "tutorial.SearchController" I am able to access the file, so it is existing.

    <window title="Search" width="600px" border="normal"
    apply="tutorial.SearchController">
    <hbox align="center">
        Keyword:
        <textbox id="keywordBox" />
        <button id="searchButton" label="Search" image="/img/search.png" />
    </hbox>
    <listbox id="carListbox" height="160px" emptyMessage="No car found in the result">
        <listhead>
            <listheader label="Model" />
            <listheader label="Make" />
            <listheader label="Price" width="20%"/>
        </listhead>
        <template name="model">
            <listitem>
                <listcell label="${each.model}"></listcell>
                <listcell label="${each.make}"></listcell>
                <listcell>$<label value="${each.price}" /></listcell>
            </listitem>
        </template>
    </listbox>
    <hbox style="margin-top:20px">
        <image id="previewImage" width="250px" />
        <vbox>
            <label id="modelLabel" />
            <label id="makeLabel" />
            <label id="priceLabel" />
            <label id="descriptionLabel" />
        </vbox>
    </hbox>
</window>

SearchController.java:

package tutorial;


import java.util.List;

import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.select.SelectorComposer;
import org.zkoss.zk.ui.select.annotation.*;
import org.zkoss.zul.*;

public class SearchController extends SelectorComposer<Component> {

    private static final long serialVersionUID = 1L;

    @Wire
    private Textbox keywordBox;
    @Wire
    private Listbox carListbox;
    @Wire
    private Label modelLabel;
    @Wire
    private Label makeLabel;
    @Wire
    private Label priceLabel;
    @Wire
    private Label descriptionLabel;
    @Wire
    private Image previewImage;


    private CarService carService = new CarServiceImpl();

    @Listen("onClick = #searchButton")
    public void search(){
        String keyword = keywordBox.getValue();
        List<Car> result = carService.search(keyword);
        carListbox.setModel(new ListModelList<Car>(result));
    }

    @Listen("onSelect = #carListbox")
    public void showDetail(){
        Car selected = carListbox.getSelectedItem().getValue();
        previewImage.setSrc(selected.getPreview());
        modelLabel.setValue(selected.getModel());
        makeLabel.setValue(selected.getMake());
        priceLabel.setValue(selected.getPrice().toString());
        descriptionLabel.setValue(selected.getDescription());
    }
}

Has someone an idea what is going wrong or missed I to change something while going through the tutorial (Mvc one)?

Many thanks in advance, SB

delete flag offensive retag edit
Be the first one to answer this question!
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
2 followers

RSS

Stats

Asked: 2013-08-11 09:17:28 +0800

Seen: 20 times

Last updated: Aug 11 '13

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