[
https://issues.apache.org/jira/browse/KARAF-3531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14330378#comment-14330378
]
Sam Patel commented on KARAF-3531:
----------------------------------
I think this may also be related to some behavior I'm seeing making a KAR. It
looks like you can't have a dependency in a KAR that is not a ready-to-go OSGI
bundle since it results in a wrap protocol entry appearing in the features
file, which in turn can appear in the startup.properites if you're using the
KAR to build a custom distribution. This is all using Karaf 3.0.3 .
In the POM for the KAR, I have a dependency on json-simple artifact.
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
I'm using karaf-maven-plugin version 3.0.3. During the creation of the KAR, it
creates a features xml file using the dependency listing and then creates a
KAR. With the addition of the json-simple dependency, the following 2 wrap
bundles appear in the generated features xml.
<bundle start-level="80">wrap:mvn:junit/junit/4.10</bundle>
<bundle
start-level="80">wrap:mvn:org.hamcrest/hamcrest-core/1.1</bundle>
I assemble a custom distribution pulling in this KAR and eventually when
starting up the container I get the following error. The two wrap protocol
entries do appear in the startup.properties and I believe that gets us back to
the same problem mentioned in this ticket.
java.lang.RuntimeException: Error installing bundle listed in
startup.properties with url: wrap:mvn:junit/junit/4.10 and startlevel: 80
at org.apache.karaf.main.Main.installAndStartBundles(Main.java:384)
at org.apache.karaf.main.Main.launch(Main.java:245)
at org.apache.karaf.main.Main.main(Main.java:167)
Caused by: java.lang.RuntimeException: Could not resolve
wrap:mvn:junit/junit/4.10
at
org.apache.karaf.main.util.SimpleMavenResolver.resolve(SimpleMavenResolver.java:59)
at org.apache.karaf.main.Main.installAndStartBundles(Main.java:377)
... 2 more
> SimpleMavenResolver does not handle wrap: prefix in mvn urls
> ------------------------------------------------------------
>
> Key: KARAF-3531
> URL: https://issues.apache.org/jira/browse/KARAF-3531
> Project: Karaf
> Issue Type: Bug
> Components: karaf-core
> Affects Versions: 3.0.3
> Reporter: Ed Warnicke
>
> If you have a dependency on:
> <!-- karaf standard features -->
> <dependency>
> <groupId>org.apache.karaf.features</groupId>
> <artifactId>standard</artifactId>
> <version>${karaf.version}</version>
> <type>xml</type>
> <classifier>features</classifier>
> </dependency>
> Note: compile scope... this will cause a radical overpopulation of
> startup.properties which will result in a listing with a wrap: prefix which
> will
> then cause a failure of karaf startup because the SimpleMavenResolver does
> not have any logic to deal with a wrap:mvn:<groupId>/<artifactId> (because it
> presumes all mvn urls are prefixed with mvn:). As a result you will get a
> failure on first karaf startup, and on subsequent startups you will get a
> partial resolution case.
> Suggested solution: check for the wrap: prefix in SimpleMavenResolver and
> handle it correctly.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)