Hi,

>
> Hi Chris,
>
> Thanks a lot for the quick response. Please find inline answers.
>
> On 3/18/15 5:39 AM, Thusitha Thilina Dayaratne wrote:
> >> I'm in the process of migrating embedded tomcat 7.0.59 application
> >> to Tomcat 8.0.20. Tomcat is been bundle as a OSGI bundle. First I
> >> get a NullPointerException when trying to access the server home
> >> page. I fixed that manually setting an empty TldCache instance in
> >> the context as follows
> >>
> >> [snip]
> >>
> >>
> >> Now it is not throwing the NPE. but instead of that I'm getting
> >> following exception
> >>
> >> org.apache.jasper.JasperException: The absolute uri:
> >> http://tiles.apache.org/tags-tiles cannot be resolved in either
> >> web.xml or the jar files deployed with this application at
> >>
>
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:55)
>
> >I
> >>
> >looks like you are missing the Tiles JAR. Is it located in your
> >WEB-INF/lib directory?
> These jar files are located in a folder called plugins. We are reading
them
> from our JarScanner
>
> >> I'm also using a extended JarScanner as follows
>
> >>
> >> public class CarbonTomcatJarScanner extends StandardJarScanner{
>
> > Without trying to read and understand all this code, can you explain
> > why you are using your own JarScanner instead of Tomcat's? Perhaps
> > there is a way to do this where you don't need to write your own
> > JarScanner.
>
> According the servlet 3.0 spec, tldScanner classes are picked up
> during web-app load phase from
> the classPath using SPI mechanism. Normal sequence is to scan;
>  - WEB-INF/lib
>  - parent URL classPath
> However with the BundleClassLoader being the parent classLoader of
> Tomcat web-app classLoder, it fails to pick up
> TLD scanner references reside in plugins directory. That is why we
> have used a our own JarScanner
>
> >> It seems that this is relate to JarScanner. Can someone tell me
> >> what I have done wrong here? Or a way to fix this? Is this occur
> >> because I set TldCache manually?
>
> >I'm curious as to why the TldCache isn't being set up correctly in the
> >first place. In your other recent thread ("NPE in
> >JspCompilationContext.getTldResourcePath"), there were a couple of
> >questions from the community that it doesn't look like you have
> >answered. Perhaps answering those might help you solve both problems
> >at once.
> I'm not so quite sure about that. I manually set the TldCache and manually
> added the JasperInitializer to the StandardContext
> to get rid of the NPE
> I will try to answer the an answered questions in other thread.

>>You may want to have a look at Eclipse Gemini Web (OSGi Web Container
>>Reference Implementation)
>>>>Thanks for the reference. We are using eclipse equinox jasper. Could
that be a reason that TldCache not getting initialized?

I'm using In tomcat 7 when creating EmbeddedServletOptions (get call from
JspServlet init method) inside the constructor tldLocationsCache is
initiated as

tldLocationsCache = TldLocationsCache.getInstance(context);

in the getInstance method, if context don't have cache set it will set
a new empty cache and return that.

public static synchronized TldLocationsCache getInstance(
        ServletContext ctxt) {
    if (ctxt == null) {
        throw new IllegalArgumentException("ServletContext was null");
    }
    TldLocationsCache cache = (TldLocationsCache) ctxt.getAttribute(KEY);
    if (cache == null) {
        cache = new TldLocationsCache(ctxt);
        ctxt.setAttribute(KEY, cache);
    }
    return cache;
}

In tomcat 8 that method looks like follows. So if cache is not set at
the context then this will return null

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);
}

In my application I have 2 contexts. One is the StandardContext which
is created by the root app, and another context which is created by
equinox jasper.

I have manually added the SCI for the Tomcat OSGi bundle and then
TldCache is get initialized by the JasperInitializer onStartup method.

But how can I initialize the TldCache for jsp? ATM I manually set the
already initialized Tldcache for the jsp.


Can someone tell me what might be the issue here? What I've done wrong here?

In tomcat 7.0.59. We didn't use SCI to initialize the Jasper.


Thanks

Best Regards

/Thusitha


On Fri, Mar 20, 2015 at 1:55 PM, Thusitha Thilina Dayaratne <
thusit...@wso2.com> wrote:

