HEADS-project / training

Training material to get started with the HEADS technologies
10 stars 16 forks source link

Javascript node complaining about missing java deployment unit #34

Closed kehusa closed 9 years ago

kehusa commented 9 years ago

I am running identical kevs on both java and javascript:

add chatserver : JavascriptNode add chatclient0 : JavaNode

// provide a network way to connect to those nodes network chatserver.ip.lo 127.0.0.1 network chatclient0.ip.lo 127.0.0.1

add group : WSGroup set group.master = 'chatserver' attach chatserver, chatclient0 group

// create and add your HelloWorld component (named "myComp") in "node0" add chatserver.server : no.tellu.ChatServer add chatclient0.client : no.tellu.ChatClient

The java node chatclient0 starts as expected, but the javascript node chatserver is complaining about missing deployment unit: Fatal error: "grunt-kevoree" unable to parse KevScript Unable to find "no.tellu.ChatClient" in current model nor on Kevoree registry.

I would not expect the javascript node chatserver to care about no.tellu.ChatClient at all. Why is it asking for it?

maxleiko commented 9 years ago

That's a good question. I'll dig into that.

maxleiko commented 9 years ago

Okay, that's because KevScript interpretation is made before runtime execution. So, it actually tries to find each TypeDefinition. Which it cannot do, because your Java comp isn't published.

kehusa commented 9 years ago

How do I fix this? My java comp is in my local maven repo. Can I refer to it from my gruntfile?

2015-02-04 9:20 GMT+01:00 Maxime Tricoire notifications@github.com:

Okay, that's because KevScript interpretation is made before runtime execution. So, it actually tries to find each TypeDefinition. Which it cannot do, because your Java comp isn't published.

— Reply to this email directly or view it on GitHub https://github.com/HEADS-project/training/issues/34#issuecomment-72807941 .

Knut Eilif Husa

Tellu AS Email: knut.eilif.husa@tellu.no Mob: (+47) 452 49496 Web: www.tellu.no

maxleiko commented 9 years ago

No you cannot. Currently cross-platform devlopment phase is not really 'good' as you have to publish your entities first in order to make them available on Kevoree Registry.

kehusa commented 9 years ago

How do I publish my components to kevoree registry? Because this is the only way forward just now, as far as I understand?

2015-02-04 9:28 GMT+01:00 Maxime Tricoire notifications@github.com:

No you cannot. Currently cross-platform devlopment phase is not really 'good' as you have to publish your entities first in order to make them available on Kevoree Registry.

— Reply to this email directly or view it on GitHub https://github.com/HEADS-project/training/issues/34#issuecomment-72808741 .

Knut Eilif Husa

Tellu AS Email: knut.eilif.husa@tellu.no Mob: (+47) 452 49496 Web: www.tellu.no

maxleiko commented 9 years ago

I recommend you to publish the JavaScript parts. As it is way simplier than the Java/Mvn part. Just register an account on npmjs.org and then follow those step to log into your local npm https://docs.npmjs.com/cli/adduser

Once this is done, you can do "npm publish"

maxleiko commented 9 years ago

And "npm publish" will trigger the required grunt task that will also publish your entity to Kevoree Registry.

Publish to Kevoree Registry without publishing on mvn, npm, or anything else makes no sense. You have to have your DeployUnits available on some package manager. That's why, in kevoree-js, a grunt task is triggered when you do an "npm publish", and for Kevoree java, it is also made on mvn publish by a Kevoree mvn plugin.

kehusa commented 9 years ago

What specifically do I have to enter here? My user at npmjs is kehusa

npm adduser --registry=http://myregistry.example.com --scope=@myco

2015-02-04 9:40 GMT+01:00 Maxime Tricoire notifications@github.com:

And "npm publish" will trigger the required grunt task that will also publish your entity to Kevoree Registry.

Publish to Kevoree Registry without publishing on mvn, npm, or anything else makes no sense. You have to have your DeployUnits available on some package manager. That's why, in kevoree-js, a grunt task is triggered when you do an "npm publish", and for Kevoree java, it is also made on mvn publish by a Kevoree mvn plugin.

— Reply to this email directly or view it on GitHub.

Knut Eilif Husa

Tellu AS Email: knut.eilif.husa@tellu.no Mob: (+47) 452 49496 Web: www.tellu.no

maxleiko commented 9 years ago

Just npm adduser and follow the prompts then I think.

maxleiko commented 9 years ago

It is the default login process. The goal is to register your local npm cli to the official npm registry. For the Kevoree Registry you do not have to do anything. Everything is handled by the grunt task.

maxleiko commented 9 years ago

If you check the package.json of your component project you will see that on "npm publish" (scripts.postpublish) it triggers "grunt publish", that's what publishes your kevlib.json to Kevoree Registry once your node.js module is published on npm.

kehusa commented 9 years ago

Then I successfully published my component :-)

2015-02-04 9:54 GMT+01:00 Maxime Tricoire notifications@github.com:

If you check the package.json of your component project you will see that on "npm publish" (scripts.postpublish) it triggers "grunt publish", that's what publishes your kevlib.json to Kevoree Registry once your node.js module is published on npm.

— Reply to this email directly or view it on GitHub https://github.com/HEADS-project/training/issues/34#issuecomment-72811571 .

Knut Eilif Husa

Tellu AS Email: knut.eilif.husa@tellu.no Mob: (+47) 452 49496 Web: www.tellu.no

kehusa commented 9 years ago

I am then following the description in tutorial 5, but of course, my java comp ChatClient is not available in kevoree registry: Unable to find "no.tellu.ChatClient" in current model nor on Kevoree registry. It is on my local machine. Is there any way to load it?

2015-02-04 9:57 GMT+01:00 Knut Eilif Husa knut.eilif.husa@tellu.no:

Then I successfully published my component :-)

2015-02-04 9:54 GMT+01:00 Maxime Tricoire notifications@github.com:

If you check the package.json of your component project you will see that on "npm publish" (scripts.postpublish) it triggers "grunt publish", that's what publishes your kevlib.json to Kevoree Registry once your node.js module is published on npm.

— Reply to this email directly or view it on GitHub https://github.com/HEADS-project/training/issues/34#issuecomment-72811571 .

Knut Eilif Husa

Tellu AS Email: knut.eilif.husa@tellu.no Mob: (+47) 452 49496 Web: www.tellu.no

Knut Eilif Husa

Tellu AS Email: knut.eilif.husa@tellu.no Mob: (+47) 452 49496 Web: www.tellu.no

maxleiko commented 9 years ago

Oh, I'm sorry Knut, I wasn't well awake obviously. Your use case does not involve "real" cross-platform component, so you don't really need to publish any of your component.
Actually you should use two separate KevScript, so that the interpretation won't trigger errors, something as:

For kevoree-js

add jsNode : JavascriptNode
add jsNode.comp: no.tellu.MyJsComp
add javaNode : JavaNode
add group: WSGroup

set group.master = "javaNode"

attach jsNode, javaNode group

network javaNode.ip.lo 127.0.0.1

and for kevoree java

add jsNode : JavascriptNode
add javaNode : JavaNode
add javaNode.comp: no.tellu.MyJavaComp
add group: WSGroup

set group.master = "javaNode"

attach jsNode, javaNode group

network javaNode.ip.lo 127.0.0.1

By doing so, you get rid of the KevScript interpretor error, and your example is still running as you expect. Really sorry for the misleading :(

maxleiko commented 9 years ago

Because, as you said, and you said it well, the JavascriptNode doesn't need to know the components running on the Java platform, so just get rid of them in the KevScript you are using in your kevoree-js runtime.
Same thing for the Java runtime, but for the JavaScript libraries.