我有一个使用OSGi-(felix)、SpringDM、hibernate和maven的项目。当我安装捆绑包时,它是正常的,当我运行捆绑包id时的输出是:
LastModified 1384619994484
Headers [Manifest-Version=1.0, Bundle-Vendor=NguyenVinhLinh, Bnd-LastModified=1384619954778, Tool=Bnd-2.1.0.20130426-122213, Bundle-Name=DrugManager, Built-By=nguyenvinhlinh, Import-Package=org.hibernate,org.hibernate.classic,org.hibernate.criterion,org.springframework.beans.factory;version="[2.5,3)",org.springframework.core.io;version="[2.5,3)",org.springframework.transaction.annotation;version="[2.5,3)", Bundle-SymbolicName=DrugManagerDAO, Export-Package=drug,drugGroup,model;version="1.0.0", Bundle-Version=1.0.0, Build-Jdk=1.7.0_45, Created-By=Apache Maven Bundle Plugin, Bundle-ManifestVersion=2]
BundleContext null
Revisions [169.0]
BundleId 169
SymbolicName DrugManagerDAO
RegisteredServices null
ServicesInUse null
Version 1.0.0
Location file:/home/nguyenvinhlinh/Projects/felix-framework-4.2.1/bundle/DrugManager-1.0.jar
State 2
Bundle 169|Installed | 1|DrugManagerDAO (1.0.0)
这是我在启动此捆绑包时看到的:
org.osgi.framework.BundleException: Unresolved constraint in bundle DrugManagerDAO [169]: Unable to resolve 169.0: missing requirement [169.0] osgi.wiring.package; (osgi.wiring.package=org.hibernate)
这是我的beans.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:osgi="http://www.springframework.org/schema/osgi"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/osgi
">
<tx:annotation-driven transaction-manager="transactionManager"/>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="mappingDirectoryLocations" ref="mappingProvider"/>
<property name="hibernateProperties" ref="propertiesProvider"/>
</bean>
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/WOLOLO"/>
<property name="username" value="root"/>
<property name="password" value="123456"/>
</bean>
<bean id="mappingProvider" class="hibernate.config.HibernateMappingProvider"/>
<bean id="propertiesProvider" class="hibernate.config.HibernatePropertiesProvider"/>
<bean id="drugDao" class="drug.HibernateDrugDao">
<property name="clazz" value="model.Drug"/>
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="drugGroupDao" class="drugGroup.HibernateDrugGroupDao">
<property name="clazz" value="model.DrugGroup"/>
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<osgi:service ref="drugDao" interface="drug.DrugDao"/>
<osgi:service ref="drugGroupDao" interface="drugGroup.DrugGroupDao"/>
</beans>
这是我的pom文件:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>DrugManager</groupId>
<artifactId>DrugManager</artifactId>
<version>1.0</version>
<packaging>bundle</packaging>
<dependencies>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>4.3.0</version>
</dependency>
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>1.8.0.10</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>2.5.6</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>20030825.184428</version>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
<version>20030825.183949</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.2.6.ga</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.27</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.4.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>DrugManagerDAO</Bundle-SymbolicName>
<Bundle-Vendor>NguyenVinhLinh</Bundle-Vendor>
<Export-Package>"drug,drugGroup,model"</Export-Package>
<Import-Package>org.hibernate</Import-Package> <!-- this line I try to insert into to fix requirement, but it does'nt work-->
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>java.net</id>
<url>http://download.java.net/maven/2/</url>
</repository>
</repositories>
</project>
此外,在felix中存在一个完整的捆绑错误。
g! ERROR: Bundle DrugManagerDAO [190] Error starting file:DrugManager-1.0.jar (org.osgi.framework.BundleException: Unresolved constraint in bundle DrugManagerDAO [190]: Unable to resolve 190.0: missing requirement [190.0] osgi.wiring.package; (osgi.wiring.package=org.hibernate))
org.osgi.framework.BundleException: Unresolved constraint in bundle DrugManagerDAO [190]: Unable to resolve 190.0: missing requirement [190.0] osgi.wiring.package; (osgi.wiring.package=org.hibernate)
at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3974)
at org.apache.felix.framework.Felix.startBundle(Felix.java:2037)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1291)
at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:304)
at java.lang.Thread.run(Thread.java:744)
对于缺少的需求[Bundle-number]osgi.wiring.package,我将其作为导出包添加到pom.xml中,如下所述:
<Export-Package>
package for which error is thrown
</Export-Package>
而且成功了。因此,如果它在声明为依赖关系后抛出上述错误,export-package可能会有所帮助
您是否也在容器(Felix)中安装了此捆绑包?
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.2.6.ga</version>
</dependency>
如果没有,安装它,然后看看当你启动你的包时会发生什么。
在完成教程后,我有一个带有OSGi的Web应用程序客户端捆绑包(WAB),我想使用quartz调度程序中的软件包来完成特定任务。我也使用Maven,我把以下依赖项: org.quartz-scheduler quartz 2.2.1 编译 org.quartz-scheduler quartz-jobs 2.2.1 编译 我已经在Maven存储库中进行了检查,似乎一切都很好,石英罐中的包/罐子在M
提前感谢。我有问题启动一个osgi捆绑包,它给出了这个错误消息:包/捆绑包将不安装。它编译,并构建好,当部署到Karaf时,它不会加载和抱怨丢失的布线包,看起来像是正在导出和导入。但是缺少一个版本id。 执行命令时出错:无法启动bundle mvn:com。通用电气。数字的passthru/passthrumt1。dataserviceimpl/1.0.1-SNAPSHOT在功能部件passthr
我是Apache karaf和OSGI的新手。我正在尝试编写和运行一个非常简单的捆绑包。但是我在启动该捆绑包时遇到了这个错误: 执行命令时出错:在捆绑包上执行命令时出错:无法解析karaf[86](R 86.0):缺少需求[karaf[86](R 86.0)]osgi。装电线。包裹(osgi.wiring.package=bundle)未解决的需求:[[karaf[86](R 86.0)]osgi
我试图用bndool编写一个OSGI REST包。 我在cnf项目中添加了我需要的所有罐。然后我把它们添加到捆绑包构建路径中。 我得到以下运行时异常 OSGi捆绑包未启动:缺少需求osgi.wiring.package( 我不明白这个错误,因为我使用了javax.ws.rs-api 2.0.1。 我试图在构建路径中明确指定版本,如下所示 没有任何运气。 我用错罐子了吗? 非常感谢。 这是我的bnd
提前感谢您的帮助!我正在学习一个教程,当我尝试启动我在karaf中安装的捆绑包时,它不会启动...日志是: 20:12:18.713 错误 [Karaf 本地控制台用户 karaf] 执行命令 org.apache.karaf.shell.support.MultiException 时捕获异常:在捆绑包上执行命令时出错:启动捆绑包 157 时出错:无法解析 db-examplejpa [157]
我正在尝试在fuse服务器上部署一个捆绑包,但对其进行了一些更改。我添加了unirest依赖项来执行REST调用。 该版本在本地计算机和 Jenkins 上工作正常,但捆绑包会引发错误,并且无法在 fuse 服务器上部署。 它抛出以下错误: 以下是我的pom.xml: