Skip to main content

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

Thanks Robert, I added this bug:
Problem is caused by programmatically added servlets not be removed from the context on a stop, so they already exist on the restart, causing the registration process to return null (correctly according to the servlet spec api).

Looking into it.

Jan


On 30 May 2013 01:19, Robert Novotny <robert.novotny@xxxxxxx> wrote:
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



_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users




--
Jan Bartel <janb@xxxxxxxxxxx>
www.webtide.com – Developer advice, services and support
from the Jetty & CometD experts.

Back to the top