One more problem with GAE + Sitemesh

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

One more problem with GAE + Sitemesh

sudhir543-dev
Found one more problem with GAE + sitemesh..

I use sitemesh to decorate pages, the decorator is a jsp file..the pages which are being decorated are freemarker templates..
it's fine because sitemash just care about the HTML.

The setup runs fine on local environment.. where as when deployed to GAE it gives me this error..

javax.servlet.ServletContext log: Unhandled exception occurred whilst decorating page
java.lang.UnsupportedOperationException
at freemarker.ext.jsp.FreeMarkerJspFactory.releasePageContext(FreeMarkerJspFactory.java:41)
at org.apache.jsp.WEB_002dINF.decorators.default_002ddecorator_jsp._jspService(default_002ddecorator_jsp.java:99)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at org.mortbay.jetty.servlet.Dispatcher.include(Dispatcher.java:192)
at com.opensymphony.sitemesh.compatability.OldDecorator2NewDecorator.render(OldDecorator2NewDecorator.java:46)
at com.opensymphony.sitemesh.webapp.decorator.BaseWebAppDecorator.render(BaseWebAppDecorator.java:33)
at com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:84)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)

 Seems that app engine is doing some thing strange with FreeMarkerJspFactory or reusing it in someway which isn't expected.
   
Sudhir Nimavat
Senior software engineer.
Quick start global PVT LTD.
Baroda - 390007
Gujarat, India
http://www.ramanandi.org
Warning: Spelling errors in this message are the product of a poor school system. Pay teachers more than athletes..
 



------------------------------------------------------------------------------


_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: One more problem with GAE + Sitemesh

Attila Szegedi-3
It looks like you're mixing JSP and FreeMarker with JSP taglibs in the same project. This would ordinarily be fine, but it's failing for you... The reason it ordinarily works fine is that FreeMarker will only install FreeMarkerJspFactory as a fallback JspFactory, provided for taglibs in case there's no other JspFactory implementation in the servlet container. The initialization code in FreeMarkerPageContext is this:

    static {
        if(JspFactory.getDefaultFactory() == null) {
            JspFactory.setDefaultFactory(new FreeMarkerJspFactory21());
        }
        logger.debug("Using JspFactory implementation class " + 
                JspFactory.getDefaultFactory().getClass().getName());
    }

This means that FreeMarkerJspFactory won't even get installed if there's another JspFactory already installed. I wonder why is Jetty not installing its own JspFactory for JSP pages. Can you try triggering Jetty into installing its own JspFactory first? Like, ensuring a JSP page is rendered before FreeMarker JSP support is being used? Would that solve the problem? If yes, we can think of how to move forward.

FWIW, the definition for the getPageContext() and releasePageContext are indeed this:

    public PageContext getPageContext(Servlet servlet, ServletRequest request, 
            ServletResponse response, String errorPageURL, 
            boolean needsSession, int bufferSize, boolean autoFlush) {
        // This is never meant to be called. JSP pages compiled to Java 
        // bytecode use this API, but in FreeMarker, we're running templates,
        // and not JSP pages precompiled to bytecode, therefore we have no use
        // for this API.
        throw new UnsupportedOperationException();
    }

    public void releasePageContext(PageContext ctx) {
        // This is never meant to be called. JSP pages compiled to Java 
        // bytecode use this API, but in FreeMarker, we're running templates,
        // and not JSP pages precompiled to bytecode, therefore we have no use
        // for this API.
        throw new UnsupportedOperationException();
    }

Note the comments explaining the reason for UnsupportedOperationException() -- these are never meant to be called from templates. 
Now, what's *really* strange is that your precompiled JSP page named "org.apache.jsp.WEB_002dINF.decorators.default_002ddecorator_jsp._jspService" is not calling getPageContext() first and getting an exception on that...

Attila.

On 2010.05.10., at 11:37, [hidden email] wrote:

Found one more problem with GAE + sitemesh..

I use sitemesh to decorate pages, the decorator is a jsp file..the pages which are being decorated are freemarker templates.. 
it's fine because sitemash just care about the HTML.

The setup runs fine on local environment.. where as when deployed to GAE it gives me this error..

javax.servlet.ServletContext log: Unhandled exception occurred whilst decorating page
java.lang.UnsupportedOperationException
at freemarker.ext.jsp.FreeMarkerJspFactory.releasePageContext(FreeMarkerJspFactory.java:41)
at org.apache.jsp.WEB_002dINF.decorators.default_002ddecorator_jsp._jspService(default_002ddecorator_jsp.java:99)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at org.mortbay.jetty.servlet.Dispatcher.include(Dispatcher.java:192)
at com.opensymphony.sitemesh.compatability.OldDecorator2NewDecorator.render(OldDecorator2NewDecorator.java:46)
at com.opensymphony.sitemesh.webapp.decorator.BaseWebAppDecorator.render(BaseWebAppDecorator.java:33)
at com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:84)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)

 Seems that app engine is doing some thing strange with FreeMarkerJspFactory or reusing it in someway which isn't expected.
   
Sudhir Nimavat
Senior software engineer. 
Quick start global PVT LTD.
Baroda - 390007

------------------------------------------------------------------------------


_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: One more problem with GAE + Sitemesh

sudhir543-dev
Yeah, tried and it works.. I created a hello.jsp. After deploying the application, accessed hello.jsp before calling any other URL that would render ftl.
And yes, after that everything else works..

What could be the permanent solution of this ? May be this is a bug with jetty implementation on GAE.
 
   
Sudhir Nimavat
Senior software engineer.
Quick start global PVT LTD.
Baroda - 390007
Gujarat, India
http://www.ramanandi.org
Warning: Spelling errors in this message are the product of a poor school system. Pay teachers more than athletes..
 



From: Attila Szegedi <[hidden email]>
To: FreeMarker-devel <[hidden email]>
Cc: freemarker <[hidden email]>
Sent: Mon, 10 May, 2010 3:46:42 PM
Subject: Re: [FreeMarker-user] [Freemarker-devel] One more problem with GAE + Sitemesh

