You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Scott Parkerson <sc...@gmail.com> on 2009/09/15 17:20:33 UTC

Using PostgreSQL JDBC driver + Hibernate within SMX4/OSGi

Greetings, all:

Has anyone managed to get Hibernate + Spring to work with JDBC
(PostgreSQL) or otherwise inside of ServiceMix 4 / OSGi? Currently, I
have a web application whose guts (just the model + business services) I
need for my SMX 4 based application. The full-fledged web application is
currently deployed on Tomcat 5.5.27. I'm wondering how one configures
the bundle (or beans) in a similar fashion to Tomcat's context.xml.

Has anyone on this list done something like this? Any pointers?

Thanks,
Scott

Re: Using PostgreSQL JDBC driver + Hibernate within SMX4/OSGi

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Scott,

You have a sample how to use servicemix-bean component to interact with 
a database:

http://svn.apache.org/repos/asf/servicemix/smx3/trunk/samples/database-bean/

You can use the code that you need including Hibernate stuff.

Regards
JB

Scott Parkerson wrote:
> Greetings, all:
> 
> Has anyone managed to get Hibernate + Spring to work with JDBC
> (PostgreSQL) or otherwise inside of ServiceMix 4 / OSGi? Currently, I
> have a web application whose guts (just the model + business services) I
> need for my SMX 4 based application. The full-fledged web application is
> currently deployed on Tomcat 5.5.27. I'm wondering how one configures
> the bundle (or beans) in a similar fashion to Tomcat's context.xml.
> 
> Has anyone on this list done something like this? Any pointers?
> 
> Thanks,
> Scott
> 

Re: Using PostgreSQL JDBC driver + Hibernate within SMX4/OSGi

Posted by Willem Jiang <wi...@gmail.com>.
Hi Scott,

The bundle that you are looking for is hosted in the springsource 
external bundles repo[1]
Please add it into mvn.cfg.

BTW, you can search the bundles in this page[2]

[1] http://repository.springsource.com/maven/bundles/external
[2] http://www.springsource.com/repository/app/

Willem

Scott Parkerson wrote:
> Charles,
> 
> Well, everything is *almost* going swimmingly, except for the fact that 
> the hibernate feature isn't installing due to it not being able to 
> resolve antlr's mvn URL.
> 
> I worked around that issue by updating the following line in 
> $SERVICEMIX_HOME/etc/org.ops4j.pax.url.mvn.cfg to read:
> 
> org.ops4j.pax.url.mvn.repositories=http://repo1.maven.org/maven2,http://repo.open.iona.com/maven2-snapshot@snapshots@noreleases,http://repository.ops4j.org/maven2,http://svn.apache.org/repos/asf/servicemix/m2-repo,http://repo.open.iona.com/maven2,http://repository.springsource.com/maven/bundles/release,http://repository.springsource.com/maven/bundles/external,http://maven.springframework.org/release 
> 
> 
> However, now it cannot resolve 
> mvn:org.hibernate/com.springsource.org.hibernate/3.3.2.GA
> 
> --sgp
> cf. http://www.smerpology.org/
> 
> 
> 
> 


Re: Using PostgreSQL JDBC driver + Hibernate within SMX4/OSGi

Posted by Charles Moulliard <cm...@gmail.com>.
yes. After downloading from svn the bundles dom4j folder or perhaps
bundles containing these bundles, run the maven command : mvn clean
install to install the jar in your local repository

When karaf/servicemix will install this feature, the file will be
download from your local repo

regards,

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com



