You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by tim tam <tm...@gmail.com> on 2011/04/07 21:51:17 UTC

ClassCastException on accessing custom tag

I am accessing a tag from a 3rd party library, which is loaded into my ear
where I also have CQ apps.
Am running into this exception on weblogic

Caused by: java.lang.ClassCastException:
org.apache.sling.scripting.jsp.jasper.runtime.JspWriterImpl cannot be cast
to weblogic.servlet.jsp.ByteWriter
    at jsp_servlet.__frag1._jspService(__frag1.java:68)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
    at
weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at
weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
    at
weblogic.servlet.internal.ServletStubImpl.onAddToMapException(ServletStubImpl.java:416)
    at
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:326)
    at
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:183)
    at
weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:526)
    at
weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:447)
    at gopa.taglibrary.IncludeTag.doEndTag(IncludeTag.java:585)
    at
gopa.apache.jsp.apps.myapp.components.page.contentpage.contentpage_jsp._jspx_meth_gopa_005finclude_005f0(contentpage_jsp.java:247)
    at
gopa.apache.jsp.apps.myapp.components.page.contentpage.contentpage_jsp._jspService(contentpage_jsp.java:102)
    at
gopa.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at
org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)

Would appreciate any troubleshooting tips- what to look for
Thankyou
Tim

Re: ClassCastException on accessing custom tag

Posted by Mark Adamcin <ad...@gmail.com>.
It looks to me like your gopa.taglibrary.IncludeTag is calling the weblogic
RequestDispatcher instead of the SlingRequestDispatcher, which is attempting
to cast the existing Sling JspWriter to a weblogic ByteWriter.

My assumption is that the problem stems from the fact that your tag is
calling request.getRequestDispatcher() and instead of getting an instance of
org.apache.sling.engine.impl.request.SlingRequestDispatcher, it's getting an
instance of weblogic.servlet.internal.RequestDispatcherImpl, which probably
works off of the assumption that WebLogic initialized the request in the
first place and that all of the JSP objects are WebLogic implementations.

I have no idea how you would go about fixing that, unfortunately.

Mark Adamcin
Acquity Group



On Thu, Apr 7, 2011 at 12:51 PM, tim tam <tm...@gmail.com> wrote:

> I am accessing a tag from a 3rd party library, which is loaded into my ear
> where I also have CQ apps.
> Am running into this exception on weblogic
>
> Caused by: java.lang.ClassCastException:
> org.apache.sling.scripting.jsp.jasper.runtime.JspWriterImpl cannot be cast
> to weblogic.servlet.jsp.ByteWriter
>    at jsp_servlet.__frag1._jspService(__frag1.java:68)
>    at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
>    at
>
> weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
>    at
>
> weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
>    at
> weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
>    at
>
> weblogic.servlet.internal.ServletStubImpl.onAddToMapException(ServletStubImpl.java:416)
>    at
> weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:326)
>    at
> weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:183)
>    at
>
> weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:526)
>    at
>
> weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:447)
>    at gopa.taglibrary.IncludeTag.doEndTag(IncludeTag.java:585)
>    at
>
> gopa.apache.jsp.apps.myapp.components.page.contentpage.contentpage_jsp._jspx_meth_gopa_005finclude_005f0(contentpage_jsp.java:247)
>    at
>
> gopa.apache.jsp.apps.myapp.components.page.contentpage.contentpage_jsp._jspService(contentpage_jsp.java:102)
>    at
>
> gopa.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
>    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>    at
>
> org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
>
> Would appreciate any troubleshooting tips- what to look for
> Thankyou
> Tim
>

Re: ClassCastException on accessing custom tag

Posted by Paul McMahon <or...@yahoo.com>.
The tag needs to be deployed in an OSGI bundle if you want to access it in a Sling script - just having deployed in the case servlet container isn't enough in my experience.

You'd need to look at your 3rd party library and see if a bundle packaging is available or if you can create a wrapper. 

Paul McMahon 

--- On Thu, 4/7/11, tim tam <tm...@gmail.com> wrote:

From: tim tam <tm...@gmail.com>
Subject: ClassCastException on accessing custom tag
To: users@sling.apache.org
Date: Thursday, April 7, 2011, 1:51 PM

I am accessing a tag from a 3rd party library, which is loaded into my ear
where I also have CQ apps.
Am running into this exception on weblogic

Caused by: java.lang.ClassCastException:
org.apache.sling.scripting.jsp.jasper.runtime.JspWriterImpl cannot be cast
to weblogic.servlet.jsp.ByteWriter
    at jsp_servlet.__frag1._jspService(__frag1.java:68)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
    at
weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at
weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
    at
weblogic.servlet.internal.ServletStubImpl.onAddToMapException(ServletStubImpl.java:416)
    at
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:326)
    at
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:183)
    at
weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:526)
    at
weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:447)
    at gopa.taglibrary.IncludeTag.doEndTag(IncludeTag.java:585)
    at
gopa.apache.jsp.apps.myapp.components.page.contentpage.contentpage_jsp._jspx_meth_gopa_005finclude_005f0(contentpage_jsp.java:247)
    at
gopa.apache.jsp.apps.myapp.components.page.contentpage.contentpage_jsp._jspService(contentpage_jsp.java:102)
    at
gopa.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at
org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)

Would appreciate any troubleshooting tips- what to look for
Thankyou
Tim