2014-04-26 37 views
2

我试图将包导入由另一个包导出的Karaf运行时内的(.kar)包。当我在.kar文件的一个bean中引用这个包时,我得到一个错误。 我有一个包被导出包即“com.sample”Karaf包导入错误

当我运行包:出口,我可以看到在列表中被导出的包,但是当我从我的.KAR文件我引用它出现以下错误:

The import com.sample cannot be resolved 

at beans.testBean.<init>(testBean.java:5) 
at bios.testdabean_0_1.testdabean$1.getCamelContextMap(testdabean.java:146) 
at org.apache.camel.main.MainSupport.postProcessContext(MainSupport.java:386) 
at bios.testdabean_0_1.testdabean$1.doStart(testdabean.java:161) 
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) 
at org.apache.camel.main.MainSupport.run(MainSupport.java:148) 
at bios.testdabean_0_1.testdabean.run(testdabean.java:194) 
at bios.testdabean_0_1.testdabean.runJobInTOS(testdabean.java:290) 
at org.talend.esb.job.controller.internal.RouteAdapter.run(RouteAdapter.java:78)[189:org.talen 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_51] 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_51] 

我的清单外观如下

​​

任何帮助将不胜感激!谢谢

回答

0

我找到了解决方案,如果任何人有兴趣。

我所要做的只是编辑路径清单文件以导入在OSGi容器中导出的包。 之后,我不得不通过Studio中的Spring DM编辑器引用该服务。

我改变了命名空间,如下所示。

<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:camel="http://camel.apache.org/schema/spring" 
    xmlns:context="http://www.springframework.org/schema/context" 
    xmlns:osgi="http://www.springframework.org/schema/osgi" 
    xsi:schemaLocation=" 
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/bean/spring- beans.xsd 
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd 
    http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd 
    http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd"> 

后,我可以通过标签

<osgi:reference id="myUDPService" interface="com.myosgi.UDPService"/> 

引用服务。一旦我做了这个,我只是下降了cBean,并通过ID引用豆“myUDPService”,选择的方法和已经开始了!