2015-03-17 15:16 GMT+02:00 Thusitha Thilina Dayaratne <thusit...@wso2.com>: > > Hi > > > > Hi Violeta > > > > Hi, > > > > 2015-03-16 15:07 GMT+02:00 Thusitha Thilina Dayaratne < thusit...@wso2.com > >: > > > > > > >>> ERROR {org.apache.catalina.core.ApplicationDispatcher} - > > > >>> Servlet.service() for servlet bridgeservlet threw exception > > > >>> java.lang.NullPointerException > > > >>> at > > > >>> > > > > > > > > > > org.apache.jasper.JspCompilationContext.getTldResourcePath(JspCompilationContext.java:536) > > > >>> at > > > > > org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:410) > > > >>> at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:469) > > > >>> at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1430) > > > >>> at org.apache.jasper.compiler.Parser.parse(Parser.java:139) > > > > > > > > <snip/> > > > > > > > >>>> I can't figure out the reason to get this NullPointerException. > > > >>>> Can someone help me out? > > > > > > > >>> If we knew which version of Tomcat 8 you were using, someone could > > look > > > >>> at the relevant source code to try to figure out what was going on. > > > > I'm using tomcat version *8.0.20* > > > > > > >>Browse to the sourcecode of v8.0.20 of tomcat here: > > > > > > >> public TldResourcePath getTldResourcePath(String uri) { > > > >> return getOptions().getTldCache().getTldResourcePath(uri); > > > >> } > > > Thanks for the quick response > > > > > > >> Obviously either getOptions() or getTldCache() is returning null. > > > > > > I debug the code as you suggest and found that getTldCache() is null. > > > In the code As I understand there are 2 point which set the *tldCache* > > > variable > > > one is the setTldCache() method and other is > > > public static TldCache getInstance(ServletContext servletContext) { > > > > > > if (servletContext == null) { > > > throw new IllegalArgumentException(Localizer.getMessage( > > > > > "org.apache.jasper.compiler.TldCache.servletContextNull")); > > > } > > > return (TldCache) > > > servletContext.getAttribute(SERVLET_CONTEXT_ATTRIBUTE_NAME); > > > } > > > > > > > > >>If you can attach a debugger try to see whether the code below is > invoked: > > > > >>org.apache.jasper.servlet.JasperInitializer.onStartup(Set<Class<?>>, > > >>ServletContext) { > > >>..... > > >> context.setAttribute(TldCache.SERVLET_CONTEXT_ATTRIBUTE_NAME, > > >> new TldCache(context, > scanner.getUriTldResourcePathMap(), > > >> scanner.getTldResourcePathTaglibXmlMap())); > > >> > > >>} > > I have checked that as well. But that method didn't get hot when I'm > > debugging the source. > > what could be the reason? > > >You wrote that you are running an embedded Tomcat. Is that true? > >In Tomcat 8, Jasper initialization is implemented as a standard > >ServletContainderInitializer (check Servlet specification). > >So you should ensure > >that org.apache.jasper.servlet.JasperInitializer.onStartup is invoked > >during web app startup > > Could someone tell me how can I make sure that this method get call during > the web app startup?
>You didn't tell us whether you are embedding Tomcat or not. Thanks for response and I'm Sorry for missing the info in previous mail. Yes I'm embedding tomcat version 8.0.20 >If you are embedding it which jar files from Tomcat distribution you are >using etc. I'm using following tomcat jars - tomcat-embed-core - tomcat-embed-jasper - tomcat-websocket-api - tomcat-embed-websocket - tomcat-jasper >You can start debugging >with org.apache.catalina.startup.ContextConfig.webConfig() >- processServletContainerInitializers(sContext); Thanks Regards Thusitha On Tue, Mar 17, 2015 at 6:56 PM, Violeta Georgieva <miles...@gmail.com> wrote: > Hi, > > 2015-03-17 15:16 GMT+02:00 Thusitha Thilina Dayaratne <thusit...@wso2.com > >: > > > > Hi > > > > > > Hi Violeta > > > > > > Hi, > > > > > > 2015-03-16 15:07 GMT+02:00 Thusitha Thilina Dayaratne < > thusit...@wso2.com > > >: > > > > > > > > >>> ERROR {org.apache.catalina.core.ApplicationDispatcher} - > > > > >>> Servlet.service() for servlet bridgeservlet threw exception > > > > >>> java.lang.NullPointerException > > > > >>> at > > > > >>> > > > > > > > > > > > > > > > > org.apache.jasper.JspCompilationContext.getTldResourcePath(JspCompilationContext.java:536) > > > > >>> at > > > > > > > org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:410) > > > > >>> at > org.apache.jasper.compiler.Parser.parseDirective(Parser.java:469) > > > > >>> at > org.apache.jasper.compiler.Parser.parseElements(Parser.java:1430) > > > > >>> at org.apache.jasper.compiler.Parser.parse(Parser.java:139) > > > > > > > > > > <snip/> > > > > > > > > > >>>> I can't figure out the reason to get this NullPointerException. > > > > >>>> Can someone help me out? > > > > > > > > > >>> If we knew which version of Tomcat 8 you were using, someone > could > > > look > > > > >>> at the relevant source code to try to figure out what was going > on. > > > > > I'm using tomcat version *8.0.20* > > > > > > > > >>Browse to the sourcecode of v8.0.20 of tomcat here: > > > > > > > > >> public TldResourcePath getTldResourcePath(String uri) { > > > > >> return getOptions().getTldCache().getTldResourcePath(uri); > > > > >> } > > > > Thanks for the quick response > > > > > > > > >> Obviously either getOptions() or getTldCache() is returning null. > > > > > > > > I debug the code as you suggest and found that getTldCache() is null. > > > > In the code As I understand there are 2 point which set the > *tldCache* > > > > variable > > > > one is the setTldCache() method and other is > > > > public static TldCache getInstance(ServletContext servletContext) { > > > > > > > > if (servletContext == null) { > > > > throw new IllegalArgumentException(Localizer.getMessage( > > > > > > > "org.apache.jasper.compiler.TldCache.servletContextNull")); > > > > } > > > > return (TldCache) > > > > servletContext.getAttribute(SERVLET_CONTEXT_ATTRIBUTE_NAME); > > > > } > > > > > > > > > > > > >>If you can attach a debugger try to see whether the code below is > > invoked: > > > > > > >>org.apache.jasper.servlet.JasperInitializer.onStartup(Set<Class<?>>, > > > >>ServletContext) { > > > >>..... > > > >> context.setAttribute(TldCache.SERVLET_CONTEXT_ATTRIBUTE_NAME, > > > >> new TldCache(context, > > scanner.getUriTldResourcePathMap(), > > > >> scanner.getTldResourcePathTaglibXmlMap())); > > > >> > > > >>} > > > I have checked that as well. But that method didn't get hot when I'm > > > debugging the source. > > > what could be the reason? > > > > >You wrote that you are running an embedded Tomcat. Is that true? > > >In Tomcat 8, Jasper initialization is implemented as a standard > > >ServletContainderInitializer (check Servlet specification). > > >So you should ensure > > >that org.apache.jasper.servlet.JasperInitializer.onStartup is invoked > > >during web app startup > > > > Could someone tell me how can I make sure that this method get call > during > > the web app startup? > > You didn't tell us whether you are embedding Tomcat or not. > If you are embedding it which jar files from Tomcat distribution you are > using etc. > You can start debugging > with org.apache.catalina.startup.ContextConfig.webConfig() > > - processServletContainerInitializers(sContext); > > Regards, > Violeta > > > > > Best Regards > > Thusitha > > > -- Thusitha Dayaratne Software Engineer WSO2 Inc. - lean . enterprise . middleware | wso2.com Mobile +94712756809 Blog alokayasoya.blogspot.com About http://about.me/thusithathilina