исключение com.vaadin.event.ListenerMethod $ MethodException - PullRequest
0 голосов
/ 15 ноября 2011

Я занят разработчиком приложения. Spring hibernate vaadin. Я хочу сделать функцию добавить новую статью. Когда я нажимаю кнопку, появляется сообщение об ошибке, вы можете мне помочь

    com.vaadin.event.ListenerMethod$MethodException
Cause: java.lang.NullPointerException

    at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:532)

    at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:164)

    at com.vaadin.ui.AbstractComponent.fireEvent(AbstractComponent.java:1219)

    at com.vaadin.ui.Button.fireClick(Button.java:537)

    at com.vaadin.ui.Button.changeVariables(Button.java:223)

    at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.changeVariables(AbstractCommunicationManager.java:1445)

    at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariableBurst(AbstractCommunicationManager.java:1393)

    at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariables(AbstractCommunicationManager.java:1312)

    at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleUidlRequest(AbstractCommunicationManager.java:763)

    at com.vaadin.terminal.gwt.server.PortletCommunicationManager.handleUidlRequest(PortletCommunicationManager.java:242)

    at com.vaadin.terminal.gwt.server.AbstractApplicationPortlet.handleRequest(AbstractApplicationPortlet.java:465)

    at com.vaadin.terminal.gwt.server.AbstractApplicationPortlet.serveResource(AbstractApplicationPortlet.java:747)

    at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:118)

    at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:71)

    at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:93)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:68)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)

    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:471)

    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:402)

    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329)

    at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:636)

    at com.liferay.portlet.InvokerPortletImpl.invokeResource(InvokerPortletImpl.java:750)

    at com.liferay.portlet.InvokerPortletImpl.serveResource(InvokerPortletImpl.java:505)

    at com.liferay.portal.action.LayoutAction.processPortletRequest(LayoutAction.java:941)

    at com.liferay.portal.action.LayoutAction.processLayout(LayoutAction.java:664)

    at com.liferay.portal.action.LayoutAction.execute(LayoutAction.java:244)

    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)

    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)

    at com.liferay.portal.struts.PortalRequestProcessor.process(PortalRequestProcessor.java:173)

    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)

    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)

    at com.liferay.portal.servlet.MainServlet.callParentService(MainServlet.java:556)

    at com.liferay.portal.servlet.MainServlet.service(MainServlet.java:533)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:113)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:113)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:113)

    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)

    at com.liferay.portal.servlet.filters.secure.SecureFilter.processFilter(SecureFilter.java:199)

    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)

    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)

    at com.liferay.portal.servlet.filters.autologin.AutoLoginFilter.processFilter(AutoLoginFilter.java:240)

    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:68)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)

    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:471)

    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:402)

    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329)

    at com.liferay.portal.servlet.FriendlyURLServlet.service(FriendlyURLServlet.java:136)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:113)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:113)

    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)

    at com.liferay.portal.servlet.filters.gzip.GZipFilter.processFilter(GZipFilter.java:123)

    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)

    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)

    at com.liferay.portal.servlet.filters.secure.SecureFilter.processFilter(SecureFilter.java:199)

    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)

    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)

    at com.liferay.portal.servlet.filters.i18n.I18nFilter.processFilter(I18nFilter.java:241)

    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)

    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)

    at com.liferay.portal.servlet.filters.etag.ETagFilter.processFilter(ETagFilter.java:55)

    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)

    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)

    at com.liferay.portal.servlet.filters.autologin.AutoLoginFilter.processFilter(AutoLoginFilter.java:240)

    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)

    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)

    at com.liferay.portal.servlet.filters.sso.ntlm.NtlmPostFilter.processFilter(NtlmPostFilter.java:83)

    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)

    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)

    at com.liferay.portal.sharepoint.SharepointFilter.processFilter(SharepointFilter.java:80)

    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)

    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)

    at com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.processFilter(VirtualHostFilter.java:209)

    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:184)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:92)

    at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:738)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:164)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:92)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:164)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:92)

    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:68)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)

    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:185)

    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)

    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:151)

    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)

    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)

    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)

    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)

    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:269)

    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)

    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)

    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

    at java.lang.Thread.run(Unknown Source)

Caused by: java.lang.NullPointerException

    at achrefliferay.AchrefliferayApplication$1.buttonClick(AchrefliferayApplication.java:54)

    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 com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:512)

    ... 136 more

Это приложение

    package achrefliferay;

import org.springframework.beans.factory.annotation.Autowire;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;

import com.bd.dao.ArticleDao;
import com.bd.entity.Article;
import com.bd.service.ArticleService;
import com.vaadin.Application;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;

@Configurable(preConstruction = true)
public class AchrefliferayApplication extends Application {

    @Autowired(required=false)
    ArticleService articleService;
@Autowired(required=false)
ArticleDao articleDao;


    public void init() {

        Window w = new Window("Subscribe Newsletter");
        setMainWindow(w);
        w.setContent(new VerticalLayout());
        final TextField name = new TextField("Name");
        final TextField type = new TextField("Type");
        final TextField qte = new TextField("Quantité");


        Button subscribeBtn = new Button("saisi");
        w.addComponent(name);
        w.addComponent(type);
        w.addComponent(qte);
        w.addComponent(subscribeBtn);

        subscribeBtn.addListener(new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {

                Article article =new Article();
                article.setNom(name.getValue().toString());
                article.setType(type.getValue().toString());
                          article.setQte(Integer.parseInt(qte.getValue().toString()));

                articleService.saveArticle(article);


            }
        });


    }

}

Кто-нибудь знает это исключение?

1 Ответ

0 голосов
/ 16 ноября 2011

articleService - это null. Вы можете видеть это в основной причине в конце трассировки стека:

at achrefliferay.AchrefliferayApplication$1.buttonClick(AchrefliferayApplication.java:54)
...