go to link http://localhost:8080/alfresco/service/sample/helloworld
in log you can see
java.lang.NullPointerException at testpackage.platformsample.DemoComponent.getCompanyHome(DemoComponent.java:92) at testpackage.platformsample.DemoComponent.executeInternal(DemoComponent.java:62) at testpackage.platformsample.HelloWorldWebScript.executeImpl(HelloWorldWebScript.java:57) at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:64) at org.alfresco.repo.web.scripts.RepositoryContainer$3.execute(RepositoryContainer.java:519) at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:450) at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:587) at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:656) at org.alfresco.repo.web.scripts.RepositoryContainer.executeScriptInternal(RepositoryContainer.java:428) at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:308) ...
The issue is not with generated code, issue is with the code you have written in HelloWorldWebScript class.
DemoComponent class is instantiated using Sprint IOC container and all its dependencies (such as NodeService, NodeLocatorService) are satisfied by the container.
Now you want to use DemoComponent in your HelloWorldWebScript, you need to inject the testpackage.DemoComponent bean in webscript.alfresco.tutorials.helloworld.get bean in order to use DemoComponent.
You can not simply create instance as you have done in your webscript class.
When you do this, setter methods in the DemoComponent class has no effect and it wont set any object reference. In this case they become raw java methods. And you may be already aware that if there are instance variables in a class and if you don't set the values/references via any means, then they by default get null value/reference if the object created.
Consider reading this blog for more details on dependency injection: