Expand my Community achievements bar.

The type com.book.rental.modal.Book cannot be resolved. It is indirectly referenced from required .class files

Avatar

Level 2

Hi 

I created a maven based project and then created a OSGI bundle and uploaded in the bundle section (Using AdobeCQ 5.6). I am able to access the services and print a simple "Hello Welcomet o OSGI World". When i am trying to implement .getBookList() method where it has to feth all the latest books from repository and add to a Book (a pure pojo class with get set metods. It contains book details like book name, title,created date and description etc etc) object and pass on to UI. 

In JSP my code is 

<%@ page language="java" import="java.util.*,java.lang.*" %>
<%@ page import="com.pavan.book.*,com.pavan.adobe.*,com.book.rental.modal.*" %>

   <%
    try{

            com.pavan.adobe.BookRentalServices services =   sling.getService(com.pavan.adobe.BookRentalServices.class);

              out.println("HeloooooooooooooooooogetLatestBooks() ooooo"+services.getMessage()); // Printing perfect out put. "Welcome to OSGI World"

             out.println("HeloooooooooooooooooogetLatestBooks() ooooo"+services.getLatestBooks());// Throwing error. Please see the error below.
}catch(Exception e){

    out.println(e);

}
%>

org.apache.sling.api.scripting.ScriptEvaluationException: org.apache.sling.scripting.jsp.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 31 in the jsp file: /apps/rental/components/pages/home/home.jsp The type com.book.rental.modal.Book cannot be resolved. It is indirectly referenced from required .class files 28:     // BookServices service = resource. adaptTo(BookServices.class); 29:      com.pavan.adobe.BookRentalServices services =   sling.getService(com.pavan.adobe.BookRentalServices.class); 30: out.println("Helooooooooooooooooooooooo"+service.getMessage()); 31:     out.println("HeloooooooooooooooooogetLatestBooks() ooooo"+services.getLatestBooks()); 32: }catch(Exception e){ 33: 34:     out.println(e);

 

I am not able to understand how to resolve this error. Please help out.

Please let me know if any one require more information

0 Replies