Pages

Thursday, January 10, 2013

CQ5 Tree Replication - Cowardly Refusing to tree-activate - Forcing to activate

The Problem

When you are in the tree activation component:
http://localhost:4502/etc/replication/treeactivation.html

You have a first level folder that you want to replicate to a publish instance, but you get a message "Cowardly refusing to tree-activate \"%s\"

For instance, when trying to activate /content

You could individually go through and replicate the second level tree elements down, but this will take too much time to do.

STOP AND THINK!!!

If you are still reading, you are doing something else wrong on a strategic level.

If you are tree replicating the /content folder, chances are you should be activating your page on the http://localhost:4502/siteadmin Website Management component.

If you really do have a lot of child folders outside of the /content folder, you should be managing with packages, which will replicate for you. See my cheatsheets on how to package, and how to deploy.

If you have made your own folder on the root level, then you should consider putting it under a more strategic position, or grouping your second level folders into a more logical structure. You shouldn't have a lot of second level folders for your code for a single project.

In the meantime, if something has gone wrong, and you don't want to suffer from carpal tunnel syndrome from overclicking your mouse, here is how to turn off the safeguard that prevents you from replicating down. (Note, this safeguard is here for a reason, mainly to prevent you from just shotgun replicating the /etc or the /lib folder)

How to ignore and do it anyway

Open up CRXDE or CRXDE Lite and point it to your author instance.

If you plan to use CRXDE Lite, go to
http://localhost:4502/crx/de/index.jsp

Then navigate to:
/libs/cq/replication/components/treeactivation/POST.jsp

either by navigating down the folder structure on the left, or pasting the folder slashes into the search box.

Open up POST.jsp, and navigate down to line 176, where you will find the following:

            // reject root and 1 level paths

            /*if (path.lastIndexOf('/') <= 0) {
                if (path.length() == 0) {
                    path = "/";
                }
                out.printf("<div class=\"error\">Cowardly refusing to tree-activate \"%s\"</div>", path);
                return;

            }*/

Add the /* and */ comments (in red) and save the file.

Now go back to http://localhost:4502/etc/replication/treeactivation.html, and the check has been released.

Again, use this at your own risk, as this can cause problems with the replicators.

Monday, December 24, 2012

cq5 - eclipse - monitoring when something goes wrong in the eclipse IDE

The Problem

Something strange is going on when running the Eclipse IDE, and you want to get a clue as to what the problem may be.

The Solution

Go to your eclipse directory, where your eclipse.exe file is, and run the following command:

eclipse.exe -Dcom.sun.management.jmxremote

This will run your eclipse IDE in debug mode.

Then go to your Java home directory in your sdk, ie, C:\Program Files\Java\jdk1.6.0

Note, if Java has been configured correctly, you can use:
echo %JAVA_HOME%

on the command line to see which directory is being used

go to the bin directory in your java home, and run jconsole.exe

Connect to your process ID, and you can profile eclipse to get an idea of what is going on.

CQ5 with eclipse - forever indexing maven

The Problem

When opening Eclipse, Maven is stuck on indexing, unsuccessfully and indefinitely attempting to update its indexes.

The Solution

The mvn index needs to be disabled on startup, by launching eclipse, and immediately going to:
Window -> Preferences -> Maven -> Download repository index updates on startup.

Thursday, December 13, 2012

No code complete in CRXDE

The Problem

In CQ5.5 SP1, CRXDE does not have code complete, classes can't be found, laptop is in serious risk of defenestration.

The Solution

Go to Package Share in CQ5 admin on author.

http://localhost:4502/crx/packageshare/

Log in if required with your adobe id.

Click on Download for:
1. Missing CRXDE-Libs
2. CRX Hotfix Pack

And install these packages.

Restart CQ5 and CRXDE, and hopefully this will have resolved the issue.

Wednesday, December 12, 2012

Formatting JSON

I was writing a SlingServlet that was to output JSON, and I wanted a neat tool to format my request.

I used notepad++ combined with the JSMin plugin.

To install JSMin,
1. open notepad++
2. Click on Plugins->Plugin Manager-> Show Plugin Manager
3. Scroll down to JSMin, click on the checkbox and install

Now just copy and paste your raw JSON in, and to format, press Ctrl+Alt+M, or go to Plugins->JSMin->JSFormat


Tuesday, December 11, 2012

gotchya - cq 5.5 doesn't work properly with JRE 1.7

I had upgraded my laptop, gleefully installed CQ5.5, and promptly was pulling tufts of hair out.

Custom Sling Servlets weren't behaving, and I was getting general issues with my CQ instance. What the dickens is going on?

Well.... I had JRE 1.7 installed, not 1.6.14

http://dev.day.com/docs/en/cq/current/deploying/technical_requirements.html


Java Virtual Machines

CQ5 operates with the following versions of the Java Virtual Machine (Runtime Environment).
Platform Support Level
Oracle JRE 1.7.x A: Supported with CQ 5.5 SP2 or newer
Oracle JRE 1.6.x A: Supported
Oracle JRE 1.5.x D: Validated
Oracle JRE 1.4.2 Z: Not supported
IBM JRE 1.6 A: Supported
IBM JRE 1.5 D: Validated
HP JRE 1.5 E: Expected to work


So there are 2 options.

1. Upgrade to SP2
2. Downgrade the JRE to 1.6.14

After I had downgraded the JRE and restarted, things returned to normal again.

If someone upgrades to SP2 experiencing similar issues, please comment below.

Wednesday, December 5, 2012

Running and debugging CQ5 using CRXDE

The Problem

You want to debug your code on a CQ5 server using Breakpoints in CRXDE, but the Debug option is greyed out.

The Solution

Chances are, you are not running CQ5 in debug mode. Here is a simple way to start your CQ5 instance in debug mode, and how to attach CRXDE to it.

Assuming a windows machine and a local copy of CQ5 for the purposes of this tutorial, located at c:\cq5\author running on the default port 4502.

1. Ensure that all local instances of CQ5 are shut down.

2. Under windows. open up command from the start menu, navigate to the c:\cq5\author directory

3. copy and paste the following command:

java -debug -XX:MaxPermSize=256M -Xnoagent -Xmx1024M -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=30303 -jar cq5-author-4502.jar -nofork

4. IMPORTANT: It can take quite a while for the server to start in debug mode. Wait until your browser window opens up at the author login screen before continuing.

5. Open up CRXDE. Search for it in your supplied CQ5 materials.

6. Enter http://localhost:4502 in the URL field, and admin/admin for the username and password.

7. Click on OK, and wait for CRXDE to load.

8. To test, we can navigate to a piece of code that you can break into.

A good place to test is to put a breakpoint on line 31 in /apps/geometrix/components/title/title.jsp

When you have put the breakpoint in, navigate to:
http://localhost:4502/cf#/content/geometrixx/en/products.html

You will now be able to step through your code.

Gotchyas