是否可以调用@Datasource
insight OSGI捆绑包?我在Glassfish 3.1.1服务器中配置了连接池。我可以从简单的JSF应用程序中进行查询。这是捆绑包的源代码:http://www.2shared.com/file/H8kNkMrI/SH_27.html
这是我试图写的源代码:
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]
你知道我缺了什么吗?
更新:Bundle插件在尝试计算我的Bundle的OSGi清单并决定在jar中打包什么时,无法看到javax.annotation和javax.activation类。我必须修复pom.xml。这是OSGI捆绑包的源代码。
我必须如何修复POM文件?
更新2:这是来自Netbeans的完整错误堆栈:
http://pastebin.com/R2hnRHVW
这是POM文件:
http://pastebin.com/Tc1gJiwU
你能帮我修一下POM文件吗?
不确定如何运行框架,对于felix来说,如果在bootdelegation包中指定javax.activation(以及您需要的其他包),可能会有所帮助;在framework.properties.中使用org.osgi.framework.boot委派