It looks like you're mixing JSP and FreeMarker with JSP taglibs in the same project. This would ordinarily be fine, but it's failing for you... The reason it ordinarily works fine is that FreeMarker will only install FreeMarkerJspFactory as a fallback JspFactory, provided for taglibs in case there's no other JspFactory implementation in the servlet container. The initialization code in FreeMarkerPageContext is this:

    static {
        if(JspFactory.getDefaultFactory() == null) {
            JspFactory.setDefaultFactory(new FreeMarkerJspFactory21());
        }
        logger.debug("Using JspFactory implementation class " + 
                JspFactory.getDefaultFactory().getClass().getName());
    }

This means that FreeMarkerJspFactory won't even get installed if there's another JspFactory already installed. I wonder why is Jetty not installing its own JspFactory for JSP pages. Can you try triggering Jetty into installing its own JspFactory first? Like, ensuring a JSP page is rendered before FreeMarker JSP support is being used? Would that solve the problem? If yes, we can think of how to move forward.

FWIW, the definition for the getPageContext() and releasePageContext are indeed this:

    public PageContext getPageContext(Servlet servlet, ServletRequest request, 
            ServletResponse response, String errorPageURL, 
            boolean needsSession, int bufferSize, boolean autoFlush) {
        // This is never meant to be called. JSP pages compiled to Java 
        // bytecode use this API, but in FreeMarker, we're running templates,
        // and not JSP pages precompiled to bytecode, therefore we have no use
        // for this API.
        throw new UnsupportedOperationException();
    }

    public void releasePageContext(PageContext ctx) {
        // This is never meant to be called. JSP pages compiled to Java 
        // bytecode use this API, but in FreeMarker, we're running templates,
        // and not JSP pages precompiled to bytecode, therefore we have no use
        // for this API.
        throw new UnsupportedOperationException();
    }

Note the comments explaining the reason for UnsupportedOperationException() -- these are never meant to be called from templates. 
Now, what's *really* strange is that your precompiled JSP page named "org.apache.jsp.WEB_002dINF.decorators.default_002ddecorator_jsp._jspService" is not calling getPageContext() first and getting an exception on that...

Attila.

On 2010.05.10., at 11:37, [hidden email] wrote:

Found one more problem with GAE + sitemesh..

I use sitemesh to decorate pages, the decorator is a jsp file..the pages which are being decorated are freemarker templates.. 
it's fine because sitemash just care about the HTML.

The setup runs fine on local environment.. where as when deployed to GAE it gives me this error..

javax.servlet.ServletContext log: Unhandled exception occurred whilst decorating page
java.lang.UnsupportedOperationException
at freemarker.ext.jsp.FreeMarkerJspFactory.releasePageContext(FreeMarkerJspFactory.java:41)
at org.apache.jsp.WEB_002dINF.decorators.default_002ddecorator_jsp._jspService(default_002ddecorator_jsp.java:99)
at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at org.mortbay.jetty.servlet.Dispatcher.include(Dispatcher.java:192)
at com.opensymphony.sitemesh.compatability.OldDecorator2NewDecorator.render(OldDecorator2NewDecorator.java:46)
at com.opensymphony.sitemesh.webapp.decorator.BaseWebAppDecorator.render(BaseWebAppDecorator.java:33)
at
com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:84)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)

 Seems that app engine is doing some thing strange with FreeMarkerJspFactory or reusing it in someway which isn't expected.
   
Sudhir Nimavat
Senior software engineer. 
Quick start global PVT LTD.
Baroda - 390007


------------------------------------------------------------------------------


_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

RE One more problem with GAE + Sitemesh

sudhir543-dev
Any comments on permanent solution !
 
   
Sudhir Nimavat
Senior software engineer.
Quick start global PVT LTD.
Baroda - 390007
Gujarat, India
http://www.ramanandi.org
Warning: Spelling errors in this message are the product of a poor school system. Pay teachers more than athletes..
 



From: "[hidden email]" <[hidden email]>
To: FreeMarker-user <[hidden email]>
Cc: freemarker devel <[hidden email]>
Sent: Mon, 10 May, 2010 4:44:39 PM
Subject: Re: [Freemarker-devel] One more problem with GAE + Sitemesh

Yeah, tried and it works.. I created a hello.jsp. After deploying the application, accessed hello.jsp before calling any other URL that would render ftl.
And yes, after that everything else works..

What could be the permanent solution of this ? May be this is a bug with jetty implementation on GAE.
 
   
Sudhir Nimavat
Senior software engineer.
Quick start global PVT LTD.
Baroda - 390007
Gujarat, India
http://www.ramanandi.org
Warning: Spelling errors in this message are the product of a poor school system. Pay teachers more than athletes..
 



From: Attila Szegedi <[hidden email]>
To: FreeMarker-devel <[hidden email]>
Cc: freemarker <[hidden email]>
Sent: Mon, 10 May, 2010 3:46:42 PM
Subject: Re: [FreeMarker-user] [Freemarker-devel] One more problem with GAE + Sitemesh

It looks like you're mixing JSP and FreeMarker with JSP taglibs in the same project. This would ordinarily be fine, but it's failing for you... The reason it ordinarily works fine is that FreeMarker will only install FreeMarkerJspFactory as a fallback JspFactory, provided for taglibs in case there's no other JspFactory implementation in the servlet container. The initialization code in FreeMarkerPageContext is this:

    static {
        if(JspFactory.getDefaultFactory() == null) {
            JspFactory.setDefaultFactory(new FreeMarkerJspFactory21());
        }
        logger.debug("Using JspFactory implementation class " + 
                JspFactory.getDefaultFactory().getClass().getName());
    }

This means that FreeMarkerJspFactory won't even get installed if there's another JspFactory already installed. I wonder why is Jetty not installing its own JspFactory for JSP pages. Can you try triggering Jetty into installing its own JspFactory first? Like, ensuring a JSP page is rendered before FreeMarker JSP support is being used? Would that solve the problem? If yes, we can think of how to move forward.

FWIW, the definition for the getPageContext() and releasePageContext are indeed this:

    public PageContext getPageContext(Servlet servlet, ServletRequest request, 
            ServletResponse response, String errorPageURL, 
            boolean needsSession, int bufferSize, boolean autoFlush) {
        // This is never meant to be called. JSP pages compiled to Java 
        // bytecode use this API, but in FreeMarker, we're running templates,
        // and not JSP pages precompiled to bytecode, therefore we have no use
        // for this API.
        throw new UnsupportedOperationException();
    }

    public void releasePageContext(PageContext ctx) {
        // This is never meant to be called. JSP pages compiled to Java 
        // bytecode use this API, but in FreeMarker, we're running templates,
        // and not JSP pages precompiled to bytecode, therefore we have no use
        // for this API.
        throw new UnsupportedOperationException();
    }

