Я разрабатываю клиентское приложение http в качестве проекта пакета OSGI, я использовал apache maven для создания структуры папок проекта, используемой под командой.Пакет OSGI не запускается в Apache Servicemix
mvn archetype:generate -DarchetypeGroupId=org.apache.karaf.archetypes -DarchetypeArtifactId=karaf-blueprint-archetype -DarchetypeVersion=2.3.7 -DgroupId=com.techiyhub -DartifactId=integration.sms -Dversion=1.0-SNAPSHOT -Dpackage=com.techiyhub.integration.sms
Указанная выше команда создала структуру папок проекта, так как я использую приложение на основе httpclient. Я добавил зависимости в pom.xml, как показано ниже.
<?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>com.techiyhub</groupId>
<artifactId>integration.sms</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>integration.sms Blueprint Bundle</name>
<description>integration.sms OSGi blueprint bundle project.</description>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.4.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Version>${project.version}</Bundle-Version>
<Export-Package>
com.techiyhub.integration.sms*;version=${project.version}
</Export-Package>
<Import-Package>
*
</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.3.2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.5</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.6</version>
</dependency>
</dependencies>
я выполнил ниже команды,
МВН установить
он создал нужный банку файл в локальном хранилище Maven.
Проблема началась здесь. я попытался развернуть сверток в Apache ServiceMix он установлен пучок, но при запуске расслоение это дало ошибку
я выполнил ниже команд в оболочке ServiceMix
OSGi: установить MVN: com.techiyhub/integration.sms /1.0-SNAPSHOT
он получил установленный с расслоением ID, то я выполняется под командой
OSGi: старт 302
он дал ниже ошибки
Ошибка выполнения команды: Ошибка при запуске жгуты: Невозможно запустить пакет 302: неразрешенное ограничение в пачке integration.sms [302]: Невозможно решить 302,0: пропустить ИНГИ требования [302,0] osgi.wiring.package; (Osgi.wiring.package = org.apache.http)
Полный след стека ошибки, как показано ниже
2015-10-26 14:33:12,551 | ERROR | l Console Thread | Console | 22 - org.apache.karaf.shell.cons
ole - 2.4.3 | Exception caught while executing command
org.apache.karaf.shell.console.MultiException: Error starting bundles:
Unable to start bundle 302: Unresolved constraint in bundle integration.sms [302]: Unable to resolve 302.0: miss
ing requirement [302.0] osgi.wiring.package; (osgi.wiring.package=org.apache.http)
at org.apache.karaf.shell.console.MultiException.throwIf(MultiException.java:91)
at org.apache.karaf.shell.osgi.StartBundle.doExecute(StartBundle.java:43)
at org.apache.karaf.shell.osgi.BundlesCommand.doExecute(BundlesCommand.java:37)
at org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:38)
at org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:35)
at sun.reflect.GeneratedMethodAccessor28.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_80]
at java.lang.reflect.Method.invoke(Method.java:606)[:1.7.0_80]
at org.apache.aries.proxy.impl.ProxyHandler$1.invoke(ProxyHandler.java:54)[16:org.apache.aries.proxy.impl:1.0.4]
at org.apache.aries.proxy.impl.ProxyHandler.invoke(ProxyHandler.java:119)[16:org.apache.aries.proxy.impl:1.0.4]
at org.apache.karaf.shell.console.commands.$BlueprintCommand22803378.execute(Unknown Source)[22:org.apache.karaf
.shell.console:2.4.3]
at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78)[22:org.apache.karaf.shell.console:2.
4.3]
at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:477)[22:org.apache.karaf.shell.console:2.4.3]
at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:403)[22:org.apache.karaf.shell.console:2.
4.3]
at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[22:org.apache.karaf.shell.console:2.4.3]
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)[22:org.apache.karaf.shell.console:2.4.3]
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)[22:org.apache.karaf.shell.console:2.4.3]
at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:92)[22:org.apache.karaf.shel
l.console:2.4.3]
at org.apache.karaf.shell.console.jline.Console.run(Console.java:195)[22:org.apache.karaf.shell.console:2.4.3]
at org.apache.karaf.shell.console.jline.DelayedStarted.run(DelayedStarted.java:79)[22:org.apache.karaf.shell.con
sole:2.4.3]
Caused by: java.lang.Exception: Unable to start bundle 302: Unresolved constraint in bundle integration.sms [302]: Unabl
e to resolve 302.0: missing requirement [302.0] osgi.wiring.package; (osgi.wiring.package=org.apache.http)
at org.apache.karaf.shell.osgi.StartBundle.doExecute(StartBundle.java:39)
... 18 more
Caused by: org.osgi.framework.BundleException: Unresolved constraint in bundle integration.sms [302]: Unable to resolve
302.0: missing requirement [302.0] osgi.wiring.package; (osgi.wiring.package=org.apache.http)
at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4002)
at org.apache.felix.framework.Felix.startBundle(Felix.java:2045)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:976)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:963)
at org.apache.karaf.shell.osgi.StartBundle.doExecute(StartBundle.java:37)
... 18 more
Caused by: org.osgi.framework.BundleException: Unresolved constraint in bundle : Unable to resolve: missing requirement [302.0] osgi.wiring.package;(osgi.wiring.package=org.apache.http)
Пожалуйста, помогите мне в этом.
Спасибо @Christain Шнайдера для решения с подробным объяснением, это помогло мне узнать. Проблема решена с вашим решением. Мне любопытно узнать о поиске правильных библиотек, которые вы сказали: «Сообщение об ошибке поможет вам найти правильные пакеты для установки», где упоминается в сообщении об ошибке. – sandeep
OSGi сообщает вам, в каком пакете отсутствует диапазон версии. К сожалению, вам нужно найти подходящий комплект по своему усмотрению. Во многих случаях исходные проекты уже выпускают пучки, как в случае выше. В других случаях может помочь подпроект пакетов servicemix. Обычно я ищу по центру maven, используя имя пакета. –
Спасибо @Christian Schneider – sandeep