Peter,

You can't use @Reosurce in your service object unless it Java EE component. So, you have to explicitly look up the DataSource either via JNDI or using the corresponding DataSource service. Checkout the example at [1]

Sahoo

[1] http://java.net/projects/glassfish/sources/svn/content/trunk/fighterfish/sample/osgijdbc/helloworld/src/main/java/org/glassfish/fighterfish/sample/helloworld/osgijdbc/JDBCSampleActivator.java?rev=52391

/nb: This forum is about use of Felix components. Pl. don't ask GlassFish questions here./


On Wednesday 01 February 2012 11:41 PM, rcbandit2 wrote:
I'm working on a OSGI bundle which uses @Datasource from Glassfish server.
The problem is that I can compile the code with Netbeans but when I try to
run the code I get errors in Glassfish. Is there any example which shows how
OSGI bundle can make SQL queries form database?

Best Wishes
Peter

Reply via email to