Note the comments explaining the reason for UnsupportedOperationException() -- these are never meant to be called from templates. 
Now, what's *really* strange is that your precompiled JSP page named "org.apache.jsp.WEB_002dINF.decorators.default_002ddecorator_jsp._jspService" is not calling getPageContext() first and getting an exception on that...

Attila.

On 2010.05.10., at 11:37, [hidden email] wrote:

Found one more problem with GAE + sitemesh..

I use sitemesh to decorate pages, the decorator is a jsp file..the pages which are being decorated are freemarker templates.. 
it's fine because sitemash just care about the HTML.

The setup runs fine on local environment.. where as when deployed to GAE it gives me this error..

javax.servlet.ServletContext log: Unhandled exception occurred whilst decorating page
java.lang.UnsupportedOperationException
at freemarker.ext.jsp.FreeMarkerJspFactory.releasePageContext(FreeMarkerJspFactory.java:41)
at org.apache.jsp.WEB_002dINF.decorators.default_002ddecorator_jsp._jspService(default_002ddecorator_jsp.java:99)
at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at org.mortbay.jetty.servlet.Dispatcher.include(Dispatcher.java:192)
at com.opensymphony.sitemesh.compatability.OldDecorator2NewDecorator.render(OldDecorator2NewDecorator.java:46)
at com.opensymphony.sitemesh.webapp.decorator.BaseWebAppDecorator.render(BaseWebAppDecorator.java:33)
at
com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:84)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)

 Seems that app engine is doing some thing strange with FreeMarkerJspFactory or reusing it in someway which isn't expected.
   
Sudhir Nimavat
Senior software engineer. 
Quick start global PVT LTD.
Baroda - 390007



------------------------------------------------------------------------------


_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: RE One more problem with GAE + Sitemesh

sudhir543-dev
Filed a bug on gae
http://code.google.com/p/googleappengine/issues/detail?id=3252

Attila, do you have any comments for solution from our side ?
 
   
Sudhir Nimavat
Senior software engineer.
Quick start global PVT LTD.
Baroda - 390007
Gujarat, India
http://www.ramanandi.org
Warning: Spelling errors in this message are the product of a poor school system. Pay teachers more than athletes..
 



From: "[hidden email]" <[hidden email]>
To: FreeMarker-devel <[hidden email]>
Cc: freemarker <[hidden email]>
Sent: Tue, 11 May, 2010 8:05:10 PM
Subject: [Freemarker-devel] RE One more problem with GAE + Sitemesh

Any comments on permanent solution !
 
   
Sudhir Nimavat
Senior software engineer.
Quick start global PVT LTD.
Baroda - 390007
Gujarat, India
http://www.ramanandi.org
Warning: Spelling errors in this message are the product of a poor school system. Pay teachers more than athletes..
 



From: "[hidden email]" <[hidden email]>
To: FreeMarker-user <[hidden email]>
Cc: freemarker devel <[hidden email]>
Sent: Mon, 10 May, 2010 4:44:39 PM
Subject: Re: [Freemarker-devel] One more problem with GAE + Sitemesh

Yeah, tried and it works.. I created a hello.jsp. After deploying the application, accessed hello.jsp before calling any other URL that would render ftl.
And yes, after that everything else works..

What could be the permanent solution of this ? May be this is a bug with jetty implementation on GAE.
 
   
Sudhir Nimavat
Senior software engineer.
Quick start global PVT LTD.
Baroda - 390007
Gujarat, India
http://www.ramanandi.org
Warning: Spelling errors in this message are the product of a poor school system. Pay teachers more than athletes..
 



From: Attila Szegedi <[hidden email]>
To: FreeMarker-devel <[hidden email]>
Cc: freemarker <[hidden email]>
Sent: Mon, 10 May, 2010 3:46:42 PM
Subject: Re: [FreeMarker-user] [Freemarker-devel] One more problem with GAE + Sitemesh

It looks like you're mixing JSP and FreeMarker with JSP taglibs in the same project. This would ordinarily be fine, but it's failing for you... The reason it ordinarily works fine is that FreeMarker will only install FreeMarkerJspFactory as a fallback JspFactory, provided for taglibs in case there's no other JspFactory implementation in the servlet container. The initialization code in FreeMarkerPageContext is this:

    static {
        if(JspFactory.getDefaultFactory() == null) {
            JspFactory.setDefaultFactory(new FreeMarkerJspFactory21());
        }
        logger.debug("Using JspFactory implementation class " + 
                JspFactory.getDefaultFactory().getClass().getName());
    }

This means that FreeMarkerJspFactory won't even get installed if there's another JspFactory already installed. I wonder why is Jetty not installing its own JspFactory for JSP pages. Can you try triggering Jetty into installing its own JspFactory first? Like, ensuring a JSP page is rendered before FreeMarker JSP support is being used? Would that solve the problem? If yes, we can think of how to move forward.

FWIW, the definition for the getPageContext() and releasePageContext are indeed this:

    public PageContext getPageContext(Servlet servlet, ServletRequest request, 
            ServletResponse response, String errorPageURL, 
            boolean needsSession, int bufferSize, boolean autoFlush) {
        // This is never meant to be called. JSP pages compiled to Java 
        // bytecode use this API, but in FreeMarker, we're running templates,
        // and not JSP pages precompiled to bytecode, therefore we have no use
        // for this API.
        throw new UnsupportedOperationException();
    }

    public void releasePageContext(PageContext ctx) {
        // This is never meant to be called. JSP pages compiled to Java 
        // bytecode use this API, but in FreeMarker, we're running templates,
        // and not JSP pages precompiled to bytecode, therefore we have no use
        // for this API.
        throw new UnsupportedOperationException();
    }

Note the comments explaining the reason for UnsupportedOperationException() -- these are never meant to be called from templates. 
Now, what's *really* strange is that your precompiled JSP page named "org.apache.jsp.WEB_002dINF.decorators.default_002ddecorator_jsp._jspService" is not calling getPageContext() first and getting an exception on that...

