Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSGI Documentation for activating WebAppContext is out of date #2401

Closed
col-panic opened this issue Mar 30, 2018 · 5 comments
Closed

OSGI Documentation for activating WebAppContext is out of date #2401

col-panic opened this issue Mar 30, 2018 · 5 comments
Assignees

Comments

@col-panic
Copy link

I just updated our Eclipse target from Neon.3 to Oxygen.3, which brings in jetty 9.4.8 instead of 9.3. Now my implementation does not work anymore.

In https://github.com/elexis/elexis-server/blob/master/bundles/es.openid/src/info/elexis/server/openid/internal/WebappStarter.java you see the start of a war file, that works really great with jetty 9.3 but stops working with 9.4.

I found out about #705 which provided some kind of a work-around, yet I can't get my original code working. I stumble from NPE to NPE.

The things I changed so far

and yet I'm stuck with

2018-03-30 14:14:03,728 WARN  o.eclipse.jetty.webapp.WebAppContext - Failed startup of context o.e.j.w.WebAppContext@1d437749{/openid,file:///private/var/folders/c2/z13_p9p55r7__64m2514jwv00000gn/T/jetty-0.0.0.0-8380-openid.war-_openid-any-3341177355373256604.dir/webapp/,UNAVAILABLE}{/Users/marco/Development/elexis-server-master/git/elexis-server/bundles/es.openid/lib/openid.war}
java.lang.NullPointerException: null
	at org.eclipse.osgi.internal.framework.legacy.StartLevelImpl.getModule(StartLevelImpl.java:72) ~[na:na]
	at org.eclipse.osgi.internal.framework.legacy.PackageAdminImpl.getWiring(PackageAdminImpl.java:249) ~[na:na]
	at org.eclipse.osgi.internal.framework.legacy.PackageAdminImpl.getFragments(PackageAdminImpl.java:209) ~[na:na]
	at org.eclipse.jetty.osgi.boot.utils.internal.PackageAdminServiceTracker.collectFragmentsAndRequiredBundles(PackageAdminServiceTracker.java:176) ~[na:na]
	at org.eclipse.jetty.osgi.boot.utils.internal.PackageAdminServiceTracker.getFragmentsAndRequiredBundles(PackageAdminServiceTracker.java:157) ~[na:na]
	at org.eclipse.jetty.osgi.boot.OSGiWebInfConfiguration.findJars(OSGiWebInfConfiguration.java:163) ~[org.eclipse.jetty.osgi.boot_9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.eclipse.jetty.webapp.WebInfConfiguration.findAndFilterWebAppPaths(WebInfConfiguration.java:300) ~[org.eclipse.jetty.webapp_9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.eclipse.jetty.webapp.WebInfConfiguration.preConfigure(WebInfConfiguration.java:158) ~[org.eclipse.jetty.webapp_9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.eclipse.jetty.osgi.boot.OSGiWebInfConfiguration.preConfigure(OSGiWebInfConfiguration.java:89) ~[org.eclipse.jetty.osgi.boot_9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.eclipse.jetty.webapp.WebAppContext.preConfigure(WebAppContext.java:506) ~[org.eclipse.jetty.webapp_9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:544) ~[org.eclipse.jetty.webapp_9.4.8.v20171121.jar:9.4.8.v20171121]
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) [org.eclipse.jetty.util_9.4.8.v20171121.jar:9.4.8.v20171121]
	at info.elexis.server.openid.internal.WebappStarter.activate(WebappStarter.java:85) [es.openid/:na]

What am I doing wrong, why does it have to be so complicated now?!?

@col-panic
Copy link
Author

Note: I added webapp.start(); at the end of the code to even see the Exception. If I don't do this, the WebApp is simply not being startet, no error message or exception is shown, the webapp is simply not available.

@joakime
Copy link
Contributor

joakime commented Mar 30, 2018

The workaround from jerboaa/thermostat is for Jetty 9.1.0.v20131115 and will actually undo efforts on the jetty side in 9.4.8, it would probably be wise to undo that workaround.

https://github.com/elexis/elexis-server/blob/c93fbbe175fc17924632a5982b761e682c9cb6ff/bundles/es.openid/src/info/elexis/server/openid/internal/WebappStarter.java#L30-L38

Why are you registering your WebAppContext as a ContextHandler?

See our own test cases for WebAppContext ...

https://github.com/eclipse/jetty.project/blob/072442a5e5d451680eeefb9b19df720c789ff5b3/jetty-osgi/test-jetty-osgi-webapp/src/main/java/com/acme/osgi/Activator.java#L78-L84

@col-panic
Copy link
Author

Thank you so much! I was hunting a ghost! After changing it from ContextHandler to WebAppContext everything works! I was registering it as ContextHandler, as it is mentioned this way in https://www.eclipse.org/jetty/documentation/9.3.x/framework-jetty-osgi.html - so changing this seems to be the only requirement to have it running in 9.4.

It is still documented this way in https://www.eclipse.org/jetty/documentation/9.4.x/framework-jetty-osgi.html

@joakime
Copy link
Contributor

joakime commented Mar 30, 2018

Moving this to a documentation issue then.

@joakime joakime assigned WalkerWatch and unassigned janbartel Mar 30, 2018
@joakime joakime changed the title Can't start war file in OSGI after update from 9.3 to 9.4 OSGI Documentation for activating WebAppContext is out of date Mar 30, 2018
@janbartel
Copy link
Contributor

Doc fixed for 9.4.10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants