Closed maggu2810 closed 8 years ago
@peuter Could you have a look?
@maggu2810 Could you tell me how I can reproduce the Exception. I didn't ran into that problem my using/compiling the comtvisu bundle and I would like to check if adding 'javax.sql' to the import solves the problem before creating a pull request
@peuter You have to use the Karaf branch. I believe the boot delegation Eclipse is using is a little bit weird. All that is not java.* and is used have to be added to the package imports. Eclipse is not so strict, but it will break bundles...
Sorry but I have zero experience with karaf yet. Just checked out the branch and all I can see from the cometvisu is:
[cometvisu.internal.CvActivator:46 ] - SSE API has been started.
No errors, no starting messages, nothing. And I have no idea how to solve that.
I looked at the sources and did not found any information which version of Quercus is bundled. There is no reference in the about.html. I do not know, but shouldn't all third party libraries that are bundled added with their license and the version used? Is it correct that Quercus is using the GPL?
Looking at the v4.0.39 sources the constructor of QuercusEngine creates a new QuercusContext object.
QuercusContext is using e.g.
import javax.cache.Cache;
import javax.sql.DataSource;
and a private member of type DataSource.
Its the current release version 4.0.39 and it seems to be licensed under GPL.
If I have to add every package used by quercus which is not java.* it could be a very long list. Is there a way to configure Karaf in a way that this is not needed (as is the current master branch).
Its the current release version 4.0.39 and it seems to be licensed under GPL.
This is an aspect that I completely overlooked when reviewing the cometvisu PR. :-| It actually means we cannot keep it in our repository and we cannot bundle it with the openHAB 2 distribution at all, because GPL is not at all compatible with the EPL.... @peuter: Is this an integral part of the CometVisu, which cannot be removed or made an optional part?
The CometVisu can work without quercus (as it does before in the old openhab1 binding), it only adds some nice features so that the binding fully supports all CometVisu features. As I am not familiar with the licensing issues I have some questions how to proceed.
@kaikreuzer Let me know what you think.
Any updates about the licensing issue?
Sorry, I didn't reply yet, because I had no good ad-hoc suggestion :-/
addons
, while the online distro could pull both at once automatically.So my personal Todo list would be:
Small update:
Extracting Quercus from the cometvisu bundle to an extra bundle seems to be easier than I thought. But I am using other third party libraries as well (rrd4j: Apache License 2.0, sqlite-jdbc: also Apache License 2.0). Are those allowed?
And as described here: https://github.com/openhab/openhab-distro/blob/master/docs/sources/development/bindings.md As long as I do not use the org.eclipse.smarthome namespace I do not have to worry about EPL-License compability or do I get that wrong?
The following is just my meaning:
Your binding code is using the EPL, Querus is using GPL. If you mix that in one bundle I am sure you violates the EPL license. This does not matter of the project that hosts your code.
If this bundle is distributed in the openhab distro, also that software bundle violates licenses etc.
Are those allowed?
Yes, Apache license is compatible with the EPL, see also https://eclipse.org/legal/eplfaq.php#3RDPARTY.
As long as I do not use the org.eclipse.smarthome namespace I do not have to worry about EPL-License compability or do I get that wrong?
You get it wrong. Although openHAB is not an Eclipse project, it is still licensed under the EPL, so we to make sure that when including 3rd party stuff, this is in line with the EPL.
OK thanks for explaining the license stuff to me. Now some technical questions.
I have extracted the quercus related stuff to a new org.openhab,io.php bundle (is the chosen namespace ok or do you have a better suggestion?), this bundle provides the IQuercusEngine Interface, which the cometvisu bundle references (
Long story short: How do I configure this in the right way? Maybe you can point me to another bundle where this case is handled and where I can see how its done.
I have extracted the quercus related stuff to a new org.openhab,io.php bundle
Thinking about it, it would be actually ideal to have the Quercus lib directly as an OSGi bundle (com.caucho.quercus). I just looked for it, but it seems it is only a plain jar and nobody yet took this effort. But since there is no openHAB specific code in it, we do not need to put it under the openHAB namespace at all. We could just put it up on Github and put it as a jar on JCenter.
And then the cometvisu bundle depends on the quercus bundle and does not start, when that one is not available.
You can mark it as an optional import. Then the bundle will start even if this dependency is not satisfied. See e.g. here, which is also a compile time dependency, which is not fulfilled at runtime.
Ok I moved the quercus bundle to com.caucho.quercus. The package is on github: https://github.com/peuter/quercus-osgi
The cometvisu uses this bundle as import if available. But I don't know how to put it on jcenter.
IMHO you should not use the group id "com.caucho" if it is not owned by yourself.
I'd suggest to move it to openhab/quercus-osgi and we can put it under groupId org.openhab with artifact id com.caucho.quercus - I can then easily make it available on JCenter like the rest.
OK I changed the group id, feel free to move it to openhab.
You actually have to do the move - you can request it in the repo settings as "transfer repository". (I just tested it with a repo to be transferred to you - simply ignore that ;-))
So is there anything else I have to do, to import the bundle from jcenter. I would like to build and test evenrything before I create a pull request, but building failes because of the missing bundle.
No, sorry, I had to do that. I have uploaded the jar to bintray and requested to have it included on jcenter. This is manually approved, so I expect that to happen tomorrow. For the time being, you can add http://dl.bintray.com/openhab/mvn as a repo to your build and you should be fine.
This is manually approved, so I expect that to happen tomorrow.
Wrong assumption, here is the feedback, I got:
Jcenter hosts java applications that follow maven convention. In addition to the .jar and pom files , your version should include a sources jar, and optionally a javadoc jar.
As we do not have sources in this repo, but only wrap the binary, creating such jars probably does not make much sense. But the good news is: We do not really need it on JCenter, since we already have the bintray repo in our pom: https://github.com/openhab/openhab2-addons/blob/master/pom.xml#L329 So all you will need is a
<dependency>
<groupId>org.openhab</groupId>
<artifactId>com.caucho.quercus</artifactId>
<version>4.0.39</version>
<type>jar</type>
</dependency>
in your pom and you should be set.
Sorry that does not work:
[INFO] Scanning for projects... [INFO] Computing target platform for MavenProject: org.openhab.binding:org.openhab.binding.astro:2.0.0-SNAPSHOT @ /home/tobiasb/develop/openhab/openhab2-master2/git/openhab2-addons/addons/binding/org.openhab.binding.astro/pom.xml [INFO] Adding repository http://download.eclipse.org/smarthome/updates-stable [INFO] Adding repository https://dl.bintray.com/kaikreuzer/openhab-core/p2/2.0.0.b1 [INFO] Adding repository http://repository-openhab.forge.cloudbees.com/release/openhab-deps-repo/1.0.0 ... [INFO] Resolving dependencies of MavenProject: org.openhab.ui:org.openhab.ui.cometvisu:2.0.0-SNAPSHOT @ /home/tobiasb/develop/openhab/openhab2-master2/git/openhab2-addons/addons/ui/org.openhab.ui.cometvisu/pom.xml [INFO] {osgi.os=linux, osgi.ws=gtk, org.eclipse.update.install.features=true, osgi.arch=x86} [ERROR] Cannot resolve project dependencies: [ERROR] Software being installed: org.openhab.ui.cometvisu 2.0.0.qualifier [ERROR] Missing requirement: org.openhab.ui.cometvisu 2.0.0.qualifier requires 'package com.caucho.java 0.0.0' but it could not be found [ERROR] [ERROR] See http://wiki.eclipse.org/Tycho/Dependency_Resolution_Troubleshooting for help. [ERROR] Cannot resolve dependencies of MavenProject: org.openhab.ui:org.openhab.ui.cometvisu:2.0.0-SNAPSHOT @ /home/tobiasb/develop/openhab/openhab2-master2/git/openhab2-addons/addons/ui/org.openhab.ui.cometvisu/pom.xml: See log for details -> [Help 1]
@dvanherbergen Shouldn't it work now that Tycho resolves such a dependency from the pom.xml of the project? Do you have any hint?
I would expect so. @peuter, is this in a repo somewhere that I can clone to test?
@dvanherbergen Sure:
https://github.com/peuter/openhab2-addons/tree/cometvisu2-light
There is a problem with the jar. When I build the repo, it downloads https://dl.bintray.com/openhab/mvn/org/openhab/com.caucho.quercus/4.0.39/com.caucho.quercus-4.0.39.jar but this doesn't have any exports in the manifest:
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Built-By: kai
Created-By: Apache Maven 3.3.3
Build-Jdk: 1.8.0_40
Keep in mind that if the jar is updated, then you'll need to build with the -U option to force it to reload the jar.
Good point! @peuter I created the jar by simply running mvn deploy on your project - I guess we will have to add OSGi specific building info to it, e.g. using the maven-bundle-plugin. Would you want to give it a try?
I tried to fix the problem. But I think it is still not right, at least the manifest with the right exports is used now. But I don't think that I included the quercus.jar in the right way. @kaikreuzer Can you do that, or explain what I have to do in detail?
Ok I think I fixed the pom now. At least mvn deploy/install generates a bundle with the correct manifest.
Congrats, looks good! I have just deployed the latest jar to Bintray!
Sorry but I'm stillhaving trouble to get it working. The IDE doesn't seem to find the coucho bundle and is complaining about missing com.caucho imports. Additionally it shows an 4 errors in my pom.xml like:
Plugin execution not covered by lifecycle configuration: org.eclipse.tycho:tycho-compiler-plugin:0.24.0:compile (execution: default-compile, phase: compile)
I have compared my pom.xml with others and can't find out what is causing this error. And when I build the whole project with mvn install the build completes without errors. Bunt when I start the offline distro, activate the cometvisu bundle all I see is this:
[ab.ui.cometvisu.servlet.CometVisuApp] - Started CometVisu UI at /cometvisu serving ../../develop/cometvisu/src/ [ab.ui.cometvisu.servlet.CometVisuApp] - Stopped CometVisu UI [smarthome.event.ExtensionEvent ] - Extension 'ui-cometvisu' has been installed.
The bundle is marked as active but the cometvisu is not running (and btw. the coucho bundle has not been loaded).
So a lot of problems and no clue how to solve any of them. Do you have any ideas?
The IDE doesn't seem to find the coucho bundle and is complaining about missing com.caucho imports.
What helps to make it compile in the IDE is to activate m2e (Configure->Convert to Maven project), which should download the dependency and add it to the build path.
Plugin execution not covered by lifecycle configuration
There is usually a quick fix option available that suppresses these messages.
The bundle is marked as active but the cometvisu is not running
Are all your components (in OSGI-INF) marked as immediate=true?
the coucho bundle has not been loaded
Did you include it as a second bundle in the cometvisu feature?
Ok I found at least one problem: The com.caucho.quercus bundle on bintray does not include the quercus.jar file. I am not able to configure the pom.xml correctly, that it includes the jar. I am pretty sure that it used to work once and have no idea what has happened.
That's indeed a problem, sorry that I didn't notice it either... I don't know either what needs to be changed in the pom.xml to have the jar correctly included, but I'd hope that it should not be too hard.
Ok, it wasn't that easy. The only thing worked, was creating a local repository, deploying the jar file to it and add it as a dependency that must be included. Not really straightforward, though!
I hope the local repository is working when you check out the changes and deploy the bundle, so "fingers-crossed".
@kaikreuzer Have you tried to build and Update the bundle on bintray yet?
Sorry, didn't try it yet, but now it is uploaded. This local repo workaround looks pretty weird, though. I am pretty sure that there is a simpler way, but since I do not have the time to look for it myself, it is ok for now as long as it works.
The workaround is not working either, because the bundle does not use the incuded jar. After spending two full days trying to solve this problem, it feels like I'm runnings against walls and I'm sick of it. I really have no idea how to get this running.
I commited the last version to quercus-osgi. It uses a maven-compatible fork from quercus from the maven repository. It can be build/installed fine, but is not useable by the cometvisu bundle because of missing dependencies. Manually adding those dependencies didn't work.
So I'm stuck here and I won't spend more of my time on this as I do not believe that I can find a solution. I'm wondering why I am running in so many problems when I try to generate a bundle from a jar, which I don't have when I use it directly. Anyway maybe a maven/osgi expert can find a solution for this, I won't!
Sorry to hear that you had to give up... Maybe an OSGi expert like @dvanherbergen can help on the right packaging?
I can have a look. How can I test this?
You can find the quercus-package here: https://github.com/openhab/quercus-osgi
And the openhab-binding that needs it here: https://github.com/peuter/openhab2-addons/tree/cometvisu2-light
in the addons/ui/org.openhab.ui.cometvisu folder. The current problem is, that I cannot build the cometvisu bundle due to dependency problems in the quercus-osgi package.
I've created a PR on the quercus repo. I've changed the build to use the caucho quercus. This one has fewer dependencies. I've also changed to build process so that it shades the original jar rather than trying to embed it. I've updated the build number to 1.0.0 as this is the first release of the openhab quercus, so it doesn't need to use the version number of quercus.
The new bundle loads fine in Karaf, but I haven't tested this with cometvisu. In OH2, the pom for cometvisu also doesn't have any dependencies on this jar, is this work in progress?
@peuter could you test the updated version? You will need to do the following:
mvn clean install
<dependency>
<groupId>org.openhab</groupId>
<artifactId>com.caucho.quercus</artifactId>
<version>1.0.0</version>
</dependency>
<bundle start-level="80">mvn:org.openhab/com.caucho.quercus/1.0.0</bundle>
FYI, it is possible that the karaf feature build will not find the dependency from the local maven repo. It may need to be deployed to bintray first.
Why not using the maven-bundle-plugin to get IMHO better import and export package manifest entries? https://github.com/maggu2810/quercus-osgi/blob/maven-bundle-plugin/com.caucho.quercus/pom.xml
I set resolution to optional because I assume you do not use all that stuff.
@maggu2810, feel free to create PR...
The package imports do miss some stuff. e.g. the bundled quercus library (that is added to the classpath of cometvisu) imports javax.sql.DataSource but the cometvisu bundle's manifest miss that part.