Hi,

I put sample OSGi bundle into uuf osgi/dropins folder and checked OSGi
services using 'services' command. It showed the sample osgi service.

1) Then I tested getOSGiService(..) method using sample OSGi service as
following.

function onRequest(context) {
    getOSGiServices("org.wso2.mbp.sample01.Service");
}

I got the following exception when loading required page.

[2016-05-31 10:20:47,931] ERROR {org.wso2.carbon.uuf.internal.UUFRegistry}
- A server occurred while serving for request
'/bpmn-explorer/bpmn/process'. org.wso2.carbon.uuf.exception.UUFException:
Cannot create the initial context when calling OSGi service
'org.wso2.mbp.sample01.Service'.
    at org.wso2.carbon.uuf.core.API.getOSGiServices(API.java:104)
    at
org.wso2.carbon.uuf.handlebars.JSExecutable$$Lambda$89/1787549760.call(Unknown
Source)
    at
jdk.nashorn.internal.scripts.Script$Recompilation$8$28A$\^eval\_.onRequest(/home/sudharma/Documents/carbon-uuf/product/target/wso2uuf-1.0.0-m5/deployment/uufapps/org.wso2.uuf.sample.bpmn-explorer/components/root/pages/bpmn/process.js:4)
    at
jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:638)
    at
jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:229)
    at
jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:387)
    at
jdk.nashorn.api.scripting.ScriptObjectMirror.callMember(ScriptObjectMirror.java:192)
    at
jdk.nashorn.api.scripting.NashornScriptEngine.invokeImpl(NashornScriptEngine.java:381)
    at
jdk.nashorn.api.scripting.NashornScriptEngine.invokeFunction(NashornScriptEngine.java:187)
    at
org.wso2.carbon.uuf.handlebars.JSExecutable.execute(JSExecutable.java:72)
    at
org.wso2.carbon.uuf.handlebars.renderable.HbsPageRenderable.executeExecutable(HbsPageRenderable.java:92)
    at
org.wso2.carbon.uuf.handlebars.renderable.HbsPageRenderable.render(HbsPageRenderable.java:63)
    at org.wso2.carbon.uuf.core.Page.render(Page.java:48)
    at org.wso2.carbon.uuf.core.Component.renderPage(Component.java:89)
    at org.wso2.carbon.uuf.core.App.renderPage(App.java:85)
    at org.wso2.carbon.uuf.internal.UUFRegistry.serve(UUFRegistry.java:113)
    at
org.wso2.carbon.uuf.connector.ms.UUFMicroservice.execute(UUFMicroservice.java:105)
    at
org.wso2.carbon.uuf.connector.ms.UUFMicroservice.get(UUFMicroservice.java:93)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at
org.wso2.msf4j.internal.router.HttpMethodInfo.invoke(HttpMethodInfo.java:95)
    at
org.wso2.msf4j.internal.router.HttpDispatcher.channelRead0(HttpDispatcher.java:53)
    at
org.wso2.msf4j.internal.router.HttpDispatcher.channelRead0(HttpDispatcher.java:31)
    at
io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
    at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)
    at
io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:32)
    at
io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:299)
    at
io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:36)
    at
io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:110)
    at
io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)
    at java.lang.Thread.run(Thread.java:745)


2) Also I tested callOSGiService() as following

function onRequest(context) {
    callOSGiService("org.wso2.mbp.sample01.Service", "test", null);
}

Got the following exception for that also.


[2016-05-31 10:32:39,398] ERROR {org.wso2.carbon.uuf.internal.UUFRegistry}
- A server occurred while serving for request
'/bpmn-explorer/bpmn/process'. org.wso2.carbon.uuf.exception.UUFException:
An error occurred when executing the 'onRequest' function in JavaScript
file
'/home/sudharma/Documents/carbon-uuf/product/target/wso2uuf-1.0.0-m5/deployment/uufapps/org.wso2.uuf.sample.bpmn-explorer/components/root/pages/bpmn/process.js'
with context '{app={context=/bpmn-explorer,
config={lifecycle=[{state=adopted, show=false}, {state=new, show=true}],
elementsPerPage=10, menu={main=[{icon=fw-home, link=#home, text=Home}, {MY
TASKS=[{icon=fw fw-list, link=bpmn, text=MY TASKS}]}, {CLAIMABLE
TASKS=[{icon=fw fw-add, link=bpmn/claimableTasks, text=CLAIMABLE TASKS}]},
{COMPLETED TASKS=[{icon=fw fw-bug, link=bpmn/historicTasks, text=COMPLETED
TASKS}]}, {PROCESSES=[{icon=fw fw-list, link=bpmn/process,
text=PROCESSES}]}]}, defaultTheme=org.wso2.uuf.theme.default, appName=BPMN
Explorer, productName=Unified UI Base}}, request={"method": "GET",
"protocol": "HTTP/1.1", "uri": "/bpmn-explorer/bpmn/process",
"queryString": "null"}, uriParams={}}'.
    at