Attila.

On 2010.05.10., at 11:37, [hidden email] wrote:

Found one more problem with GAE + sitemesh..

I use sitemesh to decorate pages, the decorator is a jsp file..the pages which are being decorated are freemarker templates.. 
it's fine because sitemash just care about the HTML.

The setup runs fine on local environment.. where as when deployed to GAE it gives me this error..

javax.servlet.ServletContext log: Unhandled exception occurred whilst decorating page
java.lang.UnsupportedOperationException
at freemarker.ext.jsp.FreeMarkerJspFactory.releasePageContext(FreeMarkerJspFactory.java:41)
at org.apache.jsp.WEB_002dINF.decorators.default_002ddecorator_jsp._jspService(default_002ddecorator_jsp.java:99)
at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at org.mortbay.jetty.servlet.Dispatcher.include(Dispatcher.java:192)
at com.opensymphony.sitemesh.compatability.OldDecorator2NewDecorator.render(OldDecorator2NewDecorator.java:46)
at com.opensymphony.sitemesh.webapp.decorator.BaseWebAppDecorator.render(BaseWebAppDecorator.java:33)
at
com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:84)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)

 Seems that app engine is doing some thing strange with FreeMarkerJspFactory or reusing it in someway which isn't expected.
   
Sudhir Nimavat
Senior software engineer. 
Quick start global PVT LTD.
Baroda - 390007




------------------------------------------------------------------------------


_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: RE One more problem with GAE + Sitemesh

Attila Szegedi-3
Unfortunately, this is not a bug in any particular implementation of anything. This is a flaw in the design of the JSP specification, because it prescribes that the JSP factory needs to be a singleton. The only thing I can imagine is that I could add awareness of a system property, i.e. "freemarker.jsp.dontSetJspFactory", so if you set it to true, i.e. "-Dfreemarker.jsp.dontSetJspFactory=true" then FreeMarker will never install its own JSP factory. This won't be a 100% solution either, because with it, if your app's client requested a FreeMarker page with a JSP taglib that needs a JspFactory, and it is requested before any real Jetty rendered JSP page, then now in turn that will fail. It's a tradeoff. 

Can you set system properties in your GAE app? 

I know - it's not too pretty to rely on system properties, but OTOH, this is a singleton problem we're trying to work around, so I can only fight a global dependency problem with a global setting...

Let me know if that would be acceptable.

Attila.

--
On 2010.05.23., at 9:32, [hidden email] wrote:

Filed a bug on gae 
http://code.google.com/p/googleappengine/issues/detail?id=3252

Attila, do you have any comments for solution from our side ?
 
   
Sudhir Nimavat
Senior software engineer. 
Quick start global PVT LTD.
Baroda - 390007
Gujarat, India
http://www.ramanandi.org
Warning: Spelling errors in this message are the product of a poor school system. Pay teachers more than athletes..
 



From: "[hidden email]" <[hidden email]>
To: FreeMarker-devel <[hidden email]>
Cc: freemarker <[hidden email]>
Sent: Tue, 11 May, 2010 8:05:10 PM
Subject: [Freemarker-devel] RE One more problem with GAE + Sitemesh

Any comments on permanent solution !
 
   
Sudhir Nimavat
Senior software engineer. 
Quick start global PVT LTD.
Baroda - 390007
Gujarat, India
http://www.ramanandi.org
Warning: Spelling errors in this message are the product of a poor school system. Pay teachers more than athletes..
 



From: "[hidden email]" <[hidden email]>
To: FreeMarker-user <[hidden email]>
Cc: freemarker devel <[hidden email]>
Sent: Mon, 10 May, 2010 4:44:39 PM
Subject: Re: [Freemarker-devel] One more problem with GAE + Sitemesh

Yeah, tried and it works.. I created a hello.jsp. After deploying the application, accessed hello.jsp before calling any other URL that would render ftl.
And yes, after that everything else works.. 

What could be the permanent solution of this ? May be this is a bug with jetty implementation on GAE.
 
   
Sudhir Nimavat
Senior software engineer. 
Quick start global PVT LTD.
Baroda - 390007
Gujarat, India
http://www.ramanandi.org
Warning: Spelling errors in this message are the product of a poor school system. Pay teachers more than athletes..
 



From: Attila Szegedi <[hidden email]>
To: FreeMarker-devel <[hidden email]>
Cc: freemarker <[hidden email]>
Sent: Mon, 10 May, 2010 3:46:42 PM
Subject: Re: [FreeMarker-user] [Freemarker-devel] One more problem with GAE + Sitemesh

It looks like you're mixing JSP and FreeMarker with JSP taglibs in the same project. This would ordinarily be fine, but it's failing for you... The reason it ordinarily works fine is that FreeMarker will only install FreeMarkerJspFactory as a fallback JspFactory, provided for taglibs in case there's no other JspFactory implementation in the servlet container. The initialization code in FreeMarkerPageContext is this:

    static {
        if(JspFactory.getDefaultFactory() == null) {
            JspFactory.setDefaultFactory(new FreeMarkerJspFactory21());
        }
        logger.debug("Using JspFactory implementation class " + 
                JspFactory.getDefaultFactory().getClass().getName());
    }

This means that FreeMarkerJspFactory won't even get installed if there's another JspFactory already installed. I wonder why is Jetty not installing its own JspFactory for JSP pages. Can you try triggering Jetty into installing its own JspFactory first? Like, ensuring a JSP page is rendered before FreeMarker JSP support is being used? Would that solve the problem? If yes, we can think of how to move forward.

FWIW, the definition for the getPageContext() and releasePageContext are indeed this:

    public PageContext getPageContext(Servlet servlet, ServletRequest request, 
            ServletResponse response, String errorPageURL, 
            boolean needsSession, int bufferSize, boolean autoFlush) {
        // This is never meant to be called. JSP pages compiled to Java 
        // bytecode use this API, but in FreeMarker, we're running templates,
        // and not JSP pages precompiled to bytecode, therefore we have no use
        // for this API.
        throw new UnsupportedOperationException();
    }

    public void releasePageContext(PageContext ctx) {
        // This is never meant to be called. JSP pages compiled to Java 
        // bytecode use this API, but in FreeMarker, we're running templates,
        // and not JSP pages precompiled to bytecode, therefore we have no use
        // for this API.
        throw new UnsupportedOperationException();
    }

