pf4j / pf4j-wicket

Plugin Framework for Wicket (PF4J - Wicket integration)
Apache License 2.0
33 stars 16 forks source link

NullPointerException in InheritedMarkupMarkupLoader #3

Closed jchappelle closed 8 years ago

jchappelle commented 8 years ago

I'm getting a NullPointerException when adding the wicket-plugin jar file to the classpath. I've tried the 0.4 version and the 0.5-SNAPSHOT version(I pulled in the code and built it myself). I run "mvn jetty:run" from the command line and it launches fine, but when I hit the web page with a browser it fails.

I have created a wicket quickstart for you that is the minimal example to reproduce the problem. The application will render when the wicket-plugin jar file is not on the classpath. However, when I add the dependency I get the error.

I think it's due to the weird way we are doing markup inheritance with our base pages and all, but we've been doing it that way since 2008 and Wicket supports it.

I don't mind changing our markup inheritance for the product I'm working on but it makes me worry that there will be other ClassLoader type problems in the future.

I appreciate you looking at this. Below is the stack trace and I've attached the quickstart.

java.lang.NullPointerException
     at org.apache.wicket.markup.loader.InheritedMarkupMarkupLoader.getBaseMarkup(InheritedMarkupMarkupLoader.java:96)
     at org.apache.wicket.markup.loader.InheritedMarkupMarkupLoader.loadMarkup(InheritedMarkupMarkupLoader.java:68)
     at org.apache.wicket.markup.loader.DefaultMarkupLoader.loadMarkup(DefaultMarkupLoader.java:52)
     at org.apache.wicket.markup.MarkupFactory.loadMarkup(MarkupFactory.java:412)
     at org.apache.wicket.markup.MarkupCache.loadMarkup(MarkupCache.java:447)
     at org.apache.wicket.markup.MarkupCache.loadMarkupAndWatchForChanges(MarkupCache.java:543)
     at org.apache.wicket.markup.MarkupCache.getMarkup(MarkupCache.java:304)
     at org.apache.wicket.markup.MarkupFactory.getMarkup(MarkupFactory.java:236)
     at org.apache.wicket.markup.MarkupFactory.getMarkup(MarkupFactory.java:194)
     at org.apache.wicket.MarkupContainer.getAssociatedMarkup(MarkupContainer.java:456)
     at org.apache.wicket.MarkupContainer.getRegionMarkup(MarkupContainer.java:2224)
     at org.apache.wicket.MarkupContainer.newDequeueContext(MarkupContainer.java:2211)
     at org.apache.wicket.MarkupContainer.dequeueAutoComponents(MarkupContainer.java:1670)
     at org.apache.wicket.MarkupContainer.onInitialize(MarkupContainer.java:1664)
     at org.apache.wicket.Page.onInitialize(Page.java:299)
     at org.apache.wicket.Component.fireInitialize(Component.java:877)
     at org.apache.wicket.MarkupContainer.internalInitialize(MarkupContainer.java:1084)
     at org.apache.wicket.Page.isPageStateless(Page.java:465)
     at org.apache.wicket.request.handler.render.WebPageRenderer.isPageStateless(WebPageRenderer.java:287)
     at org.apache.wicket.request.handler.render.WebPageRenderer.shouldRenderPageAndWriteResponse(WebPageRenderer.java:329)
     at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:193)
     at org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:175)
     at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:895)
     at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
     at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:265)
     at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:222)
     at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:293)
     at org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:261)
     at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:203)
     at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:284)
     at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
     at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
     at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
     at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
     at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
     at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
     at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
     at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
     at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
     at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
     at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
     at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
     at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
     at org.eclipse.jetty.server.Server.handle(Server.java:499)
     at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
     at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
     at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
     at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
     at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
     at java.lang.Thread.run(Thread.java:745)

Complete stack:

file:/C:/eclipse-workspaces/quickstarts/wicket-plugin-npe/target/classes/com/mycompany/SecuredBasePage.html: Error while reading the markup: null
 MarkupStream: [unknown]
     at org.apache.wicket.markup.MarkupFactory.loadMarkup(MarkupFactory.java:450)
     at org.apache.wicket.markup.MarkupCache.loadMarkup(MarkupCache.java:447)
     at org.apache.wicket.markup.MarkupCache.loadMarkupAndWatchForChanges(MarkupCache.java:543)
     at org.apache.wicket.markup.MarkupCache.getMarkup(MarkupCache.java:304)
     at org.apache.wicket.markup.MarkupFactory.getMarkup(MarkupFactory.java:236)
     at org.apache.wicket.markup.MarkupFactory.getMarkup(MarkupFactory.java:194)
     at org.apache.wicket.MarkupContainer.getAssociatedMarkup(MarkupContainer.java:456)
     at org.apache.wicket.MarkupContainer.getRegionMarkup(MarkupContainer.java:2224)
     at org.apache.wicket.MarkupContainer.newDequeueContext(MarkupContainer.java:2211)
     at org.apache.wicket.MarkupContainer.dequeueAutoComponents(MarkupContainer.java:1670)
     at org.apache.wicket.MarkupContainer.onInitialize(MarkupContainer.java:1664)
     at org.apache.wicket.Page.onInitialize(Page.java:299)
     at org.apache.wicket.Component.fireInitialize(Component.java:877)
     at org.apache.wicket.MarkupContainer.internalInitialize(MarkupContainer.java:1084)
     at org.apache.wicket.Page.isPageStateless(Page.java:465)
     at org.apache.wicket.request.handler.render.WebPageRenderer.isPageStateless(WebPageRenderer.java:287)
     at org.apache.wicket.request.handler.render.WebPageRenderer.shouldRenderPageAndWriteResponse(WebPageRenderer.java:329)
     at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:193)
     at org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:175)
     at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:895)
     at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
     at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:265)
     at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:222)
     at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:293)
     at org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:261)

[wicket-plugin-npe.zip](https://github.com/decebals/wicket-plugin/files/137356/wicket-plugin-npe.zip)
jchappelle commented 8 years ago

The file is here https://github.com/decebals/wicket-plugin/files/137356/wicket-plugin-npe.zip

decebals commented 8 years ago

I will take a look.

decebals commented 8 years ago

@jchappelle Please see if the issue is resolved on your environment.

jchappelle commented 8 years ago

That resolved the issue. Thanks a lot for the quick response!

jchappelle commented 8 years ago

When is the release for this fix going to be available from Maven Central?

decebals commented 8 years ago

When is the release for this fix going to be available from Maven Central?

Monday

decebals commented 8 years ago

Done