On Thu, Sep 17, 2009 at 1:32 PM, Scott Parkerson
<sc...@gmail.com> wrote:
>
> On Sep 17, 2009, at 3:24 AM, Charles Moulliard wrote:
>
>> It is better to build the snapshot of dom4j. Why because the offcial
>> release
>> of Dom4j is not osgified. That means that the file MANIFEST does not
>> export/import the packagename and their versions required during the
>> deployment on an OSGI server (Felix, Equinox, Knopf ....). This job has
>> been
>> done for ServiceMix ;-)
>>
>> Here is the svn link of this bundle :
>> http://svn.apache.org/repos/asf/servicemix/smx4/bundles/trunk/dom4j-1.6
>
> So, the best thing to do is to:
>
> 1. Get the dom4j-1.6.1 source
> 2. Use the pom.xml in the svn link above to build it?
> 3. Deploy and be happy!
>
> --sgp
> cf. http://www.smerpology.org/
>
>
>
>

Re: Using PostgreSQL JDBC driver + Hibernate within SMX4/OSGi

Posted by Scott Parkerson <sc...@gmail.com>.
On Sep 17, 2009, at 3:24 AM, Charles Moulliard wrote:

> It is better to build the snapshot of dom4j. Why because the offcial  
> release
> of Dom4j is not osgified. That means that the file MANIFEST does not
> export/import the packagename and their versions required during the
> deployment on an OSGI server (Felix, Equinox, Knopf ....). This job  
> has been
> done for ServiceMix ;-)
>
> Here is the svn link of this bundle :
> http://svn.apache.org/repos/asf/servicemix/smx4/bundles/trunk/ 
> dom4j-1.6

So, the best thing to do is to:

1. Get the dom4j-1.6.1 source
2. Use the pom.xml in the svn link above to build it?
3. Deploy and be happy!

--sgp
cf. http://www.smerpology.org/




Re: Using PostgreSQL JDBC driver + Hibernate within SMX4/OSGi

Posted by Charles Moulliard <cm...@gmail.com>.
Scott,

It is better to build the snapshot of dom4j. Why because the offcial release
of Dom4j is not osgified. That means that the file MANIFEST does not
export/import the packagename and their versions required during the
deployment on an OSGI server (Felix, Equinox, Knopf ....). This job has been
done for ServiceMix ;-)

Here is the svn link of this bundle :
http://svn.apache.org/repos/asf/servicemix/smx4/bundles/trunk/dom4j-1.6

Regards

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com


On Wed, Sep 16, 2009 at 11:26 PM, Scott Parkerson <scott.parkerson@gmail.com
> wrote:

>
> On Sep 16, 2009, at 1:37 PM, Scott Parkerson wrote:
>
>>
>> However, now it cannot resolve
>> mvn:org.hibernate/com.springsource.org.hibernate/3.3.2.GA
>>
>
> (after a while of poking at it...)
>
> Well, looks like 3.3.2.GA isn't available as a bundle. But 3.3.1.GA is.
>
> I changed this to use 3.3.1.GA, which seems to install, but won't start
> due to a problem with dom4j:
>
> a) dom4j can't be started due to a strict dependency on org.xmlpull.v1 (cf.
> https://issues.apache.org/activemq/browse/SMX4-254) and
> b) Hibernate requires dom4j>=1.6.1 (but ! >= 1.7.0)
>
> While I could bundle my own version of dom4j, it would be awesome to have
> an update in the SMX repository.
>
>
> --sgp
> cf. http://www.smerpology.org/
>
>
>
>

Re: Using PostgreSQL JDBC driver + Hibernate within SMX4/OSGi

Posted by Scott Parkerson <sc...@gmail.com>.
On Sep 16, 2009, at 1:37 PM, Scott Parkerson wrote:
>
> However, now it cannot resolve mvn:org.hibernate/ 
> com.springsource.org.hibernate/3.3.2.GA

(after a while of poking at it...)

Well, looks like 3.3.2.GA isn't available as a bundle. But 3.3.1.GA is.

I changed this to use 3.3.1.GA, which seems to install, but won't  
start due to a problem with dom4j:

a) dom4j can't be started due to a strict dependency on org.xmlpull.v1  
(cf. https://issues.apache.org/activemq/browse/SMX4-254) and
b) Hibernate requires dom4j>=1.6.1 (but ! >= 1.7.0)