Note the comments explaining the reason for UnsupportedOperationException() -- these are never meant to be called from templates. 
Now, what's *really* strange is that your precompiled JSP page named "org.apache.jsp.WEB_002dINF.decorators.default_002ddecorator_jsp._jspService" is not calling getPageContext() first and getting an exception on that...

Attila.

On 2010.05.10., at 11:37, [hidden email] wrote:

Found one more problem with GAE + sitemesh..

I use sitemesh to decorate pages, the decorator is a jsp file..the pages which are being decorated are freemarker templates.. 
it's fine because sitemash just care about the HTML.

The setup runs fine on local environment.. where as when deployed to GAE it gives me this error..

javax.servlet.ServletContext log: Unhandled exception occurred whilst decorating page
java.lang.UnsupportedOperationException
at freemarker.ext.jsp.FreeMarkerJspFactory.releasePageContext(FreeMarkerJspFactory.java:41)
at org.apache.jsp.WEB_002dINF.decorators.default_002ddecorator_jsp._jspService(default_002ddecorator_jsp.java:99)
at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at org.mortbay.jetty.servlet.Dispatcher.include(Dispatcher.java:192)
at com.opensymphony.sitemesh.compatability.OldDecorator2NewDecorator.render(OldDecorator2NewDecorator.java:46)
at com.opensymphony.sitemesh.webapp.decorator.BaseWebAppDecorator.render(BaseWebAppDecorator.java:33)
at
com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:84)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)

 Seems that app engine is doing some thing strange with FreeMarkerJspFactory or reusing it in someway which isn't expected.
   
Sudhir Nimavat
Senior software engineer. 
Quick start global PVT LTD.
Baroda - 390007

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: RE One more problem with GAE + Sitemesh

sudhir543-dev
I will have a look at if it's possible to set a system property on GAE..
But does any one know, is this a problem with GAE only, or does it happen with every other servers as well?


Thanks
SN
 
   
Sudhir Nimavat
Senior software engineer.
Quick start global PVT LTD.
Baroda - 390007
Gujarat, India
http://www.ramanandi.org
Warning: Spelling errors in this message are the product of a poor school system. Pay teachers more than athletes..
 



From: Attila Szegedi <[hidden email]>
To: FreeMarker-devel <[hidden email]>
Sent: Sun, 6 June, 2010 3:11:49 PM
Subject: Re: [Freemarker-devel] RE One more problem with GAE + Sitemesh

Unfortunately, this is not a bug in any particular implementation of anything. This is a flaw in the design of the JSP specification, because it prescribes that the JSP factory needs to be a singleton. The only thing I can imagine is that I could add awareness of a system property, i.e. "freemarker.jsp.dontSetJspFactory", so if you set it to true, i.e. "-Dfreemarker.jsp.dontSetJspFactory=true" then FreeMarker will never install its own JSP factory. This won't be a 100% solution either, because with it, if your app's client requested a FreeMarker page with a JSP taglib that needs a JspFactory, and it is requested before any real Jetty rendered JSP page, then now in turn that will fail. It's a tradeoff. 

Can you set system properties in your GAE app? 

I know - it's not too pretty to rely on system properties, but OTOH, this is a singleton problem we're trying to work around, so I can only fight a global dependency problem with a global setting...

Let me know if that would be acceptable.

Attila.

--
On 2010.05.23., at 9:32, [hidden email] wrote:

Filed a bug on gae 
http://code.google.com/p/googleappengine/issues/detail?id=3252

Attila, do you have any comments for solution from our side ?
 
   
Sudhir Nimavat
Senior software engineer. 
Quick start global PVT LTD.
Baroda - 390007
Gujarat, India
http://www.ramanandi.org
Warning: Spelling errors in this message are the product of a poor school system. Pay teachers more than athletes..
 



From: "[hidden email]" <[hidden email]>
To: FreeMarker-devel <[hidden email]>
Cc: freemarker <[hidden email]>
Sent: Tue, 11 May, 2010 8:05:10 PM
Subject: [Freemarker-devel] RE One more problem with GAE + Sitemesh

Any comments on permanent solution !
 
   
Sudhir Nimavat
Senior software engineer. 
Quick start global PVT LTD.
Baroda - 390007
Gujarat, India
http://www.ramanandi.org
Warning: Spelling errors in this message are the product of a poor school system. Pay teachers more than athletes..
 



From: "[hidden email]" <[hidden email]>
To: FreeMarker-user <[hidden email]>
Cc: freemarker devel <[hidden email]>
Sent: Mon, 10 May, 2010 4:44:39 PM
Subject: Re: [Freemarker-devel] One more problem with GAE + Sitemesh

Yeah, tried and it works.. I created a hello.jsp. After deploying the application, accessed hello.jsp before calling any other URL that would render ftl.
And yes, after that everything else works.. 

What could be the permanent solution of this ? May be this is a bug with jetty implementation on GAE.
 
   
Sudhir Nimavat
Senior software engineer. 
Quick start global PVT LTD.
Baroda - 390007
Gujarat, India
http://www.ramanandi.org
Warning: Spelling errors in this message are the product of a poor school system. Pay teachers more than athletes..
 



From: Attila Szegedi <[hidden email]>
To: FreeMarker-devel <[hidden email]>
Cc: freemarker <[hidden email]>
Sent: Mon, 10 May, 2010 3:46:42 PM
Subject: Re: [FreeMarker-user] [Freemarker-devel] One more problem with GAE + Sitemesh

It looks like you're mixing JSP and FreeMarker with JSP taglibs in the same project. This would ordinarily be fine, but it's failing for you... The reason it ordinarily works fine is that FreeMarker will only install FreeMarkerJspFactory as a fallback JspFactory, provided for taglibs in case there's no other JspFactory implementation in the servlet container. The initialization code in FreeMarkerPageContext is this:

    static {
        if(JspFactory.getDefaultFactory() == null) {
            JspFactory.setDefaultFactory(new FreeMarkerJspFactory21());
        }
        logger.debug("Using JspFactory implementation class " + 
                JspFactory.getDefaultFactory().getClass().getName());
    }

