Hi All,
I am trying to add a Java component bean to an AEM 6.3 component in Eclipse.
I have added the following Java class to the "core" section in the Eclipse project :-
package test;
import com.adobe.cq.sightly.WCMUsePojo;
public class TestComponentBean extends WCMUsePojo
{
@Override
public void activate() throws Exception
{
}
public String getContent()
{
return "TEST CONTENT";
}
}
I have added the following HTML to the page template in the "ui.apps" section in the Eclipse project :-
<div data-sly-use.componentBean="${'test.TestComponentBean'}">
<p> ${componentBean.content} </p>
</div>
The project appears to build and deploy to the AEM 6.3 server correctly.
When I view the page template, I am seeing the following error in the browser in the page source :-
org.apache.sling.scripting.sightly.SightlyException: Cannot find a file corresponding to class test.TestComponentBean in the repository.
Please can you advise me why the class test.TestComponentBean cannot be found and how can I resolve this problem?
Thank you for your time.
Solved! Go to Solution.
Views
Replies
Total Likes
could you please check bundle org.apache.commons.lang3
and update the same in POM file in <Import-Package></Import-Package>
or download new version of Apache Commons Lang bundle(3.7) and install in Felix console.
Views
Replies
Total Likes
Please check below:
1. your bundle is active or not
2. check bundle manifest export-package header
3. Instantiate Java object in HTL like below:
<div data-sly-use.componentBean="test.TestComponentBean"></div>
Thanks
Arun
Views
Replies
Total Likes
Thanks Arun,
I've had a look in http://localhost:4502/system/console/bundles
The package is "Installed" but not "Active".
In the Imported Packages section is the following error :-
org.apache.commons.lang3,version=[3.7,4) -- Cannot be resolved
Do you know how I can resolve this error?
Thank you again for your time.
Views
Replies
Total Likes
could you please check bundle org.apache.commons.lang3
and update the same in POM file in <Import-Package></Import-Package>
or download new version of Apache Commons Lang bundle(3.7) and install in Felix console.
Views
Replies
Total Likes
Thanks. It is working now. If I have any more questions I will open a new questions.
Views
Replies
Total Likes
Views
Likes
Replies