是否可以致電@Datasource
瞭解OSGI捆綁包?我在Glassfish 3.1.1服務器中配置了連接池。我可以從簡單的JSF應用程序進行查詢。 這是束的源代碼: http://www.2shared.com/file/H8kNkMrI/SH_27.html如何在OSGI包中調用datasource?
這是我想寫的源代碼:
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;
}
}
當我試着使用Netbeans的編譯代碼時出現此錯誤:
[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]
你知道我錯過了什麼嗎?
更新:捆綁插件是無法看到javax.annotation中的javax.activation和類,而試圖計算我的包的OSGi的表現,並決定在療法罐子打包的內容。我必須修復pom.xml。 這是OSGI包的源代碼。
我該如何修復POM文件?
更新2:這是Netbeans的完整的錯誤堆棧:
這是POM文件:
你願意幫我修復POM文件?
只是一個理智檢查:你確定它應該是一個'javax.activation.DataSource' ?.該評論意味着它應該是'javax.sql.DataSource'。 –