I am a newbie to CRXDE so please forgive me if this is a stupid question to ask.
There were errors reported in CRXDE eclipse that some of the classes were missing or cannot be resolved. Please see code below (error msgs were added as comments):
in libs/wcm/core/components/designer/designer.css.java
import com.day.text.Text; //The import com.day.text cannot be resolved
import org.apache.sling.api.SlingHttpServletRequest;//The import org.apache.sling.api.SlingHttpServletRequest cannot be resolved
import org.apache.sling.api.SlingHttpServletResponse;//The import org.apache.sling.api.SlingHttpServletResponse cannot be resolved
import org.apache.sling.api.resource.Resource;//The import org.apache.sling.api.resource.Resource cannot be resolved
import org.apache.sling.api.servlets.SlingSafeMethodsServlet;//The import org.apache.sling.api.servlets cannot be resolved
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Renders the computed css styles
*/
public class designer_css extends SlingSafeMethodsServlet {//The public type designer_css must be defined in its own file ; SlingSafeMethodsServlet cannot be resolved to a type
/**
* default logger
*/
private static final Logger log = LoggerFactory.getLogger(designer_css.class);
protected void doGet(SlingHttpServletRequest req, SlingHttpServletResponse resp) //SlingHttpServletRequest cannot be resolved to a type; SlingHttpServletResponse cannot be resolved to a type
throws ServletException, IOException {
resp.setContentType("text/css");
resp.setCharacterEncoding("utf-8");
This also happens in jsp files, such as: in libs/cq/core/components/login/login.jsp
<%@page session="false"
contentType="text/html; charset=utf-8"
import="org.apache.sling.api.resource.Resource, //The import org.apache.sling.api cannot be resolved
org.apache.commons.lang.StringUtils,//The import org.apache.commons.lang cannot be resolved
com.day.cq.i18n.I18n"%><%
%><%@taglib prefix="cq" uri="http://www.day.com/taglibs/cq/1.0" %><%
%><cq:defineObjects /><%!
private String getOverlayCssPath(Resource resource, String fileName) {
String path = resource.getPath() + fileName;
// snip off 1. segment
path = path.substring(path.indexOf("/", 1)+1);
Resource res = resource.getResourceResolver().getResource(path);
if (res != null) {
return res.getPath();
} else {
return path;
}
}
And I am not sure which jar file I should include for these missing packages and where I can find them.
Everything is fine in CRXDE Lite.
Does anyone know how to resolve this issue? Thanks in advance.
-Donald
Firstly you need to check whether jars are available in form of dependencies inside you .m2 folder, If you are using maven. If not, the add the dependencies inside you pom.xml. To check the correct version of dependency use below link :
localhost:4502/system/console/depfinder
And mention the package/class name e.g org.apache.sling.api.SlingHttpServletRequest . Then rebuild you project using mvn clean ... May be this will solve your issue for bundle classes.