09-06-2013 08:43 AM
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.
I have a jsp with this code: **<%
LocalSessionFactory lsf = new LocalSessionFactory();
CoreSession session = lsf.getSession();
TagService tsi = Framework.getService(TagService.class);
tsi.tag(session, "2b1eefa4-81ee-4d0f-8bcb-24f5e9745f96", "trytag","Administrator");
%>**
Exception stacktrace logs:
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.
09-06-2013 09:42 AM
This is not how you extend Nuxeo. LocalSessionFactory
is an internal class not designed to be used by user code.
Please start with http://doc.nuxeo.com/display/NXDOC/Dev+Cookbook and http://doc.nuxeo.com/display/NXDOC/Customization+and+Development
09-06-2013 10:50 AM
Ok. But, probably I was not clear.
As stated in the documentation,
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.
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.
The question becomes: How do I invoke a service (for example that of tagging) in "local" mode?
I tried to write the previous code but probably I'm missing some basic concept.
Thank you again.
09-06-2013 11:35 AM
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.
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.