pzoio / impala

Automatically exported from code.google.com/p/impala
1 stars 2 forks source link

Application fails to start if packaging with servlet-2.4 jar when container supports 2.5 #330

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
In that scenario the following occurs:

{{{
java.lang.NoSuchMethodError:
javax.servlet.ServletContext.getContextPath()Ljava/lang/String;
    at
org.impalaframework.web.utils.ServletContextUtils.getContextPathWithoutSlash(Ser
vletContextUtils.java:30)
    at
org.impalaframework.web.module.WebModuleUtils.getParamValue(WebModuleUtils.java:
30)
    at
org.impalaframework.web.spring.loader.BaseImpalaContextLoader.getBootstrapContex
tLocations(BaseImpalaContextLoader.java:182)
    at
org.impalaframework.web.spring.loader.BaseImpalaContextLoader.createModuleManage
mentFacade(BaseImpalaContextLoader.java:206)
    at
org.impalaframework.web.spring.loader.BaseImpalaContextLoader.initImpalaApplicat
ionContext(BaseImpalaContextLoader.java:119)
    at
org.impalaframework.web.spring.loader.BaseImpalaContextLoader.initWebApplication
Context(BaseImpalaContextLoader.java:78)
    at
org.impalaframework.web.spring.loader.ImpalaContextLoaderListener.contextInitial
ized(ImpalaContextLoaderListener.java:44)
    at
org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:543)
    at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
    at
org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1220)
    at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:513)
    at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at
org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
    at
org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollect
ion.java:156)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at
org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
    at org.mortbay.jetty.Server.doStart(Server.java:222)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at org.impalaframework.web.StartJetty.main(StartJetty.java:65)
    at StartServer.main(StartServer.java:21)
}}}

The problem appears because the servlet context implementation supports
2.5, but you only have a 2.4 version of the jar in the classpath. As a
result, the attempt to call servletContext.getContextPath() is made, but
fails due to API incompatibility.

Propose to catch the NoSuchMethodError, and log a warning.

Original issue reported on code.google.com by philzoio...@googlemail.com on 21 May 2010 at 9:31

GoogleCodeExporter commented 8 years ago
Fixed with r5563 - now logs warnign when NoSuchMethodError fails, and return 
null for
getContextPath

Original comment by philzoio...@googlemail.com on 21 May 2010 at 9:49