Hi Kavith,

Starting order comes into place if and only if you are accessing OSGI
service from a init script. According to the source, it seems you access it
from a *.jag file. Hence, can you first start the server with OSGI console
and check whether you OSGI service has been properly registered.

/Ruchira


On Mon, Feb 10, 2014 at 4:30 PM, Kavith Lokuhewage <[email protected]> wrote:

> Hi,
>
> I am developing several gadgets for a WSO2 UES Dashboard and I need call a
> custom OSGi service bundle that I developed, within the jaggery code. When
> I try to do that using Jaggery carbon module, it gives me the following
> fault output.
>
> I copied the generated bundles to the drop-ins folder also. You can find
> the source code of the bundles on my github 
> repo<https://github.com/kaviththiranga/qaportalconnectorapi>.
> I followed OSGi declarative services approach to create the service.
>
> What should be the cause of this problem? After some research, I could see
> several answers stating that this is caused by the starting order of the
> bundles. If it is so, how can I overcome it?
>
>
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Here is the code from the jag file.
>
> <%
> response.addHeader("Content-Type", "application/json");
>
> var carbon = require('carbon');
> var qaPortal =
> carbon.server.osgiService('org.wso2.carbon.utility.qaportal.QAPortal');
> var products =qaPortal.getAllProducts();
> print(products);
> %>
>
>
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> [Console output]
>
> [2014-02-10 16:11:12,947] ERROR
> {org.jaggeryjs.scriptengine.engine.RhinoEngine} -
> org.mozilla.javascript.WrappedException: Wrapped
> java.lang.NullPointerException (osgi#9)
> [2014-02-10 16:11:12,947] ERROR
> {org.jaggeryjs.jaggery.core.manager.WebAppManager} -
> org.mozilla.javascript.WrappedException: Wrapped
> java.lang.NullPointerException (osgi#9)
> org.jaggeryjs.scriptengine.exceptions.ScriptException:
> org.mozilla.javascript.WrappedException: Wrapped
> java.lang.NullPointerException (osgi#9)
>     at
> org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:582)
>     at
> org.jaggeryjs.scriptengine.engine.RhinoEngine.exec(RhinoEngine.java:280)
>     at
> org.jaggeryjs.jaggery.core.manager.WebAppManager.execute(WebAppManager.java:432)
>     at
> org.jaggeryjs.jaggery.core.JaggeryServlet.doGet(JaggeryServlet.java:24)
>     at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)
>     at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
>     at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
>     at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>     at
> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
>     at
> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:487)
>     at
> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
>     at
> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:339)
>     at
> org.jaggeryjs.jaggery.core.JaggeryFilter.doFilter(JaggeryFilter.java:21)
>     at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
>     at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>     at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
>     at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
>     at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
>     at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
>     at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
>     at
> org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:177)
>     at
> org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:161)
>     at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
>     at
> org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:57)
>     at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
>     at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
>     at
> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
>     at
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
>     at
> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1653)
>     at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
>     at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
>     at java.lang.Thread.run(Thread.java:662)
> Caused by: org.mozilla.javascript.WrappedException: Wrapped
> java.lang.NullPointerException (osgi#9)
>     at
> org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1754)
>     at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:148)
>     at
> org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:225)
>     at
> org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)
>     at org.mozilla.javascript.gen.osgi_7._c_anonymous_2(osgi:9)
>     at org.mozilla.javascript.gen.osgi_7.call(osgi)
>     at
> org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)
>     at
> org.jaggeryjs.rhino.QA_Reports.c1._c_script_0(/QA-Reports//test.jag:5)
>     at org.jaggeryjs.rhino.QA_Reports.c1.call(/QA-Reports//test.jag)
>     at
> org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
>     at
> org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
>     at org.jaggeryjs.rhino.QA_Reports.c1.call(/QA-Reports//test.jag)
>     at org.jaggeryjs.rhino.QA_Reports.c1.exec(/QA-Reports//test.jag)
>     at
> org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:577)
>     ... 31 more
> Caused by: java.lang.NullPointerException
>     at
> org.wso2.carbon.context.PrivilegedCarbonContext.getOSGiService(PrivilegedCarbonContext.java:447)
>     at sun.reflect.GeneratedMethodAccessor43.invoke(Unknown Source)
>     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:126)
>     ... 43 more
>
>
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>
> Thanks
> --
> *Kavith Lokuhewage*
> Software Engineer
> WSO2 Inc. - http://wso2.com
> lean . enterprise . middleware
> Mobile - +9477-9-145-123 | +9471-455-6-401
> Linkedin <http://www.linkedin.com/pub/kavith-lokuhewage/49/473/419>
> Twitter <https://twitter.com/KavithThiranga>
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 

*Ruchira Wageesha**Associate Technical Lead*
*WSO2 Inc. - lean . enterprise . middleware |  wso2.com <http://wso2.com>*

*email: [email protected] <[email protected]>,   blog:
ruchirawageesha.blogspot.com <http://ruchirawageesha.blogspot.com>,
mobile: +94 77 5493444*
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to