I am working on a Java EE 7 WebApplication (running in wildfly 10) using an embedded Elasticsearch.
After upgrading to elasticsearch 2.1.1 searching is not working anymore. (indexing seems to work)
Dependencies that worked:
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
<version>5.2.1</version>
</dependency>
Upgraded dependencies:
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
<version>5.3.1</version>
</dependency>
After indexing a very basic document (indexing seems to work), searching fails with the following exception:
org.elasticsearch.action.search.SearchPhaseExecutionException : all shards failed [Proxied because : Original exception caused: class java.io.NotSerializableException: org.elasticsearch.action.search.ShardSearchFailure]
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.onFirstPhaseResult(TransportSearchTypeAction.java:228)
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$1.onFailure(TransportSearchTypeAction.java:174)
at org.elasticsearch.action.ActionListenerResponseHandler.handleException(ActionListenerResponseHandler.java:46)
at org.elasticsearch.transport.local.LocalTransport.handleException(LocalTransport.java:354)
at org.elasticsearch.transport.local.LocalTransport.handlerResponseError(LocalTransport.java:345)
at org.elasticsearch.transport.local.LocalTransport.messageReceived(LocalTransport.java:241)
at org.elasticsearch.transport.local.LocalTransportChannel$2.run(LocalTransportChannel.java:99)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.elasticsearch.common.io.stream.NotSerializableExceptionWrapper: _byteSymbolCanonicalizer
at com.fasterxml.jackson.dataformat.smile.SmileFactory._createParser(SmileFactory.java:404)
at com.fasterxml.jackson.dataformat.smile.SmileFactory.createParser(SmileFactory.java:327)
at org.elasticsearch.common.xcontent.smile.SmileXContent.createParser(SmileXContent.java:107)
at org.elasticsearch.common.xcontent.smile.SmileXContent.createParser(SmileXContent.java:113)
at org.elasticsearch.search.SearchService.parseSource(SearchService.java:817)
at org.elasticsearch.search.SearchService.createContext(SearchService.java:651)
at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:617)
at org.elasticsearch.search.SearchService.executeDfsPhase(SearchService.java:262)
at org.elasticsearch.search.action.SearchServiceTransportAction$SearchDfsTransportHandler.messageReceived(SearchServiceTransportAction.java:360)
at org.elasticsearch.search.action.SearchServiceTransportAction$SearchDfsTransportHandler.messageReceived(SearchServiceTransportAction.java:357)
at org.elasticsearch.transport.local.LocalTransport$2.doRun(LocalTransport.java:280)
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
This is how my search looks like:
QueryStringQueryBuilder qb = QueryBuilders.queryStringQuery(queryString);
SearchResponse searchResponse = this.client.prepareSearch(INDEX_NAME)
.setTypes(typeName)
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
.setQuery(qb)
.setFrom(offset)
.setSize(limit)
.execute()
.actionGet();
I got around that problem by shading elasticsearch dependencies
1. I created a separate maven-module:
<project>
...
<dependencies>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>2.3.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<relocations>
<relocation>
<pattern>com.fasterxml.jackson</pattern>
<shadedPattern>shaded.elasticsearch.jackson</shadedPattern>
</relocation>
</relocations>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer" />
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
...
</project>
2. And then used that module as a dependency in my main project
<dependency>
<groupId>drivve</groupId>
<artifactId>elasticsearch-shaded</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
<version>5.5.0</version><!-- be sure to match the version required by elasticsearch-shaded -->
</dependency>
Everything works fine now and is not that hard to managed.
More info on shading es dependencies can be found here.
Related
I have an openapi file generated through restdocs and converted into this format. They are added to the resources folder, and the properties file is pointing to their format, however, swagger is failing to load and I'm not sure what else I could be missing.
<dependency>
<groupId>org.springframework.restdocs</groupId>
<artifactId>spring-restdocs-mockmvc</artifactId>
<version>${spring-restdocs-mockmvc.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>${springdoc-openapi-ui.version}</version>
</dependency>
<dependency>
<groupId>capital.scalable</groupId>
<artifactId>spring-auto-restdocs-core</artifactId>
<version>${spring-auto-restdocs-core.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.epages</groupId>
<artifactId>restdocs-api-spec</artifactId>
<version>${restdocs-api-spec.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.epages</groupId>
<artifactId>restdocs-api-spec-mockmvc</artifactId>
<version>${restdocs-api-spec.version}</version>
<scope>test</scope>
</dependency>
<plugin>
<groupId>io.github.berkleytechnologyservices</groupId>
<artifactId>restdocs-spec-maven-plugin</artifactId>
<version>${restdocs-spec.version}</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<!--suppress MavenModelInspection -->
<skip>${skipTests}</skip>
<host>localhost:8081</host>
<specification>OPENAPI_V3</specification>
<outputDirectory>${project.build.directory}/classes/static/docs</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
Thank you very much.
A related question was posted here and this answer solved the issue: https://stackoverflow.com/a/75273492/6654475
In summary, it was related to this line that needed to be removed spring.web.resources.add-mappings=false and the yml file that needed to be moved to the resources/static/ folder.
I am trying out a spark application in java which needs to connect to Azure Key-vault and fetch some secrets and process data after reading from a blob storage and push to a SQL Server table. Here is my pom:
<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.my.package</groupId>
<artifactId>hdinsightSample</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>hdinsightSample</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.12</artifactId>
<version>2.4.7</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.12</artifactId>
<version>2.4.7</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-azure</artifactId>
<version>2.10.1</version>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.2.2.jre8</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-keyvault</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure</artifactId>
<version>1.3.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.my.package.hdinsightSample.App</mainClass>
</transformer>
</transformers>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/maven/**</exclude>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<relocations>
<relocation>
<pattern>com.google.common</pattern>
<shadedPattern>repackaged.com.google.common</shadedPattern>
<includes>
<include>com.google.guava:*</include>
</includes>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
After running the jar file or running the code from Eclipse I get the following exception:
Exception in thread "main" java.lang.NoClassDefFoundError: com.google.common.reflect.TypeToken
at java.lang.ClassLoader.defineClassImpl(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:379)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:682)
at java.net.URLClassLoader.access$400(URLClassLoader.java:89)
at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java:1086)
at java.security.AccessController.doPrivileged(AccessController.java:739)
at java.net.URLClassLoader.findClass(URLClassLoader.java:589)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:934)
at java.lang.ClassLoader.loadClass(ClassLoader.java:879)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:862)
at com.microsoft.azure.keyvault.KeyVaultClientImpl.getSecretDelegate(KeyVaultClientImpl.java:2938)
at com.microsoft.azure.keyvault.KeyVaultClientImpl.access$1800(KeyVaultClientImpl.java:92)
at com.microsoft.azure.keyvault.KeyVaultClientImpl$82.call(KeyVaultClientImpl.java:2928)
at com.microsoft.azure.keyvault.KeyVaultClientImpl$82.call(KeyVaultClientImpl.java:2924)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:69)
at retrofit2.adapter.rxjava.CallArbiter.deliverResponse(CallArbiter.java:120)
at retrofit2.adapter.rxjava.CallArbiter.emitResponse(CallArbiter.java:102)
at retrofit2.adapter.rxjava.CallExecuteOnSubscribe.call(CallExecuteOnSubscribe.java:46)
at retrofit2.adapter.rxjava.CallExecuteOnSubscribe.call(CallExecuteOnSubscribe.java:24)
at rx.Observable.unsafeSubscribe(Observable.java:10142)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
at rx.Observable.subscribe(Observable.java:10238)
at rx.Observable.subscribe(Observable.java:10205)
at rx.observables.BlockingObservable.blockForSingle(BlockingObservable.java:444)
at rx.observables.BlockingObservable.single(BlockingObservable.java:341)
at com.microsoft.azure.keyvault.KeyVaultClientImpl.getSecret(KeyVaultClientImpl.java:2868)
at com.microsoft.azure.keyvault.KeyVaultClient.getSecret(KeyVaultClient.java:862)
at com.my.package.hdsinsightSample.utils.KeyVaultUtils.getSecret(KeyVaultUtils.java:12)
at com.my.package.hdinsightSample.App.main(App.java:23)
Caused by: java.lang.ClassNotFoundException: com.google.common.reflect.TypeToken
at java.net.URLClassLoader.findClass(URLClassLoader.java:591)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:934)
at java.lang.ClassLoader.loadClass(ClassLoader.java:879)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:862)
... 36 more
This is because to fetch the secret from key vault it uses guava jar but guava jar complied by default is 11.0.2 (present in spark-core dependecny) whereas the correct version it should be using is 20 (present in the Azure Key-Vault dependency). I tried shading the jar as shown in the pom above but the issue remains the same.
Kindly help.
I created a small project with the same dependencies and the dependency tree shows the Guava dependency actually comes from org.apache.hadoop:hadoop-azure:jar:2.10.1. Regardless of that, the simplest way to get rid of this problem is to explicitly state which Guava version you want your project to use in your POM (ideally the same as the one in Key Vault in this case):
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>20.0</version>
</dependency>
Additionally, there is a new set of libraries for Azure Key Vault with improved APIs and additional functionality, which also do not rely on Guava, so that is an alternative approach you can take if you also want to update your code base :)
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-security-keyvault-certificates</artifactId>
<version>4.1.3/version>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-security-keyvault-keys/artifactId>
<version>4.2.3/version>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-security-keyvault-secrets</artifactId>
<version>4.2.3/version>
</dependency>
I'm trying to create a uber jar from my jersey project in eclipse using maven. When running the project in eclipse it works well, but when I try to export the project to a jar file using maven the server seems to miss the JSON Provider.
The server starts without warnings, but every request to the server is answered with a HTTP error 415 (which is why I assume that the JSON Provider is missing like described here)
I'v already tried many dependencies, build options, ... but non of them is working. I also tried the the answer to this question, which seemed to be related, but it didn't work either.
This is the pom.xml I'm using:
<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.picavi.json_rpc</groupId>
<artifactId>PicaviJsonRpc_server</artifactId>
<version>0.0.1-SNAPSHOT</version>
<repositories>
<repository>
<id>snapshot-repository.java.net</id>
<name>Java.net Snapshot Repository for Maven</name>
<url>https://maven.java.net/content/repositories/snapshots/</url>
<layout>default</layout>
</repository>
</repositories>
<dependencies>
<!-- Unit test framework -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.4.0</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.4.0</version>
</dependency>
<!-- Apache logging framework API -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.11.0</version>
</dependency>
<!-- Apache logging framework Core -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.11.0</version>
</dependency>
<!-- JAX-RS for REST -->
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.1-m07</version><!-- <version>2.0</version> -->
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-jdk-http</artifactId>
<version>2.26</version><!-- <version>2.10.1</version> -->
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
<version>2.26</version><!-- <version>2.10.1</version> -->
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>2.26</version><!-- <version>2.10.1</version> -->
</dependency>
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
<version>2.26</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Compiler plugin that tells the compiler to use java-1.8 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<!-- Compile with tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.2.0-M1</version>
</dependency>
</dependencies>
</plugin>
<!-- Javadoc plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<reportOutputDirectory>docs</reportOutputDirectory>
<destDir>.</destDir>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<finalName>Picavi_JsonRPC_server</finalName>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.picavi.json_rpc_server.server.JsonRpcServer</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
The project can be found on github
Edit:
After adding the ServicesResourceTransformer like mentioned in the comments the maven build looks like this (only the changed maven shade part):
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<finalName>Picavi_JsonRPC_server</finalName>
<createDependencyReducedPom>true</createDependencyReducedPom>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.picavi.json_rpc_server.server.JsonRpcServer</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
Adding this the build succeeds (like it did before), but starting the server I get the following errors:
WARNING: HK2 service reification failed for [org.glassfish.jersey.jaxb.internal.JaxbStringReaderProvider$RootElementProvider] with an exception:
MultiException stack 1 of 4
java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBContext
at org.glassfish.hk2.utilities.cache.LRUHybridCache.compute(LRUHybridCache.java:315)
at org.glassfish.hk2.utilities.reflection.internal.ClassReflectionHelperImpl.getAllMethods(ClassReflectionHelperImpl.java:108)
at org.jvnet.hk2.internal.Utilities.findInitializerMethods(Utilities.java:1424)
at org.jvnet.hk2.internal.DefaultClassAnalyzer.getInitializerMethods(DefaultClassAnalyzer.java:107)
at org.glassfish.jersey.inject.hk2.JerseyClassAnalyzer.getInitializerMethods(JerseyClassAnalyzer.java:242)
at org.jvnet.hk2.internal.Utilities.getInitMethods(Utilities.java:220)
at org.jvnet.hk2.internal.ClazzCreator.initialize(ClazzCreator.java:145)
at org.jvnet.hk2.internal.ClazzCreator.initialize(ClazzCreator.java:180)
at org.jvnet.hk2.internal.SystemDescriptor.internalReify(SystemDescriptor.java:740)
at org.jvnet.hk2.internal.SystemDescriptor.reify(SystemDescriptor.java:694)
at org.jvnet.hk2.internal.ServiceLocatorImpl.reifyDescriptor(ServiceLocatorImpl.java:464)
at org.jvnet.hk2.internal.ServiceLocatorImpl.narrow(ServiceLocatorImpl.java:2310)
at org.jvnet.hk2.internal.ServiceLocatorImpl.access$1200(ServiceLocatorImpl.java:128)
at org.jvnet.hk2.internal.ServiceLocatorImpl$9.compute(ServiceLocatorImpl.java:1395)
at org.jvnet.hk2.internal.ServiceLocatorImpl$9.compute(ServiceLocatorImpl.java:1390)
at org.glassfish.hk2.utilities.cache.internal.WeakCARCacheImpl.compute(WeakCARCacheImpl.java:128)
at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetAllServiceHandles(ServiceLocatorImpl.java:1452)
at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServiceHandles(ServiceLocatorImpl.java:1377)
at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServiceHandles(ServiceLocatorImpl.java:1366)
at org.glassfish.jersey.inject.hk2.AbstractHk2InjectionManager.getAllServiceHolders(AbstractHk2InjectionManager.java:158)
at org.glassfish.jersey.inject.hk2.ImmediateHk2InjectionManager.getAllServiceHolders(ImmediateHk2InjectionManager.java:54)
at org.glassfish.jersey.internal.inject.Providers.getServiceHolders(Providers.java:337)
at org.glassfish.jersey.internal.inject.Providers.getCustomProviders(Providers.java:175)
at org.glassfish.jersey.server.internal.inject.ParamExtractorConfigurator.lambda$init$0(ParamExtractorConfigurator.java:71)
at org.glassfish.jersey.internal.util.collection.Values$LazyValueImpl.get(Values.java:341)
at org.glassfish.jersey.server.internal.inject.MultivaluedParameterExtractorFactory.get(MultivaluedParameterExtractorFactory.java:89)
at org.glassfish.jersey.server.internal.inject.AbstractValueParamProvider.get(AbstractValueParamProvider.java:91)
at org.glassfish.jersey.server.internal.inject.PathParamValueParamProvider.createValueProvider(PathParamValueParamProvider.java:95)
at org.glassfish.jersey.server.internal.inject.AbstractValueParamProvider.getValueProvider(AbstractValueParamProvider.java:117)
at org.glassfish.jersey.server.spi.internal.ParameterValueHelper.getParamValueProvider(ParameterValueHelper.java:172)
at org.glassfish.jersey.server.spi.internal.ParameterValueHelper.createValueProviders(ParameterValueHelper.java:134)
at org.glassfish.jersey.server.model.ResourceMethodValidator.checkValueProviders(ResourceMethodValidator.java:178)
at org.glassfish.jersey.server.model.ResourceMethodValidator.checkMethod(ResourceMethodValidator.java:104)
at org.glassfish.jersey.server.model.ResourceMethodValidator.visitJaxrsResourceMethod(ResourceMethodValidator.java:100)
at org.glassfish.jersey.server.model.ResourceMethodValidator.visitResourceMethod(ResourceMethodValidator.java:90)
at org.glassfish.jersey.server.model.ResourceMethod.accept(ResourceMethod.java:899)
at org.glassfish.jersey.server.model.ComponentModelValidator.validateWithErrors(ComponentModelValidator.java:162)
at org.glassfish.jersey.server.model.ComponentModelValidator.validateWithErrors(ComponentModelValidator.java:168)
at org.glassfish.jersey.server.model.ComponentModelValidator.validateWithErrors(ComponentModelValidator.java:168)
at org.glassfish.jersey.server.model.ComponentModelValidator.validateWithErrors(ComponentModelValidator.java:168)
at org.glassfish.jersey.server.model.ComponentModelValidator.access$000(ComponentModelValidator.java:91)
at org.glassfish.jersey.server.model.ComponentModelValidator$1.run(ComponentModelValidator.java:152)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:272)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:268)
at org.glassfish.jersey.internal.Errors.process(Errors.java:316)
at org.glassfish.jersey.internal.Errors.process(Errors.java:298)
at org.glassfish.jersey.internal.Errors.process(Errors.java:268)
at org.glassfish.jersey.server.model.ComponentModelValidator.validate(ComponentModelValidator.java:147)
at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:389)
at org.glassfish.jersey.server.ApplicationHandler.lambda$initialize$1(ApplicationHandler.java:316)
at org.glassfish.jersey.internal.Errors.process(Errors.java:316)
at org.glassfish.jersey.internal.Errors.process(Errors.java:298)
at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:256)
at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:315)
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:282)
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:257)
at org.glassfish.jersey.jdkhttp.JdkHttpHandlerContainer.<init>(JdkHttpHandlerContainer.java:96)
at org.glassfish.jersey.jdkhttp.JdkHttpServerFactory.createHttpServer(JdkHttpServerFactory.java:108)
at org.glassfish.jersey.jdkhttp.JdkHttpServerFactory.createHttpServer(JdkHttpServerFactory.java:90)
at com.picavi.json_rpc_server.server.JsonRpcServer.startServer(JsonRpcServer.java:44)
at com.picavi.json_rpc_server.server.JsonRpcServer.main(JsonRpcServer.java:23)
Caused by: java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBContext
at java.base/java.util.concurrent.FutureTask.report(Unknown Source)
at java.base/java.util.concurrent.FutureTask.get(Unknown Source)
at org.glassfish.hk2.utilities.cache.LRUHybridCache$OriginThreadAwareFuture.get(LRUHybridCache.java:164)
at org.glassfish.hk2.utilities.cache.LRUHybridCache.compute(LRUHybridCache.java:303)
... 60 more
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBContext
at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.base/java.lang.Class.getDeclaredMethods(Unknown Source)
at org.glassfish.hk2.utilities.reflection.internal.ClassReflectionHelperUtilities$3.run(ClassReflectionHelperUtilities.java:108)
at org.glassfish.hk2.utilities.reflection.internal.ClassReflectionHelperUtilities$3.run(ClassReflectionHelperUtilities.java:104)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at org.glassfish.hk2.utilities.reflection.internal.ClassReflectionHelperUtilities.secureGetDeclaredMethods(ClassReflectionHelperUtilities.java:104)
at org.glassfish.hk2.utilities.reflection.internal.ClassReflectionHelperUtilities.getDeclaredMethodWrappers(ClassReflectionHelperUtilities.java:133)
at org.glassfish.hk2.utilities.reflection.internal.ClassReflectionHelperUtilities.getAllMethodWrappers(ClassReflectionHelperUtilities.java:192)
at org.glassfish.hk2.utilities.reflection.internal.ClassReflectionHelperUtilities.getAllMethodWrappers(ClassReflectionHelperUtilities.java:193)
at org.glassfish.hk2.utilities.reflection.internal.ClassReflectionHelperImpl$3.compute(ClassReflectionHelperImpl.java:84)
at org.glassfish.hk2.utilities.reflection.internal.ClassReflectionHelperImpl$3.compute(ClassReflectionHelperImpl.java:80)
at org.glassfish.hk2.utilities.cache.LRUHybridCache$OriginThreadAwareFuture$1.call(LRUHybridCache.java:115)
at org.glassfish.hk2.utilities.cache.LRUHybridCache$OriginThreadAwareFuture$1.call(LRUHybridCache.java:111)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at org.glassfish.hk2.utilities.cache.LRUHybridCache$OriginThreadAwareFuture.run(LRUHybridCache.java:173)
at org.glassfish.hk2.utilities.cache.LRUHybridCache.compute(LRUHybridCache.java:292)
... 60 more
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBContext
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
... 77 more
MultiException stack 2 of 4
java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBContext
at org.glassfish.hk2.utilities.cache.LRUHybridCache.compute(LRUHybridCache.java:315)
at org.glassfish.hk2.utilities.reflection.internal.ClassReflectionHelperImpl.getAllMethods(ClassReflectionHelperImpl.java:108)
at org.glassfish.hk2.utilities.reflection.internal.ClassReflectionHelperImpl.getPostConstructMethod(ClassReflectionHelperImpl.java:184)
at org.glassfish.hk2.utilities.reflection.internal.ClassReflectionHelperImpl.access$200(ClassReflectionHelperImpl.java:56)
at org.glassfish.hk2.utilities.reflection.internal.ClassReflectionHelperImpl$1.compute(ClassReflectionHelperImpl.java:64)
at org.glassfish.hk2.utilities.reflection.internal.ClassReflectionHelperImpl$1.compute(ClassReflectionHelperImpl.java:60)
at org.glassfish.hk2.utilities.cache.LRUHybridCache$OriginThreadAwareFuture$1.call(LRUHybridCache.java:115)
at org.glassfish.hk2.utilities.cache.LRUHybridCache$OriginThreadAwareFuture$1.call(LRUHybridCache.java:111)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at org.glassfish.hk2.utilities.cache.LRUHybridCache$OriginThreadAwareFuture.run(LRUHybridCache.java:173)
at org.glassfish.hk2.utilities.cache.LRUHybridCache.compute(LRUHybridCache.java:292)
at org.glassfish.hk2.utilities.reflection.internal.ClassReflectionHelperImpl.findPostConstruct(ClassReflectionHelperImpl.java:119)
at org.jvnet.hk2.internal.Utilities.findPostConstruct(Utilities.java:1460)
at org.jvnet.hk2.internal.DefaultClassAnalyzer.getPostConstructMethod(DefaultClassAnalyzer.java:130)
at org.glassfish.jersey.inject.hk2.JerseyClassAnalyzer.getPostConstructMethod(JerseyClassAnalyzer.java:252)
at org.jvnet.hk2.internal.Utilities.getPostConstruct(Utilities.java:281)
at org.jvnet.hk2.internal.ClazzCreator.initialize(ClazzCreator.java:169)
at org.jvnet.hk2.internal.ClazzCreator.initialize(ClazzCreator.java:180)
at org.jvnet.hk2.internal.SystemDescriptor.internalReify(SystemDescriptor.java:740)
at org.jvnet.hk2.internal.SystemDescriptor.reify(SystemDescriptor.java:694)
at org.jvnet.hk2.internal.ServiceLocatorImpl.reifyDescriptor(ServiceLocatorImpl.java:464)
at org.jvnet.hk2.internal.ServiceLocatorImpl.narrow(ServiceLocatorImpl.java:2310)
at org.jvnet.hk2.internal.ServiceLocatorImpl.access$1200(ServiceLocatorImpl.java:128)
at org.jvnet.hk2.internal.ServiceLocatorImpl$9.compute(ServiceLocatorImpl.java:1395)
at org.jvnet.hk2.internal.ServiceLocatorImpl$9.compute(ServiceLocatorImpl.java:1390)
at org.glassfish.hk2.utilities.cache.internal.WeakCARCacheImpl.compute(WeakCARCacheImpl.java:128)
at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetAllServiceHandles(ServiceLocatorImpl.java:1452)
at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServiceHandles(ServiceLocatorImpl.java:1377)
at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServiceHandles(ServiceLocatorImpl.java:1366)
at org.glassfish.jersey.inject.hk2.AbstractHk2InjectionManager.getAllServiceHolders(AbstractHk2InjectionManager.java:158)
at org.glassfish.jersey.inject.hk2.ImmediateHk2InjectionManager.getAllServiceHolders(ImmediateHk2InjectionManager.java:54)
at org.glassfish.jersey.internal.inject.Providers.getServiceHolders(Providers.java:337)
at org.glassfish.jersey.internal.inject.Providers.getCustomProviders(Providers.java:175)
at org.glassfish.jersey.server.internal.inject.ParamExtractorConfigurator.lambda$init$0(ParamExtractorConfigurator.java:71)
at org.glassfish.jersey.internal.util.collection.Values$LazyValueImpl.get(Values.java:341)
at org.glassfish.jersey.server.internal.inject.MultivaluedParameterExtractorFactory.get(MultivaluedParameterExtractorFactory.java:89)
at org.glassfish.jersey.server.internal.inject.AbstractValueParamProvider.get(AbstractValueParamProvider.java:91)
at org.glassfish.jersey.server.internal.inject.PathParamValueParamProvider.createValueProvider(PathParamValueParamProvider.java:95)
at org.glassfish.jersey.server.internal.inject.AbstractValueParamProvider.getValueProvider(AbstractValueParamProvider.java:117)
at org.glassfish.jersey.server.spi.internal.ParameterValueHelper.getParamValueProvider(ParameterValueHelper.java:172)
at org.glassfish.jersey.server.spi.internal.ParameterValueHelper.createValueProviders(ParameterValueHelper.java:134)
at org.glassfish.jersey.server.model.ResourceMethodValidator.checkValueProviders(ResourceMethodValidator.java:178)
at org.glassfish.jersey.server.model.ResourceMethodValidator.checkMethod(ResourceMethodValidator.java:104)
at org.glassfish.jersey.server.model.ResourceMethodValidator.visitJaxrsResourceMethod(ResourceMethodValidator.java:100)
at org.glassfish.jersey.server.model.ResourceMethodValidator.visitResourceMethod(ResourceMethodValidator.java:90)
at org.glassfish.jersey.server.model.ResourceMethod.accept(ResourceMethod.java:899)
at org.glassfish.jersey.server.model.ComponentModelValidator.validateWithErrors(ComponentModelValidator.java:162)
at org.glassfish.jersey.server.model.ComponentModelValidator.validateWithErrors(ComponentModelValidator.java:168)
at org.glassfish.jersey.server.model.ComponentModelValidator.validateWithErrors(ComponentModelValidator.java:168)
at org.glassfish.jersey.server.model.ComponentModelValidator.validateWithErrors(ComponentModelValidator.java:168)
at org.glassfish.jersey.server.model.ComponentModelValidator.access$000(ComponentModelValidator.java:91)
at org.glassfish.jersey.server.model.ComponentModelValidator$1.run(ComponentModelValidator.java:152)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:272)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:268)
at org.glassfish.jersey.internal.Errors.process(Errors.java:316)
at org.glassfish.jersey.internal.Errors.process(Errors.java:298)
at org.glassfish.jersey.internal.Errors.process(Errors.java:268)
at org.glassfish.jersey.server.model.ComponentModelValidator.validate(ComponentModelValidator.java:147)
at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:389)
at org.glassfish.jersey.server.ApplicationHandler.lambda$initialize$1(ApplicationHandler.java:316)
at org.glassfish.jersey.internal.Errors.process(Errors.java:316)
at org.glassfish.jersey.internal.Errors.process(Errors.java:298)
at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:256)
at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:315)
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:282)
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:257)
at org.glassfish.jersey.jdkhttp.JdkHttpHandlerContainer.<init>(JdkHttpHandlerContainer.java:96)
at org.glassfish.jersey.jdkhttp.JdkHttpServerFactory.createHttpServer(JdkHttpServerFactory.java:108)
at org.glassfish.jersey.jdkhttp.JdkHttpServerFactory.createHttpServer(JdkHttpServerFactory.java:90)
at com.picavi.json_rpc_server.server.JsonRpcServer.startServer(JsonRpcServer.java:44)
at com.picavi.json_rpc_server.server.JsonRpcServer.main(JsonRpcServer.java:23)
Caused by: java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBContext
at java.base/java.util.concurrent.FutureTask.report(Unknown Source)
at java.base/java.util.concurrent.FutureTask.get(Unknown Source)
at org.glassfish.hk2.utilities.cache.LRUHybridCache$OriginThreadAwareFuture.get(LRUHybridCache.java:164)
at org.glassfish.hk2.utilities.cache.LRUHybridCache.compute(LRUHybridCache.java:303)
... 70 more
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBContext
at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.base/java.lang.Class.getDeclaredMethods(Unknown Source)
at org.glassfish.hk2.utilities.reflection.internal.ClassReflectionHelperUtilities$3.run(ClassReflectionHelperUtilities.java:108)
at org.glassfish.hk2.utilities.reflection.internal.ClassReflectionHelperUtilities$3.run(ClassReflectionHelperUtilities.java:104)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at org.glassfish.hk2.utilities.reflection.internal.ClassReflectionHelperUtilities.secureGetDeclaredMethods(ClassReflectionHelperUtilities.java:104)
at org.glassfish.hk2.utilities.reflection.internal.ClassReflectionHelperUtilities.getDeclaredMethodWrappers(ClassReflectionHelperUtilities.java:133)
at org.glassfish.hk2.utilities.reflection.internal.ClassReflectionHelperUtilities.getAllMethodWrappers(ClassReflectionHelperUtilities.java:192)
at org.glassfish.hk2.utilities.reflection.internal.ClassReflectionHelperUtilities.getAllMethodWrappers(ClassReflectionHelperUtilities.java:193)
at org.glassfish.hk2.utilities.reflection.internal.ClassReflectionHelperImpl$3.compute(ClassReflectionHelperImpl.java:84)
at org.glassfish.hk2.utilities.reflection.internal.ClassReflectionHelperImpl$3.compute(ClassReflectionHelperImpl.java:80)
at org.glassfish.hk2.utilities.cache.LRUHybridCache$OriginThreadAwareFuture$1.call(LRUHybridCache.java:115)
at org.glassfish.hk2.utilities.cache.LRUHybridCache$OriginThreadAwareFuture$1.call(LRUHybridCache.java:111)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at org.glassfish.hk2.utilities.cache.LRUHybridCache$OriginThreadAwareFuture.run(LRUHybridCache.java:173)
at org.glassfish.hk2.utilities.cache.LRUHybridCache.compute(LRUHybridCache.java:292)
... 70 more
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBContext
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
... 87 more
(this is repeated serval times; full stacktrace was too long to be added here)
The server seems to start anyway. When I try to connect to this server the HTTP error changes to error 500 (internal server error).
I have a multimodule maven project and I like to execute a java class during the build of the multimodule.
The Java class is part of a submodule, so I tried to add the exec-maven-plugin, but it always fail with a ClassNotFoundException
The part looks like
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
<executions>
<execution>
<id>build-dump</id>
<phase>process-classes</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<includePluginDependencies>true</includePluginDependencies>
<mainClass>org.sonar.plugins.coffeelint2java.Coffeelint2Java</mainClass>
<arguments>
<argument>${rules.path}</argument>
</arguments>
</configuration>
</plugin>
This results in
Caused by: java.lang.NoClassDefFoundError: org/sonar/check/Priority
at org.sonar.plugins.coffeelint2java.CheckTemplateWriter.getPriority(CheckTemplateWriter.java:126)
at org.sonar.plugins.coffeelint2java.CheckTemplateWriter.checkLevelLine(CheckTemplateWriter.java:107)
at org.sonar.plugins.coffeelint2java.CheckTemplateWriter.lambda$generateReplacementMapping$3(CheckTemplateWriter.java:86)
at org.sonar.plugins.coffeelint2java.CheckTemplateWriter$$Lambda$5/161691919.accept(Unknown Source)
at java.util.ArrayList.forEach(ArrayList.java:1249)
at org.sonar.plugins.coffeelint2java.CheckTemplateWriter.generateReplacementMapping(CheckTemplateWriter.java:84)
at org.sonar.plugins.coffeelint2java.CheckTemplateWriter.generate(CheckTemplateWriter.java:52)
at org.sonar.plugins.coffeelint2java.Coffeelint2Java.doGenerateChecks(Coffeelint2Java.java:72)
at org.sonar.plugins.coffeelint2java.Coffeelint2Java.generateChecks(Coffeelint2Java.java:59)
at org.sonar.plugins.coffeelint2java.Coffeelint2Java.lambda$generateChecks$1(Coffeelint2Java.java:51)
at org.sonar.plugins.coffeelint2java.Coffeelint2Java$$Lambda$4/1333998550.accept(Unknown Source)
at java.util.Iterator.forEachRemaining(Iterator.java:116)
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
at org.sonar.plugins.coffeelint2java.Coffeelint2Java.generateChecks(Coffeelint2Java.java:51)
at org.sonar.plugins.coffeelint2java.Coffeelint2Java.main(Coffeelint2Java.java:41)
... 6 more
The sonar dependency is defined in the parent pom, but also when I add it to the <dependency> section in the submodule pom, it returns the same result.
How do I need to define the pom correctly, to include the dependencies when executing the main class ?
=== UPDATE ===
The dependency in the parent pom is
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>19.0</version>
</dependency>
<dependency>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-plugin-api</artifactId>
<version>5.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.sonarsource.sslr-squid-bridge</groupId>
<artifactId>sslr-squid-bridge</artifactId>
<version>2.6.1</version>
</dependency>
</dependencies>
The submodule itself also adds other dependencies
<dependencies>
<dependency>
<groupId>com.beust</groupId>
<artifactId>jcommander</artifactId>
<version>1.48</version>
</dependency>
</dependencies>
And right after updating my question and adding the dependency information to it, I saw it myself.
the provided attribute was the problem. argh
removing it solved the problem
I wrote a facade for the owl-api paired with the pellet reasoner to easily access an ontology. It worked quiet well. Then I tried to pack it as an OSGi Bundle and use it via an TrackerService from other services. The owl-api bundle needs guava and trove to run. For trove there is no bundle. Even after reloading the target platform, the pellet jars were not recognized as bundle in eclipse (I took them from jpm4j). So I thought about just take all the jar- stuff and squeeze it into the bundle.
I read a lot of how-to's for packaging third-party jars with a bundle. I use the maven-bundle-plugin and after reading some documentation from this plugin and bndtools I decided to use conditional-package, because here it was described that all entries in the pom are passed to the bndtools. After the compilation, no jar was packaged with my bundle :(. Then I used embed-dependencies. It didnt't work because the transient dependiencies were not available at runtime. So I used the embed-transient tag (I already read that this is bad style). The Import-Package part was filled automatically with all transient dependencies, so I overwrote it by hand to ged rid of the errors regarding the unsolved imports. This worked and I was able to use the owl-api to insert new properties,individuals, etc (yeah).
When I tryed to start the pellet reasoner, I got the error message below at runtime. I think it is about the dependency-mess in my project again. I already know that the current way is the wrong one, but I was not able to find a better one. Please help me to get this dependency management in OSGi right.
Cheers,
Stephan
ERROR MESSAGE:
!ENTRY org.apache.felix.configadmin 4 0 2015-11-16 11:28:45.218
!MESSAGE [org.osgi.service.cm.ManagedService, id=28, bundle=7/initial#reference:file:..vdg.iCar.service]: Unexpected problem updating configuration vdg.iCar.service
!STACK 0
java.lang.Error: javax.xml.datatype.DatatypeConfigurationException: Provider for class javax.xml.datatype.DatatypeFactory cannot be found
at javax.xml.bind.DatatypeConverterImpl.<clinit>(DatatypeConverterImpl.java:892)
at javax.xml.bind.DatatypeConverter.initConverter(DatatypeConverter.java:140)
at javax.xml.bind.DatatypeConverter.parseFloat(DatatypeConverter.java:243)
at com.clarkparsia.pellet.datatypes.types.floating.XSDFloat.getValue(XSDFloat.java:81)
at com.clarkparsia.pellet.datatypes.types.floating.XSDFloat.getCanonicalRepresentation(XSDFloat.java:58)
at com.clarkparsia.pellet.datatypes.DatatypeReasonerImpl.getCanonicalRepresentation(DatatypeReasonerImpl.java:365)
at org.mindswap.pellet.ABox.createLiteral(ABox.java:1746)
at org.mindswap.pellet.ABox.addLiteral(ABox.java:1725)
at org.mindswap.pellet.KnowledgeBase.addPropertyValue(KnowledgeBase.java:974)
at com.clarkparsia.pellet.owlapiv3.PelletVisitor.visit(PelletVisitor.java:1103)
at uk.ac.manchester.cs.owl.owlapi.OWLDataPropertyAssertionAxiomImpl.accept(OWLDataPropertyAssertionAxiomImpl.java:119)
at com.clarkparsia.pellet.owlapiv3.PelletVisitor.visit(PelletVisitor.java:699)
at uk.ac.manchester.cs.owl.owlapi.OWLOntologyImpl.accept(OWLOntologyImpl.java:1516)
at com.clarkparsia.pellet.owlapiv3.PelletReasoner.refresh(PelletReasoner.java:967)
at com.clarkparsia.pellet.owlapiv3.PelletReasoner.<init>(PelletReasoner.java:345)
at com.clarkparsia.pellet.owlapiv3.PelletReasoner.<init>(PelletReasoner.java:304)
at com.clarkparsia.pellet.owlapiv3.PelletReasonerFactory.createReasoner(PelletReasonerFactory.java:71)
at de.dlr.vdg.ontology.osgi.impl.util.ReasonerUtil.getInferredOntology(ReasonerUtil.java:56)
at de.dlr.vdg.ontology.osgi.impl.util.ReasonerUtil.getInferredRelations(ReasonerUtil.java:304)
at de.dlr.vdg.ontology.osgi.impl.OntologyServiceImpl.startReasoning(OntologyServiceImpl.java:106)
at de.dlr.vdg.iCar.osgi.impl.iCarServiceImpl.start(iCarServiceImpl.java:67)
at de.dlr.vdg.iCar.osgi.Activator.updated(Activator.java:65)
at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:189)
at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152)
at org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85)
at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.provide(ConfigurationManager.java:1444)
at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.run(ConfigurationManager.java:1400)
at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:103)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.xml.datatype.DatatypeConfigurationException: Provider for class javax.xml.datatype.DatatypeFactory cannot be found
at javax.xml.datatype.FactoryFinder.findServiceProvider(FactoryFinder.java:304)
at javax.xml.datatype.FactoryFinder.find(FactoryFinder.java:268)
at javax.xml.datatype.DatatypeFactory.newInstance(DatatypeFactory.java:145)
at javax.xml.bind.DatatypeConverterImpl.<clinit>(DatatypeConverterImpl.java:890)
... 28 more
Caused by: java.util.ServiceConfigurationError: javax.xml.datatype.DatatypeFactory: Provider org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl not a subtype
at java.util.ServiceLoader.fail(ServiceLoader.java:239)
at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at javax.xml.datatype.FactoryFinder$1.run(FactoryFinder.java:297)
at java.security.AccessController.doPrivileged(Native Method)
at javax.xml.datatype.FactoryFinder.findServiceProvider(FactoryFinder.java:292)
... 31 more
POM-File (important parts):
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.0.1</version>
<extensions>true</extensions>
<configuration>
<manifestLocation>META-INF</manifestLocation>
<instructions>
<Private-Package>${bundle.namespace}.*</Private-Package>
<Export-Package>${bundle.namespaceShared}</Export-Package>
<Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName>
<Bundle-Version>${project.version}</Bundle-Version>
<Bundle-Activator>${bundle.namespace}.Activator</Bundle-Activator>
<Bundle-RequiredExecutionEnvironment>JavaSE-1.8</Bundle-RequiredExecutionEnvironment>
<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
<Import-Package>org.osgi.framework;version="[1.6,2)",org.osgi.se
rvice.cm;version="[1.4,2)",org.slf4j;version="[1.7,2)"</Import-Package>
<Bundle-ClassPath>.,{maven-dependencies}</Bundle-ClassPath>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.7</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.1.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>4.3.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
<version>4.3.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.sourceforge.owlapi</groupId>
<artifactId>owlapi-distribution</artifactId>
<version>3.5.2</version>
<type>bundle</type>
</dependency>
<dependency>
<groupId>com.github.ansell.pellet</groupId>
<artifactId>pellet-owlapiv3</artifactId>
<version>2.3.6-ansell</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.github.ansell.pellet</groupId>
<artifactId>pellet-query</artifactId>
<version>2.3.6-ansell</version>
<type>jar</type>
</dependency>
</dependencies>
After an additional day of research I came across this thread at oracle.
The pellet-api references the xerces and xml-api libs and due to the transient inclusion of dependencies, these libs were included in my bundle. But these libs are already present in the java runtime environment. Therefore I excluded them in the Embed-Dependency section and everything works.
<Embed-Dependency>*;scope=compile|runtime;inline=false;groupId=!xml-apis|xerces</Embed-Dependency>