CQ5 coding patterns: Sling vs JCR (part 1)

- Jörg Hoh

CQ5 as a complex framework is built on top of various other frameworks, on the server-side the most notably ones are JCR (with its implementation Apache Jackrabbit) and Apache Sling. Both are very powerful frameworks, but both of them have some overlap in functionality:

In these 2 areas you can work with both frameworks, and achieve good results with both. So, the question is, in what situation should you prefer Sling and in what situation pure JCR.

First, and I hope you agree here, in 99% of all cases use the an abstracted framework is recommended over the use of concrete technology (everybody uses JDBC and noone a direct database interface for e.g. MySQL) . It usually offers more flexibility and an easier learning cure. Same here. While on pure JCR you only work with raw repository structures (nodes and properties), the Sling resource abstraction offers you easier handling (no need to deal with the repository exceptions any more) and much more options to interact with you business objects and services.

...

-----------

Read the complete blog post at http://cqdump.wordpress.com/2012/11/06/cq5-coding-patterns-sling-vs-jcr-part-1/

How to Fix No Such Item repository corruption in CQ5.5

- Yogesh Upadhyay

 

Use Case: You have repository corruption that can not be fixed using consistency check and fix.Prerequisite:http://helpx.adobe.com/crx/kb/RepositoryInconsistency.html

http://helpx.adobe.com/cq/kb/cq-5-5--rien-ne-va-plus---i-need-a-text-shell.html

Stack Trace:

05.11.2012 00:30:01.476 *ERROR* [pool-5-thread-2] com.citrix.avanti.auth.importer.impl.GroupImporter Unable to perform role import javax.jcr.ItemNotFoundException: failed to build path of 795cff24-7fd7-3f5f-a9b1-4724c3a6ff4d at org.apache.jackrabbit.core.HierarchyManagerImpl.getPath(HierarchyManagerImpl.java:400) at org.apache.jackrabbit.core.CachingHierarchyManager.getPath(CachingHierarchyManager.java:233) at org.apache.jackrabbit.core.ItemImpl.getPrimaryPath(ItemImpl.java:188) at org.apache.jackrabbit.core.NodeImpl.getPrimaryPath(NodeImpl.java:2753) at org.apache.jackrabbit.core.ItemImpl$2.perform(ItemImpl.java:379) at org.apache.jackrabbit.core.ItemImpl$2.perform(ItemImpl.java:376) at org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java:216) at org.apache.jackrabbit.core.ItemImpl.perform(ItemImpl.java:91) at org.apache.jackrabbit.core.ItemImpl.getPath(ItemImpl.java:376) at <Some Custom Code> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) Caused by: org.apache.jackrabbit.core.state.NoSuchItemStateException: 34228aff-f648-429a-a097-29de8568fe3e at org.apache.jackrabbit.core.state.SharedItemStateManager.getItemState(SharedItemStateManager.java:285) at org.apache.jackrabbit.core.state.LocalItemStateManager.getNodeState(LocalItemStateManager.java:110) at org.apache.jackrabbit.core.state.LocalItemStateManager.getItemState(LocalItemStateManager.java:175) at org.apache.jackrabbit.core.state.XAItemStateManager.getItemState(XAItemStateManager.java:260) at org.apache.jackrabbit.core.state.SessionItemStateManager.getItemState(SessionItemStateManager.java:161) at org.apache.jackrabbit.core.HierarchyManagerImpl.getItemState(HierarchyManagerImpl.java:152) at org.apache.jackrabbit.core.HierarchyManagerImpl.buildPath(HierarchyManagerImpl.java:278) at org.apache.jackrabbit.core.CachingHierarchyManager.buildPath(CachingHierarchyManager.java:199) at org.apache.jackrabbit.core.HierarchyManagerImpl.getPath(HierarchyManagerImpl.java:395) ... 18 more

How to Fix (If it is not cluster then ignore cluster steps):

...

----------

Read the complete blog post at

http://www.wemblog.com/2012/11/how-to-fix-no-such-item-repository.html

How to manage Hot backup Or Manage Disaster Recovery in CQ

- Yogesh Upadhyay

There are various approach, I am listing them with pros and cons

Approach 1: Use clustering, but direct the requests only to one node. In case of problems with this node just switch over to the other node. Essentially this is an active-passive scenario.

+ proven technology, documented and fully supported feature

+ automatic fail over easily possible

- additional license cost

- Latency issue might effect performance

- Managing cluster is sometime difficult

...
------

Read the complete post at the Adobe CQ/Adobe WEM blog.

Configuring the Adobe CQ Dispatcher

Over the past couple of weeks, we’ve created content that addresses several top questions related to the Adobe CQ Dispatcher. This is in response to questions we’ve heard from you, our community. I encourage you to give a read and also check out the more in-depth documentation I link to further below.

——-

Read the complete post at The Experience Delivers blog

CQ5.5: javax.jcr.RepositoryException: Unable to register data store in cluster

- David McMahon

Issue

If you are installing and starting a new CQ instance you may experience the following exception:

*ERROR* [FelixStartLevel] org.apache.jackrabbit.core.RepositoryImpl failed to start Repository: Unable to register data store in cluster. javax.jcr.RepositoryException: Unable to register data store in cluster. Caused by: java.net.UnknownHostException: <server_hostname>: <server_hostname> at java.net.InetAddress.getLocalHost(InetAddress.java:1360) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:211) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) at java.net.Socket.connect(Socket.java:529) at java.net.Socket.connect(Socket.java:478) at java.net.Socket.<init>(Socket.java:375) at java.net.Socket.<init>(Socket.java:218)
… 56 more