This means that FreeMarkerJspFactory won't even get installed if there's another JspFactory already installed. I wonder why is Jetty not installing its own JspFactory for JSP pages. Can you try triggering Jetty into installing its own JspFactory first? Like, ensuring a JSP page is rendered before FreeMarker JSP support is being used? Would that solve the problem? If yes, we can think of how to move forward.

FWIW, the definition for the getPageContext() and releasePageContext are indeed this:

    public PageContext getPageContext(Servlet servlet, ServletRequest request, 
            ServletResponse response, String errorPageURL, 
            boolean needsSession, int bufferSize, boolean autoFlush) {
        // This is never meant to be called. JSP pages compiled to Java 
        // bytecode use this API, but in FreeMarker, we're running templates,
        // and not JSP pages precompiled to bytecode, therefore we have no use
        // for this API.
        throw new UnsupportedOperationException();
    }

    public void releasePageContext(PageContext ctx) {
        // This is never meant to be called. JSP pages compiled to Java 
        // bytecode use this API, but in FreeMarker, we're running templates,
        // and not JSP pages precompiled to bytecode, therefore we have no use
        // for this API.
        throw new UnsupportedOperationException();
    }

Note the comments explaining the reason for UnsupportedOperationException() -- these are never meant to be called from templates. 
Now, what's *really* strange is that your precompiled JSP page named "org.apache.jsp.WEB_002dINF.decorators.default_002ddecorator_jsp._jspService" is not calling getPageContext() first and getting an exception on that...

Attila.

On 2010.05.10., at 11:37, [hidden email] wrote:

Found one more problem with GAE + sitemesh..

I use sitemesh to decorate pages, the decorator is a jsp file..the pages which are being decorated are freemarker templates.. 
it's fine because sitemash just care about the HTML.

The setup runs fine on local environment.. where as when deployed to GAE it gives me this error..

javax.servlet.ServletContext log: Unhandled exception occurred
 whilst decorating page
java.lang.UnsupportedOperationException
at freemarker.ext.jsp.FreeMarkerJspFactory.releasePageContext(FreeMarkerJspFactory.java:41)
at org.apache.jsp.WEB_002dINF.decorators.default_002ddecorator_jsp._jspService(default_002ddecorator_jsp.java:99)
at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at org.mortbay.jetty.servlet.Dispatcher.include(Dispatcher.java:192)
at com.opensymphony.sitemesh.compatability.OldDecorator2NewDecorator.render(OldDecorator2NewDecorator.java:46)
at com.opensymphony.sitemesh.webapp.decorator.BaseWebAppDecorator.render(BaseWebAppDecorator.java:33)
at
com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:84)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)

 Seems that app engine is doing some thing strange with FreeMarkerJspFactory or reusing it in someway which isn't expected.
   
Sudhir Nimavat
Senior software engineer. 
Quick start global PVT LTD.
Baroda - 390007


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: RE One more problem with GAE + Sitemesh

Attila Szegedi-3
As I said, it is a - what I consider a - flaw in the JSP spec, in that it relies on static singletons. It can happen with every servlet container that lazily initializes its JspFactory. Those that eagerly initialize it (I have no idea which, if any, do that) will not have this problem.

Attila.

On 2010.06.07., at 7:50, [hidden email] wrote:

I will have a look at if it's possible to set a system property on GAE.. 
But does any one know, is this a problem with GAE only, or does it happen with every other servers as well?


Thanks
SN
 
   
Sudhir Nimavat
Senior software engineer. 
Quick start global PVT LTD.
Baroda - 390007
Gujarat, India
http://www.ramanandi.org
Warning: Spelling errors in this message are the product of a poor school system. Pay teachers more than athletes..
 



From: Attila Szegedi <[hidden email]>
To: FreeMarker-devel <[hidden email]>
Sent: Sun, 6 June, 2010 3:11:49 PM
Subject: Re: [Freemarker-devel] RE One more problem with GAE + Sitemesh

Unfortunately, this is not a bug in any particular implementation of anything. This is a flaw in the design of the JSP specification, because it prescribes that the JSP factory needs to be a singleton. The only thing I can imagine is that I could add awareness of a system property, i.e. "freemarker.jsp.dontSetJspFactory", so if you set it to true, i.e. "-Dfreemarker.jsp.dontSetJspFactory=true" then FreeMarker will never install its own JSP factory. This won't be a 100% solution either, because with it, if your app's client requested a FreeMarker page with a JSP taglib that needs a JspFactory, and it is requested before any real Jetty rendered JSP page, then now in turn that will fail. It's a tradeoff. 

Can you set system properties in your GAE app? 

I know - it's not too pretty to rely on system properties, but OTOH, this is a singleton problem we're trying to work around, so I can only fight a global dependency problem with a global setting...

Let me know if that would be acceptable.

Attila.

--
On 2010.05.23., at 9:32, [hidden email] wrote:

Filed a bug on gae 
http://code.google.com/p/googleappengine/issues/detail?id=3252

Attila, do you have any comments for solution from our side ?
 
   
Sudhir Nimavat
Senior software engineer. 
Quick start global PVT LTD.
Baroda - 390007
Gujarat, India
http://www.ramanandi.org
Warning: Spelling errors in this message are the product of a poor school system. Pay teachers more than athletes..
 



From: "[hidden email]" <[hidden email]>
To: FreeMarker-devel <[hidden email]>
Cc: freemarker <[hidden email]>
Sent: Tue, 11 May, 2010 8:05:10 PM
Subject: [Freemarker-devel] RE One more problem with GAE + Sitemesh

Any comments on permanent solution !
 
   
Sudhir Nimavat
Senior software engineer. 
Quick start global PVT LTD.
Baroda - 390007
Gujarat, India
http://www.ramanandi.org
Warning: Spelling errors in this message are the product of a poor school system. Pay teachers more than athletes..
 



From: "[hidden email]" <[hidden email]>
To: FreeMarker-user <[hidden email]>
Cc: freemarker devel <[hidden email]>
Sent: Mon, 10 May, 2010 4:44:39 PM
Subject: Re: [Freemarker-devel] One more problem with GAE + Sitemesh

Yeah, tried and it works.. I created a hello.jsp. After deploying the application, accessed hello.jsp before calling any other URL that would render ftl.
And yes, after that everything else works.. 

