[ODLPARENT-24] Exception thrown when running karaf for the very first time Created: 11/Sep/15  Updated: 24/Jan/18  Resolved: 07/Jun/17

Status: Resolved
Project: odlparent
Component/s: General
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Moiz Raja Assignee: Michael Vorburger
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: Mac OS
Platform: Macintosh


External issue ID: 4290

 Description   

Here is the exception that happens,

MORAJA-M-301N:assembly moizr$ ./bin/karaf
Error installing bundle listed in startup.properties with url: wrap:mvn:javax.servlet.jsp/jsp-api/2.1 and startlevel: 30
Exception in thread "main" java.lang.NullPointerException
at org.apache.karaf.main.Main.destroy(Main.java:525)
at org.apache.karaf.main.Main.main(Main.java:173)

To reproduce the problem,

1. In the controller repo switch to the stable/lithium branch and build the controller using mvn clean install
2. cd ./karaf/opendaylight-karaf/target/assembly
3. ./bin/karaf

The next time you try to launch karaf it will work. To reproduce again at this point do the following,

1. stop/kill karaf
2. delete the data directory
3. ./bin/karaf



 Comments   
Comment by Moiz Raja [ 11/Sep/15 ]

Slightly more detailed exception,

Sep 10, 2015 5:40:19 PM org.apache.karaf.main.Main launch
INFO: Installing and starting initial bundles
Sep 10, 2015 5:40:19 PM org.apache.karaf.main.Main main
SEVERE: Could not launch framework
java.lang.RuntimeException: Error installing bundle listed in startup.properties with url: wrap:mvn:javax.servlet.jsp/jsp-api/2.1 and startlevel: 30
at org.apache.karaf.main.Main.installAndStartBundles(Main.java:392)
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:javax.servlet.jsp/jsp-api/2.1
at org.apache.karaf.main.util.SimpleMavenResolver.resolve(SimpleMavenResolver.java:59)
at org.apache.karaf.main.Main.installAndStartBundles(Main.java:384)
... 2 more

Comment by Moiz Raja [ 29/Sep/15 ]

This seems to only happen on the controller distribution

Comment by Ryan Goulding [ 13/Apr/16 ]

Hi Moiz,

I still see reports of this occurring in master; do you know if a root cause was ever found for this? Any additional information you can provide is greatly helpful!

Thanks!
Ryan

Comment by Michael Vorburger [ 06/Jun/17 ]

I'm just hitting something similar, with the infrautils SampleIntegrationTest which worked last week suddenly failing (both locally as well as on Jenkins) with this in infrautils/itestutils/it/target/surefire-reports/org.opendaylight.infrautils.itestutils.it.SampleIntegrationTest-output.txt:

Error installing bundle listed in startup.properties with url: mvn:org.osgi/org.osgi.service.event/1.3.1 and startlevel: 7
Exception in thread "main" java.lang.NullPointerException
at org.apache.karaf.main.Main.destroy(Main.java:634)
at org.apache.karaf.main.Main.main(Main.java:183)
[main] INFO org.ops4j.pax.exam.spi.reactors.ReactorManager - suite finished

and indeed under infrautils/itestutils/it/target/paxexam/.../system/org there is no osgi/ sub-directory - should there be?

Did we just break this by Or did we just break this when merging https://git.opendaylight.org/gerrit/#/c/58053/ ?

Comment by Michael Vorburger [ 06/Jun/17 ]

see also https://issues.apache.org/jira/browse/KARAF-3374 for the Karaf issue which may in the future provide a better error message than the slightly confusing NullPointerException (but which won't fix the root cause which seems to be in our assembly).

Comment by Michael Vorburger [ 06/Jun/17 ]

> under system/org there is no osgi/ sub-directory - should there be?

The real question is what needs org.osgi.service.event, and why that does not transitively pull it along... We can see controller.blueprint/pom.xml having a <dependency> to it, so is it missing in a controller feature?

But as just raised in https://lists.opendaylight.org/pipermail/odlparent-dev/2017-June/001051.html, this currently happens even in odlparent and infrautils without controller in the picture:

odlparent/karaf/opendaylight-karaf4-empty/target/assembly/bin/karaf
Apache Karaf starting up. Press Enter to open the shell now...
Error installing bundle listed in startup.properties with url:
mvn:org.osgi/org.osgi.service.event/1.3.1 and startlevel: 7
Exception in thread "main" java.lang.NullPointerException
at org.apache.karaf.main.Main.destroy(Main.java:634)
at org.apache.karaf.main.Main.main(Main.java:183)

https://git.opendaylight.org/gerrit/#/c/58362/ fixes this (above), but I'm not 100% it's the right (or the best) fix .. I'm not clear what actually needs org.osgi.service.event in an empty basic Karaf, and why the Karaf core features that we depend on do not transitively pull this along - something seems off, that we have to do the kind of small work-around I'm proposing in c/58362.

Comment by Robert Varga [ 06/Jun/17 ]

The fix should work. Controller's blueprint extension cannot just pull it in, as pax-logging has an optional dependency on it – leading to a complete container refresh when it pulled in.

On the console this manifests by karaf printing the banner the second time.

Comment by Michael Vorburger [ 06/Jun/17 ]

> The fix should work.

Confirming; FYI, I've now locally verified that merging c/58362 would fix both odlparent/karaf/opendaylight-karaf4-empty/target/assembly/bin/karaf as well as e.g. infrautils/itestutils/it (SampleIntegrationTest).

> pax-logging has an optional dependency on it

Oh; didn't know. So... shouldn't it (org.osgi.service.event) then have been listed in some upstream Karaf core feature, in an ideal world, so that we would never have had this problem? (Open a bug / propose a change to Apache Karaf - or forget about it?)

Comment by Michael Vorburger [ 07/Jun/17 ]

Closing as RESOLVED FIXED, as c/58362 got merged.

Generated at Wed Feb 07 20:27:24 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.