Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] Maven Jetty Plug-in + WebApplicationInitializer throw NPE on reload

Hi,
I have created a simple tutorial project that uses Spring 3.2 web application without web.xml, using WebApplicationInitializer mechanism instead.

However, whenever I setup manual reloading within Maven plugin:
            <configuration>
                <reload>manual</reload>
            </configuration>

and press Enter within the console, the application context gets reloaded, but the WebApplicationInitializer throws a NullPointerException (see below)

I am attaching a simple project, which indicated that the reason may lie in the WebApplicationInitializer or the servletcontext not being properly cleaned up in the undeployment phase. The actual line is:

ServletRegistration.Dynamic dispatcher = servletContext.addServlet("dispatcher", new DispatcherServlet(ctx));

while addServlet() method returns null whenever the servlet is already mapped. However, the freshly deployed application should not have this servlet already mapped and it should not return null.

This issue affects the 8.1.x branch as well, the last version of Jetty Maven plug-in that works without NPEs is the 8.1.9.v20130131.

The exception is:

java.lang.NullPointerException
at jettybug.WebApplicationInitializer.onStartup(WebApplicationInitializer.java:22) at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:180) at org.eclipse.jetty.plus.annotation.ContainerInitializer.callStartup(ContainerInitializer.java:105) at org.eclipse.jetty.annotations.ServletContainerInitializerListener.doStart(ServletContainerInitializerListener.java:107) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69) at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:108) at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:82)

Robert


Attachment: jetty-webinitializer-npe.zip
Description: Zip compressed data


Back to the top