Я конвертирую проект Java в Kotlin, который развертывается как пакет OSGi.Я включил зависимости kotlin-osgi-bundle
и kotlin-stdlib-jdk8
:
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-osgi-bundle</artifactId>
<version>1.3.11</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>1.3.11</version>
</dependency>
</dependencies>
Я также включил kotlin-maven-plugin
, и я могу успешно упаковать проект.
Однакопри развертывании я получаю следующую ошибку:
Error while starting bundle: file:/D:/Esri/ArcGIS/Server/GeoEvent/deploy/test-0.0.1.jar
org.osgi.framework.BundleException: Unresolved constraint in bundle com.sample.test [464]: Unable to resolve 464.0: missing requirement [464.0] osgi.wiring.package; (&(osgi.wiring.package=kotlin)(version>=1.3.0)(!(version>=2.0.0)))
at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3974)[org.apache.felix.framework-4.2.1.jar:]
at org.apache.felix.framework.Felix.startBundle(Felix.java:2037)[org.apache.felix.framework-4.2.1.jar:]
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:955)[org.apache.felix.framework-4.2.1.jar:]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1245)[16:org.apache.felix.fileinstall:3.4.2]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1217)[16:org.apache.felix.fileinstall:3.4.2]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:509)[16:org.apache.felix.fileinstall:3.4.2]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:358)[16:org.apache.felix.fileinstall:3.4.2]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:310)[16:org.apache.felix.fileinstall:3.4.2]
Я попытался указать зависимость Kotlin в maven-bundle-plugin
:
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Embed-Dependency>kotlin-osgi-bundle</Embed-Dependency>
</instructions>
</configuration>
</plugin>
. Это генерирует довольно большой JAR (4 МБ)по сравнению с исходным проектом Java (35 КБ), и при развертывании я получаю следующую ошибку:
INFO | curator-framework - 3.1.0 | New config event received: [115, 101, 114, 118, 101, 114, 46, 49, 61, 76, 69, 65, 45, 51, 48, 53, 48, 57, 51, 46, 83, 69, 82, 86, 73, 67, 69, 83, 46, 69, 83, 82, 73, 65, 85, 83, 84, 82, 65, 76, 73, 65, 46, 67, 79, 77, 46, 65, 85, 58, 50, 49, 56, 50, 58, 50, 49, 57, 48, 58, 112, 97, 114, 116, 105, 99, 105, 112, 97, 110, 116, 59, 48, 46, 48, 46, 48, 46, 48, 58, 50, 49, 56, 49, 10, 118, 101, 114, 115, 105, 111, 110, 61, 49, 48, 48, 48, 48, 48, 48, 48, 48]
INFO | curator-client - 3.1.0 | Connection string changed to: LAPTOP-3050:2181
INFO | curator-framework - 3.1.0 | State change: SUSPENDED
INFO | curator-client - 3.1.0 | Connection string changed to: LAPTOP-3050:2181
INFO | curator-client - 3.1.0 | Connection string changed to: LAPTOP-3050:2181
INFO | curator-client - 3.1.0 | Connection string changed to: LAPTOP-3050:2181
INFO | curator-client - 3.1.0 | Connection string changed to: LAPTOP-3050:2181
INFO | curator-client - 3.1.0 | Connection string changed to: LAPTOP-3050:2181
INFO | curator-framework - 3.1.0 | State change: RECONNECTED
INFO | curator-client - 3.1.0 | Connection string changed to: LAPTOP-3050:2181
INFO | curator-client - 3.1.0 | Connection string changed to: LAPTOP-3050:2181
INFO | curator-client - 3.1.0 | Connection string changed to: LAPTOP-3050:2181
INFO | curator-client - 3.1.0 | Connection string changed to: LAPTOP-3050:2181
INFO | curator-client - 3.1.0 | Connection string changed to: LAPTOP-3050:2181
INFO | curator-client - 3.1.0 | Connection string changed to: LAPTOP-3050:2181
INFO | curator-framework - 3.1.0 | New config event received: [115, 101, 114, 118, 101, 114, 46, 49, 61, 76, 69, 65, 45, 51, 48, 53, 48, 57, 51, 46, 83, 69, 82, 86, 73, 67, 69, 83, 46, 69, 83, 82, 73, 65, 85, 83, 84, 82, 65, 76, 73, 65, 46, 67, 79, 77, 46, 65, 85, 58, 50, 49, 56, 50, 58, 50, 49, 57, 48, 58, 112, 97, 114, 116, 105, 99, 105, 112, 97, 110, 116, 59, 48, 46, 48, 46, 48, 46, 48, 58, 50, 49, 56, 49, 10, 118, 101, 114, 115, 105, 111, 110, 61, 49, 48, 48, 48, 48, 48, 48, 48, 48]
INFO | curator-client - 3.1.0 | Connection string changed to: LAPTOP-3050:2181
ERROR | com.esri.ges.persistence.zookeeper.zk-persistenceutility - 10.5.1 | KeeperErrorCode = ConnectionLoss for /geoevent/config/clusters/default/deploy/test-0.0.1.jar
org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /geoevent/config/clusters/default/deploy/test-0.0.1.jar
at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)[23:org.apache.zookeeper.zookeeper-geoevent:3.5.0]
at org.apache.zookeeper.KeeperException.create(KeeperException.java:51)[23:org.apache.zookeeper.zookeeper-geoevent:3.5.0]
at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:1155)[23:org.apache.zookeeper.zookeeper-geoevent:3.5.0]
at org.apache.curator.framework.imps.CreateBuilderImpl$17.call(CreateBuilderImpl.java:1040)[386:curator-framework:3.1.0]
at org.apache.curator.framework.imps.CreateBuilderImpl$17.call(CreateBuilderImpl.java:1023)[386:curator-framework:3.1.0]
at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:67)[387:curator-client:3.1.0]
at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:99)[387:curator-client:3.1.0]
at org.apache.curator.framework.imps.CreateBuilderImpl.pathInForeground(CreateBuilderImpl.java:1020)[386:curator-framework:3.1.0]
at org.apache.curator.framework.imps.CreateBuilderImpl.protectedPathInForeground(CreateBuilderImpl.java:501)[386:curator-framework:3.1.0]
at org.apache.curator.framework.imps.CreateBuilderImpl.forPath(CreateBuilderImpl.java:491)[386:curator-framework:3.1.0]
at org.apache.curator.framework.imps.CreateBuilderImpl$4.forPath(CreateBuilderImpl.java:367)[386:curator-framework:3.1.0]
at org.apache.curator.framework.imps.CreateBuilderImpl$4.forPath(CreateBuilderImpl.java:309)[386:curator-framework:3.1.0]
at com.esri.ges.fabric.internal.ZKPersistenceUtility.copyInputStreamToPath(ZKPersistenceUtility.java:338)[77:com.esri.ges.persistence.zookeeper.zk-persistenceutility:10.5.1]
at Proxy73615e00_3b42_4973_8167_02adcb1d58c6.copyInputStreamToPath(Unknown Source)[:]
at Proxyca093291_fc2b_46b8_8c21_c244986150ba.copyInputStreamToPath(Unknown Source)[:]
at com.esri.ges.registry.deploy.internal.DeployFolderRegistryImpl.copyIntoZooKeeper(DeployFolderRegistryImpl.java:73)[169:com.esri.ges.registry.internal-deploy-registry:10.5.1]
at com.esri.ges.registry.deploy.internal.DeployFolderRegistryImpl.access$500(DeployFolderRegistryImpl.java:37)[169:com.esri.ges.registry.internal-deploy-registry:10.5.1]
at com.esri.ges.registry.deploy.internal.DeployFolderRegistryImpl$LookForChanges.run(DeployFolderRegistryImpl.java:141)[169:com.esri.ges.registry.internal-deploy-registry:10.5.1]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_121]
Это повторяется несколько раз.
Я что-то упустил или это происходитпросто означает, что приложение (Esri ArcGIS GeoEvent) не поддерживает пакеты OSGi, написанные на Kotlin?