This JSP code:
var url = location.pathname.replace(".html", "/_jcr_content.query.json") + "?filter="+ filter;
sends a request to this JS file:
<%@include file="/libs/foundation/global.jsp"%>
<%@ page import="org.apache.sling.commons.json.io.*,org.w3c.dom.*" %><%
String filter = request.getParameter("filter");
com.adobe.aem.sql.CustomerServiceImp cs = new com.adobe.aem.sql.CustomerServiceImp();
String XML = cs.getCustomerData(filter);
//Send the data back to the client
JSONWriter writer = new JSONWriter(response.getWriter());
writer.object();
writer.key("xml");
writer.value(XML);
writer.endObject();
%>
This JS file creates an object of type com.adobe.aem.sql.CustomerServiceImp. This Java class is bundled in the OSGi that you created.
There are three places where something may be wrong:
1. You did not setup the connection class properly.
2. The drvier file is not bundled.
3. The main page JSP is not finding the query.js file.
Please post your log file - we can tell what is happening from that.