What could be the permanent solution of this ? May be this is a bug with jetty implementation on GAE.
 
   
Sudhir Nimavat
Senior software engineer. 
Quick start global PVT LTD.
Baroda - 390007
Gujarat, India
http://www.ramanandi.org
Warning: Spelling errors in this message are the product of a poor school system. Pay teachers more than athletes..
 



From: Attila Szegedi <[hidden email]>
To: FreeMarker-devel <[hidden email]>
Cc: freemarker <[hidden email]>
Sent: Mon, 10 May, 2010 3:46:42 PM
Subject: Re: [FreeMarker-user] [Freemarker-devel] One more problem with GAE + Sitemesh

It looks like you're mixing JSP and FreeMarker with JSP taglibs in the same project. This would ordinarily be fine, but it's failing for you... The reason it ordinarily works fine is that FreeMarker will only install FreeMarkerJspFactory as a fallback JspFactory, provided for taglibs in case there's no other JspFactory implementation in the servlet container. The initialization code in FreeMarkerPageContext is this:

    static {
        if(JspFactory.getDefaultFactory() == null) {
            JspFactory.setDefaultFactory(new FreeMarkerJspFactory21());
        }
        logger.debug("Using JspFactory implementation class " + 
                JspFactory.getDefaultFactory().getClass().getName());
    }

This means that FreeMarkerJspFactory won't even get installed if there's another JspFactory already installed. I wonder why is Jetty not installing its own JspFactory for JSP pages. Can you try triggering Jetty into installing its own JspFactory first? Like, ensuring a JSP page is rendered before FreeMarker JSP support is being used? Would that solve the problem? If yes, we can think of how to move forward.

FWIW, the definition for the getPageContext() and releasePageContext are indeed this:

    public PageContext getPageContext(Servlet servlet, ServletRequest request, 
            ServletResponse response, String errorPageURL, 
            boolean needsSession, int bufferSize, boolean autoFlush) {
        // This is never meant to be called. JSP pages compiled to Java 
        // bytecode use this API, but in FreeMarker, we're running templates,
        // and not JSP pages precompiled to bytecode, therefore we have no use
        // for this API.
        throw new UnsupportedOperationException();
    }

    public void releasePageContext(PageContext ctx) {
        // This is never meant to be called. JSP pages compiled to Java 
        // bytecode use this API, but in FreeMarker, we're running templates,
        // and not JSP pages precompiled to bytecode, therefore we have no use
        // for this API.
        throw new UnsupportedOperationException();
    }

Note the comments explaining the reason for UnsupportedOperationException() -- these are never meant to be called from templates. 
Now, what's *really* strange is that your precompiled JSP page named "org.apache.jsp.WEB_002dINF.decorators.default_002ddecorator_jsp._jspService" is not calling getPageContext() first and getting an exception on that...

Attila.

On 2010.05.10., at 11:37, [hidden email] wrote:

Found one more problem with GAE + sitemesh..

I use sitemesh to decorate pages, the decorator is a jsp file..the pages which are being decorated are freemarker templates.. 
it's fine because sitemash just care about the HTML.

The setup runs fine on local environment.. where as when deployed to GAE it gives me this error..

javax.servlet.ServletContext log: Unhandled exception occurred
 whilst decorating page
java.lang.UnsupportedOperationException
at freemarker.ext.jsp.FreeMarkerJspFactory.releasePageContext(FreeMarkerJspFactory.java:41)
at org.apache.jsp.WEB_002dINF.decorators.default_002ddecorator_jsp._jspService(default_002ddecorator_jsp.java:99)
at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at org.mortbay.jetty.servlet.Dispatcher.include(Dispatcher.java:192)
at com.opensymphony.sitemesh.compatability.OldDecorator2NewDecorator.render(OldDecorator2NewDecorator.java:46)
at com.opensymphony.sitemesh.webapp.decorator.BaseWebAppDecorator.render(BaseWebAppDecorator.java:33)
at
com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:84)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)

 Seems that app engine is doing some thing strange with FreeMarkerJspFactory or reusing it in someway which isn't expected.
   
Sudhir Nimavat
Senior software engineer. 
Quick start global PVT LTD.
Baroda - 390007

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: RE One more problem with GAE + Sitemesh

sudhir543-dev
Thanks Attila,

I think, Instead of relying on system property, Writing a servlet filter or some thing, that will include a dump jsp to make the container initialize a JspFactory will be a better solution. Any way, I will need to make sure that a jsp is rendered before the freemarker jsp tag support execute.

Thanks
SN



 
   
Sudhir Nimavat
Senior software engineer.
Quick start global PVT LTD.
Baroda - 390007
Gujarat, India
http://www.ramanandi.org
Warning: Spelling errors in this message are the product of a poor school system. Pay teachers more than athletes..
 



From: Attila Szegedi <[hidden email]>
To: FreeMarker-devel <[hidden email]>
Sent: Mon, 7 June, 2010 12:29:55 PM
Subject: Re: [Freemarker-devel] RE One more problem with GAE + Sitemesh

As I said, it is a - what I consider a - flaw in the JSP spec, in that it relies on static singletons. It can happen with every servlet container that lazily initializes its JspFactory. Those that eagerly initialize it (I have no idea which, if any, do that) will not have this problem.

Attila.

On 2010.06.07., at 7:50, [hidden email] wrote:

I will have a look at if it's possible to set a system property on GAE.. 
But does any one know, is this a problem with GAE only, or does it happen with every other servers as well?


Thanks
SN
 
   
Sudhir Nimavat
Senior software engineer. 
Quick start global PVT LTD.
Baroda - 390007
Gujarat, India
http://www.ramanandi.org
Warning: Spelling errors in this message are the product of a poor school system. Pay teachers more than athletes..
 



From: Attila Szegedi <[hidden email]>
To: FreeMarker-devel <[hidden email]>
Sent: Sun, 6 June, 2010 3:11:49 PM
Subject: Re: [Freemarker-devel] RE One more problem with GAE + Sitemesh