While I could bundle my own version of dom4j, it would be awesome to  
have an update in the SMX repository.

--sgp
cf. http://www.smerpology.org/




Re: Using PostgreSQL JDBC driver + Hibernate within SMX4/OSGi

Posted by Scott Parkerson <sc...@gmail.com>.
Charles,

Well, everything is *almost* going swimmingly, except for the fact  
that the hibernate feature isn't installing due to it not being able  
to resolve antlr's mvn URL.

I worked around that issue by updating the following line in  
$SERVICEMIX_HOME/etc/org.ops4j.pax.url.mvn.cfg to read:

org.ops4j.pax.url.mvn.repositories=http://repo1.maven.org/maven2,http://repo.open.iona.com/maven2-snapshot@snapshots@noreleases,http://repository.ops4j.org/maven2,http://svn.apache.org/repos/asf/servicemix/m2-repo,http://repo.open.iona.com/maven2,http://repository.springsource.com/maven/bundles/release,http://repository.springsource.com/maven/bundles/external,http://maven.springframework.org/release

However, now it cannot resolve mvn:org.hibernate/ 
com.springsource.org.hibernate/3.3.2.GA

--sgp
cf. http://www.smerpology.org/




Re: Using PostgreSQL JDBC driver + Hibernate within SMX4/OSGi

Posted by Charles Moulliard <cm...@gmail.com>.
Except the following repo for Hibernate, I don't know any other :
http://www.springsource.com/repository/app/

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com


On Wed, Sep 16, 2009 at 4:04 PM, Scott Parkerson
<sc...@gmail.com>wrote:

>
> On Sep 16, 2009, at 9:54 AM, Charles Moulliard wrote:
>
>>
>> Features is the mechanism provided by default under Apache Felix Karaf and
>> of course ServiceMix. As features provides a way for provisioning your
>> bundles, this is from my point of view the most natural way to work. You
>> are
>> not oblige to embed it in a jar and you can use the following syntax to
>> allow the osgi server to access it --> mvn:groupId/ArtifactId/Version
>>
>> What I like too in Features, is that this a contract where you centralize
>> all the jar/ version about the component to be deployed for a project !
>> Maintenance is one of the key success factor of a project.
>>
>
> Ok. I'm sold on features!
>
> The thing that I was wondering is if someone out there has created a
> feature respository for hibernate, etc. that one could just add rather than
> having to create my own specific set. If the answer is "probably not",
> that's OK, as creating my own features.xml and distributing it is probably
> Not That Bad. :D
>
> Thanks!
>
>
> --sgp
> cf. http://www.smerpology.org/
>
>
>
>

Re: Using PostgreSQL JDBC driver + Hibernate within SMX4/OSGi

Posted by Scott Parkerson <sc...@gmail.com>.
On Sep 16, 2009, at 9:54 AM, Charles Moulliard wrote:
>
> Features is the mechanism provided by default under Apache Felix  
> Karaf and
> of course ServiceMix. As features provides a way for provisioning your
> bundles, this is from my point of view the most natural way to work.  
> You are
> not oblige to embed it in a jar and you can use the following syntax  
> to
> allow the osgi server to access it --> mvn:groupId/ArtifactId/Version
>
> What I like too in Features, is that this a contract where you  
> centralize
> all the jar/ version about the component to be deployed for a  
> project !
> Maintenance is one of the key success factor of a project.

Ok. I'm sold on features!

The thing that I was wondering is if someone out there has created a  
feature respository for hibernate, etc. that one could just add rather  
than having to create my own specific set. If the answer is "probably  
not", that's OK, as creating my own features.xml and distributing it  
is probably Not That Bad. :D

Thanks!

--sgp
cf. http://www.smerpology.org/




Re: Using PostgreSQL JDBC driver + Hibernate within SMX4/OSGi

