You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Guillaume Nodet <gn...@gmail.com> on 2010/04/06 16:47:52 UTC

Re: Embedding Hibernate in an OSGi bundle using maven-bundle-plugin is hard

Is there any reason why you want to embed hibernate instead of using it as a
real bundle ?
Also the problem isn't really maven i think, as whichever tool you use,
you'll have to write the manifest somehow.
Instead of going that way, I would do the following:
   * mark all imports as optional
   * deploy your bundles
   * check which packages are actually needed by deploying dependencies
until things work
   * mark the imports from these dependencies as mandatory
This is not really clean, but I don't see what else you can do if you don't
want to use the existing hibernate bundles.

On Tue, Apr 6, 2010 at 16:41, Dan H <hu...@yahoo.de> wrote:

> Just found out that a similar issue has already been addressed here:
> http://issues.apache.org/jira/browse/FELIX-954
>
> I checked out the current trunk, only to find out that the problem
> remains. Looking at the code was very helpful, I now suspect that the
> problem is actually caused by a cyclic dependency that causes
> MavenProject.getArtifacts() to return an incomplete (?) collection in
> BundlePlugin.getEmbeddableArtifacts().
>
> The cycle exists in dom4j-1.6.1 which depends on dom4j-1.5.2 which
> depends on jaxen1.1-beta which depends on dom4j-1.5.2 (see
> http://jira.codehaus.org/browse/MNG-1944)
>
> This is backed up by the dependency plugin which states:
> [INFO] The following files have been resolved:
> [INFO]    antlr:antlr:jar:2.7.6:compile
> [INFO]    c3p0:c3p0:jar:0.9.1:compile
> [INFO]    cglib:cglib:jar:2.1.3:compile
> [INFO]    commons-collections:commons-collections:jar:3.1:compile
> [INFO]    de.huss:kurt:jar:1.0.0:provided
> [INFO]    dom4j:dom4j:jar:1.6.1:compile
> [INFO]    javax.transaction:jta:jar:1.1:compile
> [INFO]    junit:junit:jar:4.6:test
> [INFO]    mysql:mysql-connector-java:jar:5.1.12:compile
> [INFO]    org.apache.felix:javax.servlet:jar:1.0.0:provided
> [INFO]    org.apache.felix:org.osgi.compendium:jar:1.4.0:provided
> [INFO]    org.apache.felix:org.osgi.core:jar:1.4.0:provided
> [INFO]    org.apache.felix:org.osgi.foundation:jar:1.2.0:provided
> [INFO]    org.hibernate:hibernate-c3p0:jar:3.3.2.GA:compile
> [INFO]    org.hibernate:hibernate-core:jar:3.3.2.GA:compile
> [INFO]    org.slf4j:slf4j-api:jar:1.5.8:compile
> [INFO]    xml-apis:xml-apis:jar:1.0.b2:compile
>
> All of the dom4j dependencies are missing.
>
> I assume it is not easily possible to detect this situation since no
> exception appears to be thrown by MavenProject.getArtifacts() when a
> cyclic dependency stops the resolve process.
>
> Anyway, I'm giving up on Maven integration. Thanks again for all your help.
>
> -Dan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Re: Embedding Hibernate in an OSGi bundle using maven-bundle-plugin is hard

Posted by Dan H <hu...@yahoo.de>.

-------- Original Message  --------
Subject: Re: Embedding Hibernate in an OSGi bundle using
maven-bundle-plugin 	is hard
From: Guillaume Nodet <gn...@gmail.com>
To: users@felix.apache.org
Date: 06.04.2010 16:47

> Is there any reason why you want to embed hibernate instead of using it as a
> real bundle ?

I was expecting that having Maven manage all dependencies including
dependencies on other bundles would be possible. However, I couldn't
find any artifacts that would just let me do this:

		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-core-osgi</artifactId>
			<version>3.3.2</version>
			<scope>provided</scope>
		</dependency>

So embedding the existing artifacts seemed to be the next best solution.

> Also the problem isn't really maven i think, as whichever tool you use,
> you'll have to write the manifest somehow.

I agree, there's nothing wrong with Maven. But I'm a lazy bastard. Was
kind of hoping for maven-bundle-plugin to provide a 1:1 mapping: Maven
artifact ----> OSGi bundle. The thought of not ever having to touch that
manifest seemed appealing.

> Instead of going that way, I would do the following:
>    * mark all imports as optional
>    * deploy your bundles
>    * check which packages are actually needed by deploying dependencies
> until things work
>    * mark the imports from these dependencies as mandatory
> This is not really clean, but I don't see what else you can do if you don't
> want to use the existing hibernate bundles.
> 

Clean sounds good. I'd rather do everything by hand than have anything
in my pom/manifest that isn't self-explanatory.

I was able to install a hibernate bundle from
http://osgi-hibernate.googlecode.com but I couldn't find a way to turn
it into a Maven artifact. Am I missing something?

-Dan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org