[ 
https://issues.apache.org/jira/browse/SLING-2617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13473274#comment-13473274
 ] 

Bertrand Delacretaz commented on SLING-2617:
--------------------------------------------

Here's what I found - the root cause is that the JasperException class is 
correctly available to the scripting.jsp bundle, but not passed anymore 
(compared to previous versions of the bundle) to the ClassLoader used to 
compile and execute the JSP.

AIUI the failure scenario is:
In JDTCompiler, INameEnvironment.findType uses ctxt.getClassLoader() which is 
an org.apache.sling.jcr.classloader.internal.RepositoryClassLoader.

Its parent is a org.apache.sling.commons.classloader.impl.ClassLoaderFacade 
with a manager 
(org.apache.sling.commons.classloader.impl.DynamicClassLoaderManagerImpl) that 
has an org.apache.sling.commons.classloader.impl.BundleProxyClassLoader with 
bundle=org.apache.sling.jcr.classloader (as a parent to the 
PackageAdminClassLoader)

That BundleProxyClassLoader should instead point to the scripting.jsp bundle.

That RepositoryClassLoader is provided by the JspRuntimeContext, so fixing the 
ClassLoader that that returns should fix both the compile and runtime cases.
                
> jsp:setProperty causes "the type JasperException cannot be resolved" 
> compilation error
> --------------------------------------------------------------------------------------
>
>                 Key: SLING-2617
>                 URL: https://issues.apache.org/jira/browse/SLING-2617
>             Project: Sling
>          Issue Type: Bug
>          Components: Scripting
>    Affects Versions: Scripting JSP 2.0.24
>            Reporter: Bertrand Delacretaz
>            Assignee: Bertrand Delacretaz
>
> The following script causes a compilation error, "The type 
> org.apache.sling.scripting.jsp.jasper.JasperException cannot be resolved" - 
> I'll attach the stack trace.
> Without the jsp:setProperty statement the script compiles without error.
> export PORT=8080
> cat <<EOL > /tmp/foo.jsp
> <jsp:useBean id="date" scope="page" class="java.util.Date" />
> <jsp:getProperty name="date" property="time"/>
> <jsp:setProperty name="date" property="time" value="1234"/>
> <jsp:getProperty name="date" property="time"/>
> All good!
> EOL
> curl -u admin:admin -X MKCOL http://localhost:$PORT/apps/foo
> curl -u admin:admin -T /tmp/foo.jsp http://localhost:$PORT/apps/foo/foo.jsp
> curl -u admin:admin -Fsling:resourceType=foo http://localhost:$PORT/apps/foo
> curl -u admin:admin http://localhost:$PORT/apps/foo.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to