Pages

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