Unfortunately, this is not a bug in any particular implementation of anything. This is a flaw in the design of the JSP specification, because it prescribes that the JSP factory needs to be a singleton. The only thing I can imagine is that I could add awareness of a system property, i.e. "freemarker.jsp.dontSetJspFactory", so if you set it to true, i.e. "-Dfreemarker.jsp.dontSetJspFactory=true" then FreeMarker will never install its own JSP factory. This won't be a 100% solution either, because with it, if your app's client requested a FreeMarker page with a JSP taglib that needs a JspFactory, and it is requested before any real Jetty rendered JSP page, then now in turn that will fail. It's a tradeoff. 

Can you set system properties in your GAE app? 

I know - it's not too pretty to rely on system properties, but OTOH, this is a singleton problem we're trying to work around, so I can only fight a global dependency problem with a global setting...

Let me know if that would be acceptable.

Attila.

--
On 2010.05.23., at 9:32, [hidden email] wrote:

Filed a bug on gae 
http://code.google.com/p/googleappengine/issues/detail?id=3252

Attila, do you have any comments for solution from our side ?
 
   
Sudhir Nimavat
Senior software engineer. 
Quick start global PVT LTD.
Baroda - 390007
Gujarat, India
http://www.ramanandi.org
Warning: Spelling errors in this message are the product of a poor school system. Pay teachers more than athletes..
 



From: "[hidden email]" <[hidden email]>
To: FreeMarker-devel <[hidden email]>
Cc: freemarker <[hidden email]>
Sent: Tue, 11 May, 2010 8:05:10 PM
Subject: [Freemarker-devel] RE One more problem with GAE + Sitemesh

Any comments on permanent solution !
 
   
Sudhir Nimavat
Senior software engineer. 
Quick start global PVT LTD.
Baroda - 390007
Gujarat, India
http://www.ramanandi.org
Warning: Spelling errors in this message are the product of a poor school system. Pay teachers more than athletes..
 



From: "[hidden email]" <[hidden email]>
To: FreeMarker-user <[hidden email]>
Cc: freemarker devel <[hidden email]>
Sent: Mon, 10 May, 2010 4:44:39 PM
Subject: Re: [Freemarker-devel] One more problem with GAE + Sitemesh

Yeah, tried and it works.. I created a hello.jsp. After deploying the application, accessed hello.jsp before calling any other URL that would render ftl.
And yes, after that everything else works.. 

What could be the permanent solution of this ? May be this is a bug with jetty implementation on GAE.
 
   
Sudhir Nimavat
Senior software engineer. 
Quick start global PVT LTD.
Baroda - 390007
Gujarat, India
http://www.ramanandi.org
Warning: Spelling errors in this message are the product of a poor school system. Pay teachers more than athletes..
 



From: Attila Szegedi <[hidden email]>
To: FreeMarker-devel <[hidden email]>
Cc: freemarker <[hidden email]>
Sent: Mon, 10 May, 2010 3:46:42 PM
Subject: Re: [FreeMarker-user] [Freemarker-devel] One more problem with GAE + Sitemesh

It looks like you're mixing JSP and FreeMarker with JSP taglibs in the same project. This would ordinarily be fine, but it's failing for you... The reason it ordinarily works fine is that FreeMarker will only install FreeMarkerJspFactory as a fallback JspFactory, provided for taglibs in case there's no other JspFactory implementation in the servlet container. The initialization code in FreeMarkerPageContext is this:

    static {
        if(JspFactory.getDefaultFactory() == null) {
            JspFactory.setDefaultFactory(new FreeMarkerJspFactory21());
        }
        logger.debug("Using JspFactory implementation class " + 
                JspFactory.getDefaultFactory().getClass().getName());
    }

This means that FreeMarkerJspFactory won't even get installed if there's another JspFactory already installed. I wonder why is Jetty not installing its own JspFactory for JSP pages. Can you try triggering Jetty into installing its own JspFactory first? Like, ensuring a JSP page is rendered before FreeMarker JSP support is being used? Would that solve the problem? If yes, we can think of how to move forward.

FWIW, the definition for the getPageContext() and releasePageContext are indeed this:

    public PageContext getPageContext(Servlet servlet, ServletRequest request, 
            ServletResponse response, String errorPageURL, 
            boolean needsSession, int bufferSize, boolean autoFlush) {
        // This is never meant to be called. JSP pages compiled to Java 
        // bytecode use this API, but in FreeMarker, we're running templates,
        // and not JSP pages precompiled to bytecode, therefore we have no use
        // for this API.
        throw new UnsupportedOperationException();
    }

    public void releasePageContext(PageContext ctx) {
        // This is never meant to be called. JSP pages compiled to Java 
        // bytecode use this API, but in FreeMarker, we're running templates,
        // and not JSP pages precompiled to bytecode, therefore we have no use
        // for this API.
        throw new UnsupportedOperationException();
    }

Note the comments explaining the reason for UnsupportedOperationException() -- these are never meant to be called from templates. 
Now, what's *really* strange is that your precompiled JSP page named "org.apache.jsp.WEB_002dINF.decorators.default_002ddecorator_jsp._jspService" is not calling getPageContext() first and getting an exception on that...

Attila.

On 2010.05.10., at 11:37, [hidden email] wrote:

Found one more problem with GAE + sitemesh..

I use sitemesh to decorate pages, the decorator is a jsp file..the pages which are being decorated are freemarker templates.. 
it's fine because sitemash just care about the HTML.

The setup runs fine on local environment.. where as when deployed to GAE it gives me this error..

javax.servlet.ServletContext log: Unhandled exception occurred
whilst decorating page
java.lang.UnsupportedOperationException
at freemarker.ext.jsp.FreeMarkerJspFactory.releasePageContext(FreeMarkerJspFactory.java:41)
at org.apache.jsp.WEB_002dINF.decorators.default_002ddecorator_jsp._jspService(default_002ddecorator_jsp.java:99)
at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at org.mortbay.jetty.servlet.Dispatcher.include(Dispatcher.java:192)
at com.opensymphony.sitemesh.compatability.OldDecorator2NewDecorator.render(OldDecorator2NewDecorator.java:46)
at com.opensymphony.sitemesh.webapp.decorator.BaseWebAppDecorator.render(BaseWebAppDecorator.java:33)
at
com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:84)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)

 Seems that app engine is doing some thing strange with FreeMarkerJspFactory or reusing it in someway which isn't expected.
   
Sudhir Nimavat
Senior software engineer. 
Quick start global PVT LTD.
Baroda - 390007


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel