0

DocumentManagertwoApplication.java と DocumentEditor.java の 2 つのクラスがあります (コードは以下にあります)。[編集] ボタンをクリックしたときに表示されるこのエラーを理解するのに助けが必要です

com.vaadin.event.ListenerMethod$MethodException: com.example.documentmanagertwo.DocumentmanagertwoApplication$1 のメソッド buttonClick の呼び出しに失敗しました。com.vaadin.event.ListenerMethod.receiveEvent (ListenerMethod.java:532) で com.vaadin.event.EventRouter.fireEvent (EventRouter.java:164) で com.vaadin.ui.AbstractComponent.fireEvent (AbstractComponent.java:1219) で) com.vaadin.ui.Button.fireClick(Button.java:550) で com.vaadin.ui.Button.changeVariables(Button.java:217) で com.vaadin.terminal.gwt.server.AbstractCommunicationManager.changeVariables( AbstractCommunicationManager.java:1455) com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariableBurst(AbstractCommunicationManager.java:1399) com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariables(AbstractCommunicationManager.

/////////////////////////////////////////////// //////////////////////////////////////// 以下の DocumentManagertwoApplication コード:

FilesystemContainer docs = new FilesystemContainer (new File("C:\\Users\\MYRA\\Desktop\\Docx4java\\docs"));
Table selector = new Table (null, docs);
Label viewer = new Label ("Select a doc", Label.CONTENT_RAW);
Button edit = new Button ("edit");


@Override
public void init() {
    final Window mainWindow = new Window("Documentmanagertwo Application", new VerticalSplitPanel());
    VerticalLayout lo = new VerticalLayout();
    Label label = new Label("Hello Vaadin user");
    mainWindow.addComponent(label);
    mainWindow.addComponent(selector);
    lo.addComponent(viewer);
    lo.addComponent(edit);
    mainWindow.addComponent(lo);
    setMainWindow(mainWindow);

    edit.addListener(new Button.ClickListener (){


        private static final long serialVersionUID = -3024072268109652498L;

        public void buttonClick(ClickEvent event ) {

            Window dialog = new Window ("Edit Selected", 
                    new DocumentEditor(viewer.getPropertyDataSource()));
            dialog.setModal(true);
            mainWindow.addWindow (dialog);

        }


    });

    selector.setImmediate(true);
    selector.setSizeFull();
    selector.setSelectable(true);
    selector.addListener(new Property.ValueChangeListener()  {

        /**
         * 
         */
        private static final long serialVersionUID = 1L;

        public void valueChange(ValueChangeEvent event) {
            viewer.setPropertyDataSource(new TextFileProperty((File) selector.getValue()));
        }

    });
}

}

/////////////////////////////////////////////// /////////////////////////////////////// 以下の DocumentEditor.java コード: //// /////////////////////////////////////////////// /////////////////////////////

@AutoGenerated
private AbsoluteLayout mainLayout;

@AutoGenerated
private Button button_1;

@AutoGenerated
private RichTextArea richTextArea_1;

/*- VaadinEditorProperties={"grid":"RegularGrid,20","showGrid":true,"snapToGrid":true,"snapToObject":true,"movingGuides":false,"snappingDistance":10} */



/*- VaadinEditorProperties={"grid":"RegularGrid,20","showGrid":true,"snapToGrid":true,"snapToObject":true,"movingGuides":false,"snappingDistance":10} */

/**
 * 
 */
private static final long serialVersionUID = 2788446877665474591L;
/**
 * The constructor should first build the main layout, set the
 * composition root and then do any custom initialization.
 *
 * The constructor will not be automatically regenerated by the
 * visual editor.
 */
public DocumentEditor(Property document) {
    buildMainLayout();
    setCompositionRoot(mainLayout);

    // TODO add user code here
    richTextArea_1.setPropertyDataSource(document);
    richTextArea_1.setWriteThrough(false);

    button_1.addListener(new Button.ClickListener()  {


        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event ) {
            richTextArea_1.commit();
            getApplication().getMainWindow().removeWindow(getWindow());
        }
    });

}

@AutoGenerated
private AbsoluteLayout buildMainLayout() {
    // common part: create layout
    mainLayout = new AbsoluteLayout();
    mainLayout.setImmediate(false);
    mainLayout.setWidth("100%");
    mainLayout.setHeight("100%");
    mainLayout.setMargin(false);

    // top-level component properties
    setWidth("100.0%");
    setHeight("100.0%");

    // richTextArea_1
    richTextArea_1 = new RichTextArea();
    richTextArea_1.setImmediate(false);
    richTextArea_1.setWidth("572px");
    richTextArea_1.setHeight("360px");
    mainLayout.addComponent(richTextArea_1, "top:0.0px;left:-2.0px;");

    // button_1
    button_1 = new Button();
    button_1.setCaption("Save");
    button_1.setImmediate(false);
    button_1.setWidth("-1px");
    button_1.setHeight("-1px");
    mainLayout.addComponent(button_1, "top:360.0px;left:500.0px;");

    return mainLayout;
}

}

4

1 に答える 1

0

例外の根本的な原因は次のとおりです。 Caused by: java.lang.ClassNotFoundException: com.example.documentmanagertwo.DocumentEditor

これは、JVMが指定されたクラスを検索またはロードできないことを意味します。

DocumentEditorは、クラスパス上にないライブラリからクラスまたはパスをインポートしますか?これがこの問題の原因であることがよくあります。

コンパイルされたクラスはクラスパスにありますか?プロジェクトをクリーンアップして再構築してみます。

于 2012-06-08T06:49:31.720 に答える