Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

CRXDE Error

Avatar

Level 3

Hi,

I'm working on the below exercise and i'm getting the output as expected.

http://helpx.adobe.com/experience-manager/using/using-sling-apis.html

But in CRXDE it throws errors may i know what is the root cause here because i'm eager to know whether it's code issue or crxde

Error:

Multiple annotations found at this line:
    - custom cannot be resolved 
     to a type
    - sling cannot be resolved

Also PFA Image

Thanks in advance!!

1 Accepted Solution

Avatar

Correct answer by
Level 6

There is really no need to be concerned of confused. The problem is NOT related to Adobe AEM, CRX or CRXDE. It is a classic Java resolving problem.

If you use a class, lets say custom.sling.Query, you need to have someone that declares that class in your development environment, either as source code or as a compiled class. All of the classes that are deployed in your CQ instance should be loaded into your IDE and added to the build CLASSPATH. Look at the CLASSPATH as an address to a warehouse where your classes are found at a specific shelf (custom.sling). What the IDE tells you is "yes, I know that you want that class, but I have talked to all my warehouses (that is the jar-files that contains the classes) and non-one stocks it. Could you please point me to the right place."

We use Maven to keep this kinds of dependencies and downloads the jar-files from the Adobe Repository.

View solution in original post

11 Replies

Avatar

Level 10

Do you have the OSGi bundle deployed and in an active state - if you built the bundle using Maven following this article and deployed the bundle, you should see it in an active state in the Felix console:

[img]Maven.png[/img]

Avatar

Level 6

The problem here is an IDE-problem, not an CRXDE-problem per se. One of the problems is due to the file "/libs/foundation/global.jsp", that the sling object is not found on the path and included by the IDE.

The other is due to the fact that your jsp-file does not include the custom.sling.Query in an page import.

 

/Ove

Avatar

Level 3

Bundle is Active and getting the out as expected but unnessary it showing the error in jsp.

PFA image 

Avatar

Level 3

Hi Ove,

PFA image as you suggested i've made page import(custom.sling.Query ) still facing the same error.

Is there a workaround to come out of the error.Please suggest.

Thanks in advance!

Avatar

Level 6

Does your Eclipse Project import a JAR with the mentioned class in its CLASSPATH?

This is actually not a CRX/AEM-issue, it is a Java/Java EE/IDE-issue.

/Ove

Avatar

Level 10

What concerns me here is that the sling object is not found on the path. Do you see this path in your system:

"/libs/foundation/global.jsp" -- this is where the sling object is defined. 

If you cannot use Sling  -- there is something wrong with your CQ paths. Out of the box -- this works fine. 

Avatar

Level 3

now the sling object error disappears but the import error still exists but the output is displayed.

i'm confused here :). 

PFA image

Avatar

Level 3

Hi Ove,

I'm using the eclipse favour luna to build the bundle and uploading the bundle in felix console.And there is no access/permission for me to mention it in the class path.

Ideally for building the bundle which flavour of eclipse is better to use!

Please suggest Thanks!

Avatar

Level 6

Ideally, use IntelliJ IDEA 12 and Maven to build your applications.

/O

Avatar

Level 10

Your CQ page output (the JSP) works correct? 

You get this result:

[img]app.png[/img]

Avatar

Correct answer by
Level 6

There is really no need to be concerned of confused. The problem is NOT related to Adobe AEM, CRX or CRXDE. It is a classic Java resolving problem.

If you use a class, lets say custom.sling.Query, you need to have someone that declares that class in your development environment, either as source code or as a compiled class. All of the classes that are deployed in your CQ instance should be loaded into your IDE and added to the build CLASSPATH. Look at the CLASSPATH as an address to a warehouse where your classes are found at a specific shelf (custom.sling). What the IDE tells you is "yes, I know that you want that class, but I have talked to all my warehouses (that is the jar-files that contains the classes) and non-one stocks it. Could you please point me to the right place."

We use Maven to keep this kinds of dependencies and downloads the jar-files from the Adobe Repository.