Expand my Community achievements bar.

SOLVED

Deploying compiled JSPs to CQ

Avatar

Former Community Member

I was reading through this post: http://dev.day.com/docs/en/cq/aem-how-tos/development/how-to-build-aem-projects-using-apache-maven.h..., particularly focusing on the part concerning compiling JSPs as part of a Maven build. I've successfully implemented that, but I'm interested in actually deploying the compiled JSPs to my instance. The article teases that this is possible with the following line: "The result of the Maven JspC Plugin can also be bundled and deployed as part of an OSGi Bundle, but this has other implications and side effects and goes beyond our goal of validating the JSPs." However, I can't find any further information on this. 

I tried simply taking the compiled JSPs and deploying them to the directory /var/classes/org/apache/jsp/<app_name>, but that just results in ClassNotFoundExceptions being thrown. Digging through the Sling source code I expect the issue is that even though the .class files are present they aren't being registered with a ClassLoader. 

For some background - our instances have some pretty severe performance issues when they first start receiving requests from the load balancer. There's some thought that the the JSP compilation is backing up and subsequently slowing down page load time. I personally don't believe this is the problem, but I'd like to be able to back that up with some evidence. Precompiling all the JSPs and deploying would certainly give me that. 

Any direction or advice is much appreciated. 

Thanks, 

Caleb

1 Accepted Solution

Avatar

Correct answer by
Level 9

Hi,

Apache Sling JCR ClassLoaderorg.apache.sling.jcr.classloader is actually the bundle which is responsible for managing and loading the complied scriplets from the repository. If you look into the bundle description it also offered services (i did not look into detail because Interrupting class loader basic functionality specially at servers like production (with load balancing) is not a good idea as it may cause various issues.)

I would suggest: Instead of thinking to resolve server performance issues via deploying compiled scriptlet classes better to look at other areas of in memory object management and usage.

 

Thanks,

Pawan

View solution in original post

2 Replies

Avatar

Level 10

Read this community article -- it walks you through how to build a CQ app that uses Maven, builds an OSGi bundle (where your compiled Java classes should be located) and how to create JSP to call the OSGi bundle operations. It ties in typical CQ development tasks in 1 article and steps you through the process:

http://scottsdigitalcommunity.blogspot.ca/2013/02/querying-adobe-experience-manager-data.html

When you want to deploy JSPs that are part of a CQ solution - i recommend deploying them as part of a CQ package. See:  

 http://scottsdigitalcommunity.blogspot.ca/2012/04/creating-osgi-bundles-for-adobe-digital.html

 

Avatar

Correct answer by
Level 9

Hi,

Apache Sling JCR ClassLoaderorg.apache.sling.jcr.classloader is actually the bundle which is responsible for managing and loading the complied scriplets from the repository. If you look into the bundle description it also offered services (i did not look into detail because Interrupting class loader basic functionality specially at servers like production (with load balancing) is not a good idea as it may cause various issues.)

I would suggest: Instead of thinking to resolve server performance issues via deploying compiled scriptlet classes better to look at other areas of in memory object management and usage.

 

Thanks,

Pawan