You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Francisco Carrillo <fc...@tacitknowledge.com> on 2009/02/05 22:32:24 UTC

ATG taglibs on Sling/osgi having trouble


We're currently creating an app that needs ATG taglibs on SLING/OSGI, we 
have created a bundle with these taglibs and uploaded it, of course 
these taglibs call ATG classes, so we are including them in the 
bootdelegation, using sling.properties file.

sling.bootdelegation.simple=atg.nucleus 
sling.bootdelegation.class.atg.nucleus.Nucleus=atg.appassembly, \ 
atg.appassembly.ant, \ atg.appassembly.progress, \ atg.appassembly.util, 
\ ...ETC...

First we got this error:

org.apache.sling.api.scripting.ScriptEvaluationException: 
atg/taglib/dspjsp/ImportBeanTag at 
org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:163) 
at 
org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:107) 
at 
org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:226) 
at 
org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:465)

....

.... Caused by: java.lang.NoClassDefFoundError: 
atg/taglib/dspjsp/ImportBeanTag at 
org.apache.jsp.apps.mygeometrixx.components.contenpage.center_jsp._jspx_meth_dsp_005fimportbean_005f0(center_jsp.java:177) 
at 
org.apache.jsp.apps.mygeometrixx.components.contenpage.center_jsp._jspService(center_jsp.java:154) 
at 
org.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) 
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at

So we added atg.taglib.dspjsp to the packages to be added in 
bootdelegation sling.properties file.

Then we got this error:

org.apache.sling.api.scripting.ScriptEvaluationException: 
atg.taglib.dspjsp.ImportBeanTag at 
org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:163) 
at 
org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:107) 
at 
org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:226) 
at 
org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:465) 
...

Caused by: java.lang.ClassCastException: atg.taglib.dspjsp.ImportBeanTag 
at 
org.apache.sling.scripting.jsp.jasper.runtime.TagHandlerPool.get(TagHandlerPool.java:125) 
at 
org.apache.jsp.apps.mygeometrixx.components.contenpage.center_jsp._jspx_meth_dsp_005fimportbean_005f0(center_jsp.java:177) 
at 
org.apache.jsp.apps.mygeometrixx.components.contenpage.center_jsp._jspService(center_jsp.java:154) 
at 
org.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)

All this is running on JBOSS.

Is there a way to avoid this class conflict that is causing the cast 
exception?


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: ATG taglibs on Sling/osgi having trouble

Posted by Bob Mayes <bm...@tacitknowledge.com>.
Hi Felix -

I've been looking at this with Francicso and am familiar with the issue, let
me add a bit of background and confirm my suspicions from stepping through
the tag handling in sling's jsp compiler.  Apologies for list pollution,
this looks more like a Sling issue than a Felix issue per se.

The issue is our desire/need to delegate classloading on the taglib classes
themselves to the container. Using either bootdelegation or system.packages
mechanisms, if the taglib classes are loaded by the parent container, we see
runtime ClassCastExceptions during compilation in the tag handler code. 

An example, createValidator (TagLibraryInfoImpl.java 159..164); the
assignment on line 164 throws if tlvClass is container-loaded:

