<?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: tagging by local java api caused  NullpointerException in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/tagging-by-local-java-api-caused-nullpointerexception/m-p/314627#M1628</link>
    <description>&lt;P&gt;This is not how you extend Nuxeo. &lt;CODE&gt;LocalSessionFactory&lt;/CODE&gt; is an internal class not designed to be used by user code.&lt;/P&gt;
&lt;P&gt;Please start with &lt;A href="http://doc.nuxeo.com/display/NXDOC/Dev+Cookbook" target="test_blank"&gt;http://doc.nuxeo.com/display/NXDOC/Dev+Cookbook&lt;/A&gt; and &lt;A href="http://doc.nuxeo.com/display/NXDOC/Customization+and+Development" target="test_blank"&gt;http://doc.nuxeo.com/display/NXDOC/Customization+and+Development&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 06 Sep 2013 13:42:36 GMT</pubDate>
    <dc:creator>Florent_Guillau</dc:creator>
    <dc:date>2013-09-06T13:42:36Z</dc:date>
    <item>
      <title>tagging by local java api caused  NullpointerException</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/tagging-by-local-java-api-caused-nullpointerexception/m-p/314626#M1627</link>
      <description>&lt;P&gt;Hi all,
when I try to tag a document by following code, I obtain a nullpointerexception.
Some suggest about how to use local java api?
Thanks.&lt;/P&gt;
&lt;P&gt;I have a jsp with this code:
**&amp;lt;%&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;	LocalSessionFactory lsf = new LocalSessionFactory();
	CoreSession session = lsf.getSession();
	
	TagService tsi = Framework.getService(TagService.class);
	tsi.tag(session, "2b1eefa4-81ee-4d0f-8bcb-24f5e9745f96", "trytag","Administrator");
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;%&amp;gt;**&lt;/P&gt;
&lt;P&gt;Exception stacktrace logs:&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;143:            CoreSession csession = lsf.getSession();
144:
145:            TagService tsi = Framework.getService(TagService.class);
146:            tsi.tag(csession, "2b1eefa4-81ee-4d0f-8bcb-24f5e9745f96", "cacca","Administrator");
147:
148:
149:
Stacktrace:
at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:521)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:430)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.nuxeo.wss.servlet.BaseWSSFilter.doFilter(BaseWSSFilter.java:137)
at org.nuxeo.wss.servlet.FailSafeWSSFilter.doFilter(FailSafeWSSFilter.java:55)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.nuxeo.ecm.platform.ui.web.rest.FancyURLFilter.doFilter(FancyURLFilter.java:129)
... 24 more
Caused by: java.lang.NullPointerException
at org.nuxeo.ecm.core.api.local.LocalSession.getPrincipal(LocalSession.java:164)
at org.nuxeo.ecm.core.api.UnrestrictedSessionRunner.isUnrestricted(UnrestrictedSessionRunner.java:103)
at org.nuxeo.ecm.core.api.UnrestrictedSessionRunner.&lt;INIT&gt;(UnrestrictedSessionRunner.java:56)
at org.nuxeo.ecm.platform.tag.TagServiceImpl$UnrestrictedAddTagging.&lt;INIT&gt;(TagServiceImpl.java:131)
at org.nuxeo.ecm.platform.tag.TagServiceImpl.tag(TagServiceImpl.java:115)
at org.apache.jsp.prova_jsp._jspService(prova_jsp.java:220)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
... 34 more&lt;/INIT&gt;&lt;/INIT&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2013 12:43:05 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/tagging-by-local-java-api-caused-nullpointerexception/m-p/314626#M1627</guid>
      <dc:creator>maumig_</dc:creator>
      <dc:date>2013-09-06T12:43:05Z</dc:date>
    </item>
    <item>
      <title>Re: tagging by local java api caused  NullpointerException</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/tagging-by-local-java-api-caused-nullpointerexception/m-p/314627#M1628</link>
      <description>&lt;P&gt;This is not how you extend Nuxeo. &lt;CODE&gt;LocalSessionFactory&lt;/CODE&gt; is an internal class not designed to be used by user code.&lt;/P&gt;
&lt;P&gt;Please start with &lt;A href="http://doc.nuxeo.com/display/NXDOC/Dev+Cookbook" target="test_blank"&gt;http://doc.nuxeo.com/display/NXDOC/Dev+Cookbook&lt;/A&gt; and &lt;A href="http://doc.nuxeo.com/display/NXDOC/Customization+and+Development" target="test_blank"&gt;http://doc.nuxeo.com/display/NXDOC/Customization+and+Development&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2013 13:42:36 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/tagging-by-local-java-api-caused-nullpointerexception/m-p/314627#M1628</guid>
      <dc:creator>Florent_Guillau</dc:creator>
      <dc:date>2013-09-06T13:42:36Z</dc:date>
    </item>
    <item>
      <title>Re: tagging by local java api caused  NullpointerException</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/tagging-by-local-java-api-caused-nullpointerexception/m-p/314628#M1629</link>
      <description>&lt;P&gt;Ok. But, probably I was not clear.&lt;/P&gt;
&lt;P&gt;As stated in the &lt;A href="http://doc.nuxeo.com/display/NXDOC/ECM+Services+in+Nuxeo+EP"&gt;documentation&lt;/A&gt;,&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://doc.nuxeo.com/download/attachments/950317/S%C3%A9lection_022.png?version=1&amp;amp;modificationDate=1293032463508&amp;amp;api=v2" alt="mode of invocation of services" /&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;EM&gt;The services can be local (inside the same JVM) and most of them can be
Also called remotely via RMI if your
target Application Server supports
EJB3 remoting.&lt;/EM&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I would like to call upon the services of Nuxeo from "local", ie with a java client within the same JVM of Nuxeo.
This need arises from having to perform operations that are not supported by remote clients documented. For example, do the tagging of a document.&lt;/P&gt;
&lt;P&gt;The question becomes:
&lt;STRONG&gt;How do I invoke a service (for example that of tagging) in "local" mode?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;I tried to write the previous code but probably I'm missing some basic concept.&lt;/P&gt;
&lt;P&gt;Thank you again.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2013 14:50:28 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/tagging-by-local-java-api-caused-nullpointerexception/m-p/314628#M1629</guid>
      <dc:creator>maumig_</dc:creator>
      <dc:date>2013-09-06T14:50:28Z</dc:date>
    </item>
    <item>
      <title>Re: tagging by local java api caused  NullpointerException</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/tagging-by-local-java-api-caused-nullpointerexception/m-p/314629#M1630</link>
      <description>&lt;P&gt;You wrote this in the answers section but this is not an answer. Please update your original question instead, or add a comment to it.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2013 15:35:08 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/tagging-by-local-java-api-caused-nullpointerexception/m-p/314629#M1630</guid>
      <dc:creator>Florent_Guillau</dc:creator>
      <dc:date>2013-09-06T15:35:08Z</dc:date>
    </item>
  </channel>
</rss>

