users@glassfish.java.net

How to call datasource in OSGI bundle?

From: <forums_at_java.net>
Date: Mon, 23 Jan 2012 08:12:34 -0600 (CST)

Is it possible to call @Datasource insight OSGI bundle? I configured
Connection pool in the Glassfish 3.1.1 Server. I can make queries from simple
JSF application. This is the source code of the bundles:
http://www.2shared.com/file/H8kNkMrI/SH_27.html [1]

This is the source code that I'm trying to write:

package org.DX_57.osgi.SH_27.impl;
import javax.activation.DataSource;
import javax.annotation.Resource;
import org.DX_57.osgi.SH_27.api.SessionHandle;
public class SessionHandleImpl implements SessionHandle {
        public String error_Message = null;
        public String error_Database = null;
        /** Call the Oracle JDBC Connection driver */
        @Resource(name="jdbc/Oracle")
        public DataSource ds;
    public String sayHello(String name) {
        return "Howdy " + name;
    }                      
}
When I try to compile the code with Netbeans this error appears:

[bundle:bundle]
Bundle org.DX_57.osgi.SH_27:SH_27-impl:bundle:1.0-SNAPSHOT : Unresolved
references to [javax.activation, javax.annotation] by class(es) on the
Bundle-Classpath[Jar:dot]:
[org/DX_57/osgi/SH_27/impl/SessionHandleImpl.class]
Error(s) found in bundle configuration
------------------------------------------------------------------------
Reactor Summary:
SH_27 ............................................. SUCCESS [0.639s]
SH_27-api ......................................... SUCCESS [5.162s]
SH_27-impl ........................................ FAILURE [1.930s]
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 8.950s
Finished at: Mon Jan 23 15:59:42 EET 2012
Final Memory: 18M/47M
------------------------------------------------------------------------
Failed to execute goal org.apache.felix:maven-bundle-plugin:2.3.6:bundle
(default-bundle) on project SH_27-impl: Error(s) found in bundle
configuration -> [Help 1]
Do you have any idea what I'm missing?

Bets wishes

 


[1] http://www.2shared.com/file/H8kNkMrI/SH_27.html

--
[Message sent by forum member 'rcbandit']
View Post: http://forums.java.net/node/882924