Posted by Charles Moulliard <cm...@gmail.com>.
There are different ways to deploy bundles in a OSGI container. Depending of
the religion to which you belong, some people will argue that they prefer to
use Osgi Bundle Repository, other profile of PAX Runner, other simply
bundles deployed manually, ... and finally features.

Features is the mechanism provided by default under Apache Felix Karaf and
of course ServiceMix. As features provides a way for provisioning your
bundles, this is from my point of view the most natural way to work. You are
not oblige to embed it in a jar and you can use the following syntax to
allow the osgi server to access it --> mvn:groupId/ArtifactId/Version

What I like too in Features, is that this a contract where you centralize
all the jar/ version about the component to be deployed for a project !
Maintenance is one of the key success factor of a project.

Regards,

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com


On Wed, Sep 16, 2009 at 3:23 PM, Scott Parkerson
<sc...@gmail.com>wrote:

>
> On Sep 15, 2009, at 11:28 AM, Charles Moulliard wrote:
>
>  Hi Scott,
>>
>> I have used in my tutorial MySql but the principe is the same. You can
>> have
>> a look to my tutorial here :
>>
>> http://camel.apache.org/tutorial-osgi-camel-part2.html
>>
>>
> Ok, one more question:
>
> Are there no "official" FUSE/ServiceMix bundled features for SMX4 for
> Hibernate, JBDC drivers, etc? I see that there's a portion of the tutorial
> where I can generate my features.xml and put them in one of my bundles. Is
> that the best way (for now)?
>
> --sgp
> cf. http://www.smerpology.org/
>
>
>
>

Re: Using PostgreSQL JDBC driver + Hibernate within SMX4/OSGi

Posted by Scott Parkerson <sc...@gmail.com>.
On Sep 15, 2009, at 11:28 AM, Charles Moulliard wrote:

> Hi Scott,
>
> I have used in my tutorial MySql but the principe is the same. You  
> can have
> a look to my tutorial here :
>
> http://camel.apache.org/tutorial-osgi-camel-part2.html
>

Ok, one more question:

Are there no "official" FUSE/ServiceMix bundled features for SMX4 for  
Hibernate, JBDC drivers, etc? I see that there's a portion of the  
tutorial where I can generate my features.xml and put them in one of  
my bundles. Is that the best way (for now)?

--sgp
cf. http://www.smerpology.org/




Re: Using PostgreSQL JDBC driver + Hibernate within SMX4/OSGi

Posted by Scott Parkerson <sc...@gmail.com>.
On Tue, Sep 15, 2009 at 11:28 AM, Charles Moulliard
<cm...@gmail.com> wrote:
> Hi Scott,
>
> I have used in my tutorial MySql but the principe is the same. You can have
> a look to my tutorial here :
>
> http://camel.apache.org/tutorial-osgi-camel-part2.html

This looks *exactly* what I was looking for. I'll give it a go...

--sgp

Re: Using PostgreSQL JDBC driver + Hibernate within SMX4/OSGi

Posted by Charles Moulliard <cm...@gmail.com>.
Hi Scott,

I have used in my tutorial MySql but the principe is the same. You can have
a look to my tutorial here :

http://camel.apache.org/tutorial-osgi-camel-part2.html

Regards,

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com


On Tue, Sep 15, 2009 at 5:20 PM, Scott Parkerson
<sc...@gmail.com>wrote:

> Greetings, all:
>
> Has anyone managed to get Hibernate + Spring to work with JDBC
> (PostgreSQL) or otherwise inside of ServiceMix 4 / OSGi? Currently, I
> have a web application whose guts (just the model + business services) I
> need for my SMX 4 based application. The full-fledged web application is
> currently deployed on Tomcat 5.5.27. I'm wondering how one configures
> the bundle (or beans) in a similar fashion to Tomcat's context.xml.
>
> Has anyone on this list done something like this? Any pointers?
>
> Thanks,
> Scott
>