TagLibraryValidator tlv = null;
        if (validatorClass != null && !validatorClass.equals("")) {
            try {
                Class tlvClass = ctxt.getClassLoader()
                        .loadClass(validatorClass);
                tlv = (TagLibraryValidator) tlvClass.newInstance();

Multiple points in TagLibraryInfoImpl.java upcast the loaded tag class
assuming homogeneous classloaders.  It leads me to suspect that external
classloaders for taglib classes just is not intended or supported.  Let's
just imagine that we *need* to delegate classloading for the taglib classes
(say they have link dependencies to other container-managed packages,
deployed outside of felix)... are we just out of luck at present?

Thanks for your thoughts,
- Bob


Felix Meschberger-2 wrote:
> 
> Hi Francisco,
> 
> Francisco Carrillo schrieb:
>> 
>> 
>> We're currently creating an app that needs ATG taglibs on SLING/OSGI, we
>> have created a bundle with these taglibs and uploaded it, of course
>> these taglibs call ATG classes, so we are including them in the
>> bootdelegation, using sling.properties file.
>> Caused by: java.lang.ClassCastException: atg.taglib.dspjsp.ImportBeanTag
>> at
>> org.apache.sling.scripting.jsp.jasper.runtime.TagHandlerPool.get(TagHandlerPool.java:125)
>> at
>> org.apache.jsp.apps.mygeometrixx.components.contenpage.center_jsp._jspx_meth_dsp_005fimportbean_005f0(center_jsp.java:177)
>> at
>> org.apache.jsp.apps.mygeometrixx.components.contenpage.center_jsp._jspService(center_jsp.java:154)
>> at
>> org.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
> 
> This may be caused because the tag library class is then read from the
> environment and then there is some class clash between environmental
> classes loaded through boot delegation and classes in your fraemwork.
>> 
>> 
>> All this is running on JBOSS.
>> 
>> Is there a way to avoid this class conflict that is causing the cast
>> exception?
> 
> Assuming you did not export the tag library classes in the ATG
> taglibrary bundle, this may be the cause.
> 
> Regards
> Felix
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/ATG-taglibs-on-Sling-osgi-having-trouble-tp21861795p21973244.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: ATG taglibs on Sling/osgi having trouble

Posted by Felix Meschberger <fm...@gmail.com>.
Hi Francisco,

Francisco Carrillo schrieb:
> 
> 
> We're currently creating an app that needs ATG taglibs on SLING/OSGI, we
> have created a bundle with these taglibs and uploaded it, of course
> these taglibs call ATG classes, so we are including them in the
> bootdelegation, using sling.properties file.
> 
> sling.bootdelegation.simple=atg.nucleus
> sling.bootdelegation.class.atg.nucleus.Nucleus=atg.appassembly, \
> atg.appassembly.ant, \ atg.appassembly.progress, \ atg.appassembly.util,
> \ ...ETC...
> 
> First we got this error:
> ....
> 
> .... Caused by: java.lang.NoClassDefFoundError:
> atg/taglib/dspjsp/ImportBeanTag at
> org.apache.jsp.apps.mygeometrixx.components.contenpage.center_jsp._jspx_meth_dsp_005fimportbean_005f0(center_jsp.java:177)
> at
> org.apache.jsp.apps.mygeometrixx.components.contenpage.center_jsp._jspService(center_jsp.java:154)
> at
> org.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at

I assume this is a class, which is in the tag library, right ? Do you
have the taglibrary classes exported from the tag library bundle ? This
is very important.

> 
> So we added atg.taglib.dspjsp to the packages to be added in
> bootdelegation sling.properties file.
> 
> Then we got this error:
> 
> ...
> 
> Caused by: java.lang.ClassCastException: atg.taglib.dspjsp.ImportBeanTag
> at
> org.apache.sling.scripting.jsp.jasper.runtime.TagHandlerPool.get(TagHandlerPool.java:125)
> at
> org.apache.jsp.apps.mygeometrixx.components.contenpage.center_jsp._jspx_meth_dsp_005fimportbean_005f0(center_jsp.java:177)
> at
> org.apache.jsp.apps.mygeometrixx.components.contenpage.center_jsp._jspService(center_jsp.java:154)
> at
> org.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)

This may be caused because the tag library class is then read from the
environment and then there is some class clash between environmental
classes loaded through boot delegation and classes in your fraemwork.
> 
> 
> All this is running on JBOSS.
> 
> Is there a way to avoid this class conflict that is causing the cast
> exception?

Assuming you did not export the tag library classes in the ATG
taglibrary bundle, this may be the cause.

Regards
Felix

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org