2015-02-20 13:45 GMT+01:00 Marco Semiao <marco.sem...@gmail.com>:

> Hello, I just use this app :
>
> http://pukkaone.github.io/2010/12/22/jsp-precompile-application-start.html
>
> it's works with tomcat 5,6,7 but not tomcat 8.
>
> Because before, it's possibel to invoque RequestDispatcher into Listener
>
> Now, call RequestDispatcher throw NPE because the Map is empty.
>
> 2015-02-20 13:35 GMT+01:00 Konstantin Kolinko <knst.koli...@gmail.com>:
>
>> 2015-02-19 19:25 GMT+03:00 Marco Semiao <marco.sem...@gmail.com>:
>> > Hello,
>> >
>> > I use on my application a web listener ( ServletContextListener ) that
>> > allows you to compile jsp at startup .
>> >
>> > It does not work on Tomcat 8 in call :
>> > servletContext.getRequestDispatcher ( path);
>> >
>> >
>> > Here is the stack :
>> >
>> > org.apache.catalina.core.ApplicationContext.log Error during mapping
>> >  java.lang.NullPointerException
>> > at org.apache.catalina.mapper.Mapper.internalMapWrapper(Mapper.java:842)
>> > at org.apache.catalina.mapper.Mapper.map(Mapper.java:712)
>> > at
>> >
>> org.apache.catalina.core.ApplicationContext.getRequestDispatcher(ApplicationContext.java:503)
>> > at
>> >
>> org.apache.catalina.core.ApplicationContextFacade.getRequestDispatcher(ApplicationContextFacade.java:221)
>> > at
>> >
>> fr.ms.tomcat.servlet.listener.JspCompileRunnable.run(JspCompileRunnable.java:25)
>> >  This is occurs when the map contextObjectToContextVersionMap is still
>> null.
>> >
>> > It is enriched at the end of the boot StandardServer so after
>> initializing
>> > listeners .
>> >
>> > Thread [main] (Suspended (breakpoint at line 265 in Mapper))
>> > owns: MapperListener  (id=456)
>> > owns: StandardService  (id=457)
>> > owns: Object  (id=458)
>> > owns: StandardServer  (id=459)
>> > Mapper.addContextVersion(String, Host, String, String, Context,
>> String[],
>> > WebResourceRoot, Collection<WrapperMappingInfo>) line: 265
>> > MapperListener.registerContext(Context) line: 380
>> > MapperListener.registerHost(Host) line: 302
>> > MapperListener.startInternal() line: 110
>> > MapperListener(LifecycleBase).start() line: 150
>> > StandardService.startInternal() line: 450
>> > StandardService(LifecycleBase).start() line: 150
>> > StandardServer.startInternal() line: 769
>> > StandardServer(LifecycleBase).start() line: 150
>> > Catalina.start() line: 625
>> > NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not
>> > available [native method]
>> > NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57
>> > DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43
>> > Method.invoke(Object, Object...) line: 606
>> > Bootstrap.start() line: 351
>> > Bootstrap.main(String[]) line: 485
>> >
>> >
>> >
>> > it works fine with tomcat 5, 6 and 7.
>> >
>> >
>> > Environnement :
>> > apache- tomcat- 8.0.15 or apache -tomcat- 8.0.18
>> > Windows 8.1
>> > Java 7 update 75
>> >
>>
>> 1. Mailing list rules:
>> http://tomcat.apache.org/lists.html#tomcat-users
>> -> 6. Do not top-post.
>>
>> 2. What event is your listener listening for?
>>
>> If I am understanding you correctly, you are trying to perform a
>> request dispatch on a web application that has not started yet. This
>> is not going to work. The application that has not completed its
>> startup cannot serve requests.
>>
>> The NPE is ugly, an IllegalStateException would be better.
>> From the API specification [1] it looks that the
>> ServletContext.getRequestDispatcher() should return null in this
>> situation, but I think that will be as confusing as the current NPE.
>>
>> If you want the NPE to be changed, it would better to prepare some
>> source code that demonstrates the issue and open an issue in Bugzilla,
>>  but at this point I think it is a cosmetic issue and fixing it
>> wouldn't solve your problem.
>>
>> [1]
>> http://docs.oracle.com/javaee/7/api/javax/servlet/ServletContext.html#getRequestDispatcher%28java.lang.String%29
>>
>>
>> Best regards,
>> Konstantin Kolinko
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: dev-h...@tomcat.apache.org
>>
>>
>

Sorry really sorry for top post :(


http://pukkaone.github.io/2010/12/22/jsp-precompile-application-start.html

it's works with tomcat 5,6,7 but not tomcat 8.

Because before, it's possibel to invoque RequestDispatcher into Listener

Now, call RequestDispatcher throw NPE because the Map is empty.

Reply via email to