<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Problem whith session in EventListener in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/problem-whith-session-in-eventlistener/m-p/313135#M136</link>
    <description>&lt;P&gt;Hello Vladimir,&lt;/P&gt;</description>
    <pubDate>Thu, 10 Apr 2014 19:28:25 GMT</pubDate>
    <dc:creator>klebervz_</dc:creator>
    <dc:date>2014-04-10T19:28:25Z</dc:date>
    <item>
      <title>Problem whith session in EventListener</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/problem-whith-session-in-eventlistener/m-p/313133#M134</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have a class called MissionEventHandler, that is called by an event of the delete button in the listing in page.&lt;/P&gt;
&lt;P&gt;Here is a part of my code:&lt;/P&gt;
&lt;P&gt;public void handleEvent(Event event) throws ClientException {&lt;IMG src="http://" alt="alt text" /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;EventContext ctx = event.getContext();
	if (!(ctx instanceof DocumentEventContext)) {
		return;
	}
	DocumentModel doc = ((DocumentEventContext) ctx).getSourceDocument();
	if (doc == null) {
		return;
	}
	String type = doc.getType();
	
	if ("Mission".equalsIgnoreCase(type) 
					&amp;amp;&amp;amp; event.getName().equalsIgnoreCase("documentRemoved")){
		processMediaRemove(doc, ctx.getCoreSession());
	}

}

private void processMediaRemove(DocumentModel doc, CoreSession session) 
		throws ClientException {
	
	
	DocumentModel docTest = session.getDocument(doc.getRef());      &amp;lt;&amp;lt;&amp;lt;----------
	
	Serializable sml = docTest.getPropertyValue("mission:medias");
}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;When I try to retrieve the document from session it returns me the following Exception&lt;/P&gt;
&lt;P&gt;2014-04-09 10:34:17,917 ERROR [http-bio-0.0.0.0-8080-exec-44] [org.nuxeo.ecm.core.event.impl.EventServiceImpl] Error during updateMissionRelatedAssets sync listener execution, transaction won't be rolled back since event.markRollBack() was not called by the Listener
org.nuxeo.ecm.core.api.ClientException: Failed to get document 8d6c5833-830c-4b9b-9ec6-eb8667dead15
at org.nuxeo.ecm.core.api.AbstractSession.getDocument(AbstractSession.java:1234)
at org.br.ezute.mission.event.MissionEventHandler.processMediaRemove(MissionEventHandler.java:54)
at org.br.ezute.mission.event.MissionEventHandler.handleEvent(MissionEventHandler.java:45)
at org.nuxeo.ecm.core.event.impl.EventServiceImpl.fireEvent(EventServiceImpl.java:215)
at org.nuxeo.ecm.core.api.AbstractSession.fireEvent(AbstractSession.java:385)
at org.nuxeo.ecm.core.api.AbstractSession.notifyEvent(AbstractSession.java:437)
at org.nuxeo.ecm.core.api.AbstractSession.removeNotifyOneDoc(AbstractSession.java:1839)
at org.nuxeo.ecm.core.api.AbstractSession.removeDocument(AbstractSession.java:1786)
at org.nuxeo.ecm.core.api.AbstractSession.removeDocument(AbstractSession.java:1772)&lt;/P&gt;
&lt;P&gt;How do I recover my document and at what time the session is updated with CurrentDocument?&lt;/P&gt;
&lt;P&gt;Can someone help me?&lt;/P&gt;</description>
      <pubDate>Thu, 10 Apr 2014 16:10:18 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/problem-whith-session-in-eventlistener/m-p/313133#M134</guid>
      <dc:creator>klebervz_</dc:creator>
      <dc:date>2014-04-10T16:10:18Z</dc:date>
    </item>
    <item>
      <title>Re: Problem whith session in EventListener</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/problem-whith-session-in-eventlistener/m-p/313134#M135</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;</description>
      <pubDate>Thu, 10 Apr 2014 18:40:05 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/problem-whith-session-in-eventlistener/m-p/313134#M135</guid>
      <dc:creator>Vladimir_Pasqui</dc:creator>
      <dc:date>2014-04-10T18:40:05Z</dc:date>
    </item>
    <item>
      <title>Re: Problem whith session in EventListener</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/problem-whith-session-in-eventlistener/m-p/313135#M136</link>
      <description>&lt;P&gt;Hello Vladimir,&lt;/P&gt;</description>
      <pubDate>Thu, 10 Apr 2014 19:28:25 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/problem-whith-session-in-eventlistener/m-p/313135#M136</guid>
      <dc:creator>klebervz_</dc:creator>
      <dc:date>2014-04-10T19:28:25Z</dc:date>
    </item>
  </channel>
</rss>

