cancel
Showing results for 
Search instead for 
Did you mean: 

NodeService - java.lang.NullPointerException

mstransky
Champ in-the-making
Champ in-the-making
Hello I have problem with NodeService
I am trineg for specific reason convert manualy Text File to PDF with specific definition using iText, But I am stuck on nodeservice(I believe)
Can Anyone Help me please???

This is my part of code..
public class TXT2PDFActionExecuter extends ActionExecuterAbstractBase{…private NodeService nodeService; public void setNodeService(NodeService nodService)    {       this.nodeService = nodService;    }….QName PROP_QNAME_MY_PROPERTY = QName.createQName("custom.model", "title");System.out.println("QNAME>" + PROP_QNAME_MY_PROPERTY.toString());System.out.println("actionedUponNodeRef>" + actionedUponNodeRef.toString());System.out.println("getin title node>" + this.nodeService.toString());NodeRef titleValue = (NodeRef)this.nodeService.getProperty(actionedUponNodeRef, PROP_QNAME_MY_PROPERTY);‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

My problem is that on line : System.out.println("getin title node>" + this.nodeService.toString()); I get
….actionedUponNodeRef>workspace://SpacesStore/44266631-7e4e-4df6-8b44-96e8538aafb9[b]java.lang.NullPointerException[/b]        at com.atolcd.repo.action.executer.TXT2PDFActionExecuter.executeImpl(TXT2PDFActionExecuter.java:159)        at org.alfresco.repo.action.executer.ActionExecuterAbstractBase.execute(ActionExecuterAbstractBase.java:133)        at org.alfresco.repo.action.ActionServiceImpl.directActionExecution(ActionServiceImpl.java:726)        at org.alfresco.repo.action.executer.CompositeActionExecuter.executeImpl(CompositeActionExecuter.java:66)        at org.alfresco.repo.action.executer.ActionExecuterAbstractBase.execute(ActionExecuterAbstractBase.java:133)        at org.alfresco.repo.action.ActionServiceImpl.directActionExecution(ActionServiceImpl.java:726)        at org.alfresco.repo.action.ActionServiceImpl.executeActionImpl(ActionServiceImpl.java:658)        at org.alfresco.repo.action.ActionServiceImpl.executeAction(ActionServiceImpl.java:526)        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)        at java.lang.reflect.Method.invoke(Method.java:597)        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)        at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:34)        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)        at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:43)        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)        at org.alfresco.repo.audit.AuditComponentImpl.audit(AuditComponentImpl.java:279)        at org.alfresco.repo.audit.AuditMethodInterceptor.proceedWithAudit(AuditMethodInterceptor.java:228)        at org.alfresco.repo.audit.AuditMethodInterceptor.proceed(AuditMethodInterceptor.java:195)        at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:140)        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)        at $Proxy39.executeAction(Unknown Source)‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
4 REPLIES 4

billerby
Champ on-the-rise
Champ on-the-rise
Make sure you inject the nodeService in the spring-config files. And please give me some karma points  Smiley Very Happy

/Erik

mrogers
Star Contributor
Star Contributor
What would you expect to see from "this.nodeService.toString()"?

That's a service so at best you will see some gobbledegook spring proxy reference.

mstransky
Champ in-the-making
Champ in-the-making
Make sure you inject the nodeService in the spring-config files. And please give me some karma points  Smiley Very Happy

/Erik
Eric thaks for info as you notice I had to put nodeService into module-contex.xml
<bean id="txt2pdf" class="com.atolcd.repo.action.executer.TXT2PDFActionExecuter" parent="action-executer">      <property name="contentService">         <ref bean="contentService" />      </property>     <property name="nodeService">         <ref bean="nodeService" />      </property>      <property name="fileFolderService">         <ref bean="fileFolderService" />      </property>   </bean>‍‍‍‍‍‍‍‍‍‍‍‍‍
and now it works perfect
Thx a lot

mstransky
Champ in-the-making
Champ in-the-making
What would you expect to see from "this.nodeService.toString()"?

That's a service so at best you will see some gobbledegook spring proxy reference.

Mroger I just check where is the problem… I am not so senior in java so its hard for me to see what happing in tha code, so I put output nearly everywhere..
anyway thaks for help.
Best regars
Michal