Hi everybody,
I'm experimenting with the new Java Use-API [1] but I'm having trouble getting it to work.
Any ideas what I could be missing?
[1] http://docs.adobe.com/docs/en/aem/6-0/develop/sightly/use-api-in-java.html
Solved! Go to Solution.
Views
Replies
Total Likes
The data-sly-use attribute uses the class name for java files, which are case sensitive. Looks like you used
data-sly-use.topbanner="c03_topbanner"
Rather than
data-sly-use.topbanner="C03_topbanner"
Hopefully that fixes your error.
Views
Replies
Total Likes
The data-sly-use attribute uses the class name for java files, which are case sensitive. Looks like you used
data-sly-use.topbanner="c03_topbanner"
Rather than
data-sly-use.topbanner="C03_topbanner"
Hopefully that fixes your error.
Views
Replies
Total Likes
Does you class implement the WCMUse interface, and does it have an activate method? I have seen where that was an issue that generated the same error.
Views
Replies
Total Likes
Yes. Here's my dummy code so far:
package apps.abc.components.modular.c03_topbanner; import com.adobe.cq.sightly.WCMUse; import com.day.cq.wcm.api.components.DropTarget.CSS_CLASS_PREFIX; public class C03_topbanner extends WCMUse { private String cssClass; @Override public void activate() throws Exception { cssClass = DropTarget.CSS_CLASS_PREFIX; } public String getCssClass() { return cssClass; } }
Views
Replies
Total Likes
I got it to work now. I'm actually not sure what solved it in the end because I was pretty sure I had tested all these combinations. I changed the package and class name to "C03_topbanner".
Views
Replies
Total Likes
I am having a similar issue was wondering if someone could help.
Component is located in /apps/global-web/components/content/relatedlinks/
.java located in /apps/global-web/components/content/relatedlinks/MFPF.java (which extends WCMUse and I Override activate() )
package name is apps.global_web.components.content.relatedlinks
class name is MFPF
sightly file (/apps/global-web/components/content/relatedlinks/relatedlinks.html) calls the java class as such: data-sly-use.mfpf="MFPF"
I actually shortened the class name down to MFPF in case there was some sort of weird length limit and have tried multiple variations.
Any thoughts?
Views
Replies
Total Likes
Have you tried commenting out everything to narrow it down? I've had the same error message one time and it turned out there was just a java error that never showed up anywhere..
Views
Replies
Total Likes
Do you see your class to be compiled in /var/classes?
Otherwise I would try to move it to an OSGi-bundle to see if that works, then you know the Use-class is fine.
Views
Replies
Total Likes
Thanks for the responses guys. I have stripped it down to bare bones to try and get it to compile so this is what I have in the class currently:
package apps.global_web.components.content.relatedlinks
import com.adobe.cq.sightly.WCMUse;
public class MFPF extends WCMUse {
private String testVal;
@Override
public void activate() throws Exception {
//testVal = "I can write a class that actually works!";
}
/*public String getTestVal() {
return testVal;
}*/
}
I just checked var/classes and no I do not see anything in there. Would it be in/near the root or would it setup a similar folder structure to the one that is existing in there (in this class's case apps/global_web/etc...) ?
Views
Replies
Total Likes
OK, so we found the error before dropping it over in an OSGi bundle, no semi-colon on the package.
Views
Replies
Total Likes
Nice one! :-) Great that this is now resolved.
Views
Replies
Total Likes
Views
Likes
Replies