> Hi,
>
> >
> > Hi Chris,
> >
> > Thanks a lot for the quick response. Please find inline answers.
> >
> > On 3/18/15 5:39 AM, Thusitha Thilina Dayaratne wrote:
> > >> I'm in the process of migrating embedded tomcat 7.0.59 application
> > >> to Tomcat 8.0.20. Tomcat is been bundle as a OSGI bundle. First I
> > >> get a NullPointerException when trying to access the server home
> > >> page. I fixed that manually setting an empty TldCache instance in
> > >> the context as follows
> > >>
> > >> [snip]
> > >>
> > >>
> > >> Now it is not throwing the NPE. but instead of that I'm getting
> > >> following exception
> > >>
> > >> org.apache.jasper.JasperException: The absolute uri:
> > >> http://tiles.apache.org/tags-tiles cannot be resolved in either
> > >> web.xml or the jar files deployed with this application at
> > >>
> >
>
> org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:55)
> >
> > >I
> > >>
> > >looks like you are missing the Tiles JAR. Is it located in your
> > >WEB-INF/lib directory?
> > These jar files are located in a folder called plugins. We are reading
> them
> > from our JarScanner
> >
> > >> I'm also using a extended JarScanner as follows
> >
> > >>
> > >> public class CarbonTomcatJarScanner extends StandardJarScanner{
> >
> > > Without trying to read and understand all this code, can you explain
> > > why you are using your own JarScanner instead of Tomcat's? Perhaps
> > > there is a way to do this where you don't need to write your own
> > > JarScanner.
> >
> > According the servlet 3.0 spec, tldScanner classes are picked up
> > during web-app load phase from
> > the classPath using SPI mechanism. Normal sequence is to scan;
> >  - WEB-INF/lib
> >  - parent URL classPath
> > However with the BundleClassLoader being the parent classLoader of
> > Tomcat web-app classLoder, it fails to pick up
> > TLD scanner references reside in plugins directory. That is why we
> > have used a our own JarScanner
> >
> > >> It seems that this is relate to JarScanner. Can someone tell me
> > >> what I have done wrong here? Or a way to fix this? Is this occur
> > >> because I set TldCache manually?
> >
> > >I'm curious as to why the TldCache isn't being set up correctly in the
> > >first place. In your other recent thread ("NPE in
> > >JspCompilationContext.getTldResourcePath"), there were a couple of
> > >questions from the community that it doesn't look like you have
> > >answered. Perhaps answering those might help you solve both problems
> > >at once.
> > I'm not so quite sure about that. I manually set the TldCache and
> manually
> > added the JasperInitializer to the StandardContext
> > to get rid of the NPE
> > I will try to answer the an answered questions in other thread.
>
> >>You may want to have a look at Eclipse Gemini Web (OSGi Web Container
> >>Reference Implementation)
> Thanks for the reference. We are using eclipse equinox jasper. Could that
> be a reason that TldCache not getting initialized?
>
> Thanks
> Best Regards
> /Thusitha
>
>
> On Fri, Mar 20, 2015 at 12:00 AM, Violeta Georgieva <miles...@gmail.com>
> wrote:
>
>> Hi,
>>
>> 2015-03-19 5:34 GMT+02:00 Thusitha Thilina Dayaratne <thusit...@wso2.com
>> >:
>> >
>> > Hi Chris,
>> >
>> > Thanks a lot for the quick response. Please find inline answers.
>> >
>> > On 3/18/15 5:39 AM, Thusitha Thilina Dayaratne wrote:
>> > >> I'm in the process of migrating embedded tomcat 7.0.59 application
>> > >> to Tomcat 8.0.20. Tomcat is been bundle as a OSGI bundle. First I
>> > >> get a NullPointerException when trying to access the server home
>> > >> page. I fixed that manually setting an empty TldCache instance in
>> > >> the context as follows
>> > >>
>> > >> [snip]
>> > >>
>> > >>
>> > >> Now it is not throwing the NPE. but instead of that I'm getting
>> > >> following exception
>> > >>
>> > >> org.apache.jasper.JasperException: The absolute uri:
>> > >> http://tiles.apache.org/tags-tiles cannot be resolved in either
>> > >> web.xml or the jar files deployed with this application at
>> > >>
>> >
>>
>> org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:55)
>> >
>> > >I
>> > >>
>> > >looks like you are missing the Tiles JAR. Is it located in your
>> > >WEB-INF/lib directory?
>> > These jar files are located in a folder called plugins. We are reading
>> them
>> > from our JarScanner
>> >
>> > >> I'm also using a extended JarScanner as follows
>> >
>> > >>
>> > >> public class CarbonTomcatJarScanner extends StandardJarScanner{
>> >
>> > > Without trying to read and understand all this code, can you explain
>> > > why you are using your own JarScanner instead of Tomcat's? Perhaps
>> > > there is a way to do this where you don't need to write your own
>> > > JarScanner.
>> >
>> > According the servlet 3.0 spec, tldScanner classes are picked up
>> > during web-app load phase from
>> > the classPath using SPI mechanism. Normal sequence is to scan;
>> >  - WEB-INF/lib
>> >  - parent URL classPath
>> > However with the BundleClassLoader being the parent classLoader of
>> > Tomcat web-app classLoder, it fails to pick up
>> > TLD scanner references reside in plugins directory. That is why we
>> > have used a our own JarScanner
>> >
>> > >> It seems that this is relate to JarScanner. Can someone tell me
>> > >> what I have done wrong here? Or a way to fix this? Is this occur
>> > >> because I set TldCache manually?
>> >
>> > >I'm curious as to why the TldCache isn't being set up correctly in the
>> > >first place. In your other recent thread ("NPE in
>> > >JspCompilationContext.getTldResourcePath"), there were a couple of
>> > >questions from the community that it doesn't look like you have
>> > >answered. Perhaps answering those might help you solve both problems
>> > >at once.
>> > I'm not so quite sure about that. I manually set the TldCache and
>> manually
>> > added the JasperInitializer to the StandardContext
>> > to get rid of the NPE
>> > I will try to answer the an answered questions in other thread.
>>
>> You may want to have a look at Eclipse Gemini Web (OSGi Web Container
>> Reference Implementation)
>>
>> Regards,
>> Violeta
>>
>> > Thanks
>> > 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
>
>


-- 
Thusitha Dayaratne
Software Engineer
WSO2 Inc. - lean . enterprise . middleware |  wso2.com

Mobile  +94712756809
Blog      alokayasoya.blogspot.com
About    http://about.me/thusithathilina

Reply via email to