org.wso2.carbon.uuf.handlebars.JSExecutable.execute(JSExecutable.java:75)
    at
org.wso2.carbon.uuf.handlebars.renderable.HbsPageRenderable.executeExecutable(HbsPageRenderable.java:92)
    at
org.wso2.carbon.uuf.handlebars.renderable.HbsPageRenderable.render(HbsPageRenderable.java:63)
    at org.wso2.carbon.uuf.core.Page.render(Page.java:48)
    at org.wso2.carbon.uuf.core.Component.renderPage(Component.java:89)
    at org.wso2.carbon.uuf.core.App.renderPage(App.java:85)
    at org.wso2.carbon.uuf.internal.UUFRegistry.serve(UUFRegistry.java:113)
    at
org.wso2.carbon.uuf.connector.ms.UUFMicroservice.execute(UUFMicroservice.java:105)
    at
org.wso2.carbon.uuf.connector.ms.UUFMicroservice.get(UUFMicroservice.java:93)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at
org.wso2.msf4j.internal.router.HttpMethodInfo.invoke(HttpMethodInfo.java:95)
    at
org.wso2.msf4j.internal.router.HttpDispatcher.channelRead0(HttpDispatcher.java:53)
    at
org.wso2.msf4j.internal.router.HttpDispatcher.channelRead0(HttpDispatcher.java:31)
    at
io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
    at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)
    at
io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:32)
    at
io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:299)
    at
io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:36)
    at
io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:110)
    at
io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)
    at java.lang.Thread.run(Thread.java:745)
Caused by: javax.script.ScriptException: TypeError:
org.wso2.carbon.uuf.handlebars.JSExecutable$$Lambda$87/1272884125@25700705
is not a function in
/home/sudharma/Documents/carbon-uuf/product/target/wso2uuf-1.0.0-m5/deployment/uufapps/org.wso2.uuf.sample.bpmn-explorer/components/root/pages/bpmn/process.js
at line number 3
    at
jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(NashornScriptEngine.java:455)
    at
jdk.nashorn.api.scripting.NashornScriptEngine.invokeImpl(NashornScriptEngine.java:387)
    at
jdk.nashorn.api.scripting.NashornScriptEngine.invokeFunction(NashornScriptEngine.java:187)
    at
org.wso2.carbon.uuf.handlebars.JSExecutable.execute(JSExecutable.java:72)
    ... 23 more
Caused by:
/home/sudharma/Documents/carbon-uuf/product/target/wso2uuf-1.0.0-m5/deployment/uufapps/org.wso2.uuf.sample.bpmn-explorer/components/root/pages/bpmn/process.js:3
TypeError:
org.wso2.carbon.uuf.handlebars.JSExecutable$$Lambda$87/1272884125@25700705
is not a function
    at jdk.nashorn.internal.runtime.ECMAErrors.error(ECMAErrors.java:57)
    at
jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:213)
    at
jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:185)
    at
jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:172)
    at
jdk.nashorn.internal.runtime.linker.NashornBottomLinker.linkBean(NashornBottomLinker.java:100)
    at
jdk.nashorn.internal.runtime.linker.NashornBottomLinker.getGuardedInvocation(NashornBottomLinker.java:71)
    at
jdk.internal.dynalink.support.CompositeGuardingDynamicLinker.getGuardedInvocation(CompositeGuardingDynamicLinker.java:124)
    at
jdk.internal.dynalink.support.LinkerServicesImpl.getGuardedInvocation(LinkerServicesImpl.java:149)
    at jdk.internal.dynalink.DynamicLinker.relink(DynamicLinker.java:233)
    at
jdk.nashorn.internal.scripts.Script$Recompilation$15$28A$\^eval\_.onRequest(/home/sudharma/Documents/carbon-uuf/product/target/wso2uuf-1.0.0-m5/deployment/uufapps/org.wso2.uuf.sample.bpmn-explorer/components/root/pages/bpmn/process.js:3)
    at
jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:638)
    at
jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:229)
    at
jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:387)
    at
jdk.nashorn.api.scripting.ScriptObjectMirror.callMember(ScriptObjectMirror.java:192)
    at
jdk.nashorn.api.scripting.NashornScriptEngine.invokeImpl(NashornScriptEngine.java:381)
    ... 25 more


Appreciate if you can help to resolve these issues.

Thanks
Sudharma
-- 
Sudharma Subasinghe,
Software Engineer,
WSO2 Inc.
Email: sudhar...@wso2.com <hasi...@wso2.com>
Mobile : +94 710 565 157 <%2B94%20718%20210%20200>
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to