You DO need to import that package "javax.sql" (the rule is that you import ALL 
packages you use except java.*, e.g. you don't import java.lang, java.io, 
java.util etc). 

This specific package will be exported by the System Bundle, i.e. the OSGi 
framework itself. The same is true for all the javax.* packages that are 
normally offered by the JRE.

Regards,
Neil


On Wednesday, 21 March 2012 at 10:02, elMateo wrote:

> I'm working with the code of Neil and I have a problem: Felix show a
> java.lang.ClassNotFoundException: javax.sql.DataSource not found
> 
> I import the javax.sql package in my manifest file but I don't know if I
> need a bundle with this package in my Apache Felix. If I need a bundle with
> this, what is this bundle? I don't find a bundle called javax.sql and I
> have imported the MySQL connector/J bundle too.
> 
> On Tue, Mar 20, 2012 at 1:13 PM, Christian Schneider <
> [email protected] (mailto:[email protected])> wrote:
> 
> > Absolutely. That is what I wanted to say in my last post. The only problem
> > with this aproach is that you hardcode the database type in your bridge
> > bundle.
> > ( At least if you dont want to mess with the classloader).
> > 
> > As you probably will not have that many database types in one use case
> > this is probably ok though.
> > 
> > Christian
> > 
> > 
> > Am 20.03.2012 11:27, schrieb Neil Bartlett:
> > 
> > You certainly don't need Glassfish... you don't need Karaf or Blueprint
> > > either.
> > > 
> > > There is a tendency on many mailing lists to respond to beginner
> > > questions with answers like "you can do this with product X" where X
> > > happens to be the product that the person is working on or selling. Those
> > > products may indeed add value but they are rarely the only or the simplest
> > > way to achieve what you want!
> > > 
> > > To register a DataSource service with pure OSGi, it's as simple as
> > > writing this code in a BundleActivator (using MySQL as an example):
> > > 
> > > DataSource ds = new com.mysql.jdbc.jdbc2.optional.**MysqlDataSource();
> > > context.registerService(**DataSource.class.getName(), ds, null);
> > > 
> > > This would be your "bridge" bundle that you deploy alongside the MySQL
> > > driver JAR. For other database types, write a different 2 lines of code 
> > > and
> > > deploy that bundle instead.
> > > 
> > > Kind regards,
> > > Neil
> > > 
> > 
> > --
> > Christian Schneider
> > http://www.liquid-reality.de
> > 
> > Open Source Architect
> > Talend Application Integration Division http://www.talend.com
> > 
> > 
> > ------------------------------**------------------------------**---------
> > To unsubscribe, e-mail: 
> > users-unsubscribe@felix.**apache.org<[email protected] 
> > (mailto:[email protected])>
> > For additional commands, e-mail: [email protected] 
> > (mailto:[email protected])
> > 
> 
> 
> 


Reply via email to