2016-06-02 2 views
0

nuxeo의 IDE에서 이벤트 리스너를 만들하지만 오류 java.lang.ClassCastException가 무엇입니까 방법 :내가 nuxeo의 IDE에서 이벤트를 예약 할

org.nuxeo.ecm.core.event.impl을 .EventContextImpl을 org.nuxeo.ecm.core.event.impl.DocumentEventContext로 캐스트 할 수 없습니다.

내 스케줄러 기여는 다음과 같습니다

<?xml version="1.0"?> 

<component name="org.nuxeo.sample.ScheduleCall" version="1.0"> 
<extension target="org.nuxeo.ecm.core.scheduler.SchedulerService" 
point="schedule"> 
<schedule id="testschedule"> 
<username>Administrator</username> 
<eventId>user_created</eventId> 
<eventCategory>default</eventCategory> 

<cronExpression>0 1 * * * ?</cronExpression> 
</schedule> 
</extension> 

</component> 

내 청취자의 공헌은 다음과 같습니다 리스너

<component name="org.nuxeo.sample.listener.contrib.ScheduleListener"> 

    <extension target="org.nuxeo.ecm.core.event.EventServiceComponent" 
    point="listener"> 

    <listener name="schedulelistener" async="false" postCommit="true" 
     class="org.nuxeo.sample.ScheduleListener" priority="140"> 
     <event>user_created</event> 
    </listener> 
    </extension> 

</component> 

내 자바 클래스는 다음과 같습니다

/** 
* 
*/ 

package org.nuxeo.sample; 

import org.nuxeo.ecm.core.event.EventListener; 
import org.nuxeo.ecm.core.event.Event; 





/** 
* @author Parul.Puri01 
*/ 


public class ScheduleListener implements EventListener { 

    public void handleEvent(Event event){ 
     try{ 
      if(event!=null && event.getName().equals("user_created")){ 
       System.out.println("parul"); 
      } 
      System.out.println("not an event"); 
     } 
     catch (Exception e){ 
      e.printStackTrace(); 

     } 


    } 

} 

오류 :

java.lang.ClassCastException: org.nuxeo.ecm.core.event.impl.EventContextImpl cannot be cast to org.nuxeo.ecm.core.event.impl.DocumentEventContext 
    at org.nuxeo.ecm.user.center.profile.localeProvider.UserLocaleSelectorListener.handleEvent(UserLocaleSelectorListener.java:43) 
    at org.nuxeo.ecm.core.event.impl.EventServiceImpl.fireEvent(EventServiceImpl.java:200) 
    at org.nuxeo.ecm.core.scheduler.EventJob.execute(EventJob.java:119) 
    at org.nuxeo.ecm.core.scheduler.EventJob.execute(EventJob.java:65) 
    at org.quartz.core.JobRunShell.run(JobRunShell.java:202) 
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) 
2016-06-02 12:13:01,047 WARN [Nuxeo-Work-default-3] [org.nuxeo.ecm.platform.ec.notification.NotificationEventListener] Can not handle notification on a event that is not bound to a DocumentEventContext 

날 nuxeo의 IDE에서 청취자 확장 점을 만드는 방법을 알려 주시기 바랍니다. 나는 그것을 문서 수신기로 만들고있다. 오류를 해결하는 방법?

답변

2

EVENTID 내부적 문서 내의 콘텍스트 Nuxeo 플랫폼에 의해 사용되는 user_created.

따라서이 이벤트는 Document 컨텍스트가없는 스케줄러로 실행할 수 없습니다. 단지 의 이름을 변경

당신이 당신의 샘플 작업을 확인하려면

또는 무엇이든을 my_user_created 을 user_created.

최저

,

+0

안녕하세요,이 시도했지만 같은 오류에 직면, 당신은 – Parul

+0

안녕 다시, 나는 개인적으로 샘플을 테스트 오류와 함께 도움이 될 수 있습니다 그것은 나를 위해 잘 작동합니다. cronExpression (0 1 * * *?)은 시간의 처음 몇 분 **을 의미합니다. (** 2016-06-02 12 : 13 : 01,047 **) 로그의 타임 스탬프와 일치하지 않는 16h01, 17h01, 18h01 등 **이 스택 스택이 사용자의 스케줄러와 관련이 없다고 생각하게합니다. 다른 것. –

+0

안녕하세요, 고마워요. 내 nuxeo가 구성되지 않았습니다. 이제 완료되었으므로이 오류가 지속되지 않습니다. 그러나 출력을 얻을 수 없습니다. 작성중인 경우 정보를 제공해주십시오. nuxeo 구성 요소로 스케줄러 및 문서 수신기로 리스너 .. 또한 일식 창에서 출력을 볼 수 있습니까? 귀하의 도움을 주시면 감사하겠습니다. – Parul