...

---------

To view the solution, read the original blog post at The Adobe Enterprise Product Blog.

CQ5.5: MCM emails contain URLs to author instead of publish

- David McMahon

Issue

If you are using the Newsletter feature in MCM to send emails to lists of contacts you may notice that the URLs for assets in the email are pointing to the author instance, rather than the publish instance.  The links to the author instance will not work for external users, so the assets in the email will not show up.

...

-------

To view the solution, read the original blog post at The Adobe Enterprise Product blog.

Some CQ tips and tricks

Check out some useful tips and tricks published as part of the CQ Best Practice content series:

  • Useful variations in the authoring environment URL
  • Troubleshoot CRXDE performance issues
  • Advanced CRX search
  • Validate user input in multifield components
  • Define how users can interact with a component
  • Include resources in JSP files

Read the article here: http://helpx.adobe.com/content/help/en/adobe-cq/using/tips-tricks.html

CQ5.5 SP1: MalformedPathException: ‘:redirect’ is not a valid path. Prefix must not be empty

- David McMahon

Issue

If you have updated to CQ5.5 Update 1 and you attempt to access a user profile page, for example the admin profile, as follows:

http://<server>:<port>/home/users/a/admin/profile.form.html/content/geometrixx/en/toolbar/profiles/edit

or

http://<server>:<port>/home/users/a/admin/profile.form.html/content/geometrixx/en/toolbar/profiles/view

you will see the following exception in the error.log:

*ERROR* GET /home/users/a/admin/profile.form.html/content/geometrixx/en/toolbar/profiles/edit HTTP/1.1] com.day.cq.wcm.core.impl.WCMDebugFilter Exception:  org.apache.sling.api.scripting.ScriptEvaluationException:

    at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:385)

Caused by: java.lang.IllegalArgumentException: javax.jcr.RepositoryException: Failed to resolve path :redirect relative to node /home/users/a/admin/profile

Caused by: org.apache.jackrabbit.spi.commons.conversion.MalformedPathException: ‘:redirect’ is not a valid path. Prefix must not be empty

Reason

This issue is caused by a regression in the 2.1 version of Sling which has been integrated with CQ5.5 SP1: https://issues.apache.org/jira/browse/SLING-2518

The issue does not occur with the 2.0.10 version of Sling included with CQ5.5.

Solution

This issue will be resolved in the next release of CQ5.5 SP2.

reference: (37322/CQ5-18799)

-------

Read the original post at the Adobe Enterprise Product Blog.

CQ5.5: Invalid links to DAM assets containing spaces in the file-name

- David McMahon

Issue

If you are using the CQ5.5 authoring environment to add links to DAM assets through the rich-text editor dialog by drag-and-drop, then you may notice that some of these links will be marked invalid after clicking OK on the dialog.

A invalid link appears like the “banking” text below, whereas a valid link appears like the “investors” text.

You may also see errors similar to the following in the error.log:

*ERROR* [0:0:0:0:0:0:0:1 [1344244721052] GET /libs/wcm/core/content/pageinfo.json HTTP/1.1] com.day.cq.wcm.core.impl.servlets.PageInfoServlet Request path does not resolve to a resource: /content/dam/geometrixx/documents/GeoSphere_D%20a%20tasheet.pdf

Reason

The links are marked invalid when the assets in DAM contain spaces in the file-name (e.g. GeoSphere_D a tasheet.pdf).  Such file-names are being parsed by a URL encoder and the spaces get converted to the %20 code at the wrong place.

...

----------

Read the workaround at The Adobe Enterprise Product Blog.

“Concurrent users” and performance tests

-- Jörg Hoh

A few years ago when I was still working in application management of a large website we often had the case, that the system was reported to be slow. Whenever we looked into the system with our tooling we did not found anything useful, and we weren’t able to explain this slowness. We had logs which confirmed the slowness, but no apparent reason for it. Sadly the definition of performance metrics was just … well, forgotten. (I once saw the performance requirement section in the huge functional specification doc: 3 sentences vs 200 pages of other requirements.)

It was a pretty large system and rumors reported, that it was some of the biggest installations of this application. So we approached the vendor and asked how many parallel users are supported on the system. Their standard answer “30″ (btw: that’s still the number on their website, although they have rewritten the software from scratch since then) wasn’t that satisfying, because they didn’t provide any way to actually measure this value on the production system.

The situation improved then a bit, got worse again, improved, … and so on. We had some escalations in the meantime and also ran over months in task force mode to fight this and other performance problems. Until I finally got mad, because we weren’t able to actually measure the how the system was used. Then I started to define the meaning of “concurrent users” for myself: “2 users are considered concurrent users, when for each one a request is logged in the same timeframe of 15 minutes”. I wrote a small perl script, which ran through the web server logs and calculated these numbers for me. As a result I had 4 numbers of concurrent users per hour. By far not exact, but reasonable to an extent, that we had some numbers.

...

--------

Read the complete post at the Things on a Content Management System.


Copyright © 2012 Adobe Systems Incorporated. All rights reserved.
Terms of Use | Privacy Policy and Cookies (Updated)