Project

General

Profile

Defect #969

NPE on service call

Added by Robert Ivens over 8 years ago. Updated over 8 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Start date:
01/04/2016
Due date:
% Done:

0%

Estimated time:
Browser (if web client):

Description

I have a module with a bunch of service calls. When I run the module (in developer) I can call the services without any problems.
The moment I link the module to my main solution (in developer) I suddenly get the following NPE.

java.lang.NullPointerException 
        at net.stuff.servoy.plugin.velocity.VelocityProvider.invokeService(VelocityProvider.java:274) 
        at net.stuff.servoy.plugin.velocity.VelocityProvider.js_invokeService(VelocityProvider.java:213) 
        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.mozilla.javascript.MemberBox.invoke(MemberBox.java:158) 
        at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:312) 
        at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1774) 
        at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:837) 
        at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:158) 
        at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:406) 
        at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3204) 
        at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:168) 
        at org.mozilla.javascript.Context.evaluateString(Context.java:1121) 
        at com.servoy.eclipse.debug.scriptingconsole.CommandHandler$1.run(CommandHandler.java:67) 
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199) 
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:715) 
        at java.awt.EventQueue.access$400(EventQueue.java:82) 
        at java.awt.EventQueue$2.run(EventQueue.java:676) 
        at java.awt.EventQueue$2.run(EventQueue.java:674) 
        at java.security.AccessController.doPrivileged(Native Method) 
        at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86) 
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:685) 
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296) 
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211) 
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201) 
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196) 
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188) 
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Servoy version 7.4.5 -releaseNumber 2041
Java 1.6.0_65
Velocity v3.5.33

History

#1

Updated by Patrick Talbot over 8 years ago

The thing is that invokeService is expecting the service definition to be in the main solution.

Perhaps I could add a 'solution' parameter to the invokeService() call, although I wonder where I should place it as Java might confuse it with the parameters Object (a String being an Object), so it's a little tricky.

In any case it should work if you place your "services" json in the main solution in config.json

You could to do it in a more reusable way by putting your services definitions inside a separate file alongside the config.json file and then place a #parse("services.json") (or #include() if you're not using any dynamic variables in there) at the place where your services should be.

#2

Updated by Robert Ivens over 8 years ago

  • Status changed from New to Resolved

Ah, I knew I was overlooking something. The solution name.
The #parse("services.json") approach works for me, thanks!
Perhaps the plugin can give an error msg that says that the solution/service combo is not available in the config.json?

#3

Updated by Patrick Talbot over 8 years ago

Perhaps, yes. I'll see what I can do.

Also available in: Atom PDF