Errors trying to implement Adobe Helpx RESTful Services example
I'm trying to implement the example found at: https://helpx.adobe.com/experience-manager/using/restful-services.html , however, I keep getting the "Unexpected token <", due to the server probably returning a 404 or some other HTML error code. I followed the article and implemented it step by step in a 5.6.1 environment. When I initially imported my OSGI bundle containing the org.apache.httpclient jars, it was running/active, but now, it is only listed as "Installed", and when I click on the "start/run" button, I get the error shown below. After I couldn't get that service running, I installed the example 6.1 package in an AEM 6.1 environment, and it was working initially, but after uninstalling, re-installing and restarting the server, I can't get the associated OSGI services started anymore. They are in a "Installed" state, but won't start. Please help.
1. I'm also a little confused as to what my OSGI bundle should list in the manifest under "Export-package" and "Import-package".
Errors from 5.6.1 error.log:
An error occurred at line: 20 in the jsp file: /apps/dev-sandbox/components/restService/query.json.jsp com.adobe.restservice.Distance cannot be resolved to a type 17: String filter = request.getParameter("filter"); 18: 19: // Instatiate an instance of the appropriate service using Sling 20: com.adobe.restservice.Distance googleTagService = sling.getService(com.adobe.restservice.Distance.class); 21: 22: // Invoke the service 23: String jsonResponse = googleTagService.getDistance() ; at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:388) at org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:171) at org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:463) at org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:508) at org.apache.sling.engine.impl.filter.SlingComponentFilterChain.render(SlingComponentFilterChain.java:45) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:64) at com.day.cq.wcm.core.impl.WCMDebugFilter.doFilterWithErrorHandling(WCMDebugFilter.java:182) at com.day.cq.wcm.core.impl.WCMDebugFilter.doFilter(WCMDebugFilter.java:149) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60) at com.day.cq.wcm.core.impl.WCMComponentFilter.filterRootInclude(WCMComponentFilter.java:356) at com.day.cq.wcm.core.impl.WCMComponentFilter.doFilter(WCMComponentFilter.java:168) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60) at com.day.cq.personalization.impl.TargetComponentFilter.doFilter(TargetComponentFilter.java:96) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60) at org.apache.sling.engine.impl.SlingRequestProcessorImpl.processComponent(SlingRequestProcessorImpl.java:254) at org.apache.sling.engine.impl.filter.RequestSlingFilterChain.render(RequestSlingFilterChain.java:49) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:64) at com.day.cq.wcm.core.impl.AuthoringUIModeServiceImpl.doFilter(AuthoringUIModeServiceImpl.java:301)-------------
Errors from the 6.1 error.log:
31.01.2016 03:10:10.802 *INFO* [OsgiInstallerImpl] org.apache.sling.installer.core.impl.tasks.BundleInstallTask Exception during install of bundle TaskResource(url=jcrinstall:/apps/restservice/osgi-bundles/install/restful-bundle-1.0-SNAPSHOT.jar, entity=bundle:com.adobe.restservice.restful-bundle, state=INSTALL, attributes=[org.apache.sling.installer.api.tasks.ResourceTransformer=:24:43:21:, Bundle-SymbolicName=com.adobe.restservice.restful-bundle, Bundle-Version=1.0.0.SNAPSHOT], digest=1454226994663) : Bundle installation rejected by hook.. Retrying later. org.osgi.framework.BundleException: Bundle installation rejected by hook. at org.apache.felix.framework.Felix.installBundle(Felix.java:3123) at org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:167) at org.apache.sling.installer.core.impl.tasks.BundleInstallTask.execute(BundleInstallTask.java:47) at org.apache.sling.installer.core.impl.OsgiInstallerImpl.doExecuteTasks(OsgiInstallerImpl.java:847) at org.apache.sling.installer.core.impl.OsgiInstallerImpl.executeTasks(OsgiInstallerImpl.java:689) at org.apache.sling.installer.core.impl.OsgiInstallerImpl.run(OsgiInstallerImpl.java:265) at java.lang.Thread.run(Thread.java:745) 31.01.2016 03:10:55.334 *ERROR* [qtp552317373-248] org.apache.felix.http.jetty %bundles.pluginTitle: Cannot start (org.osgi.framework.BundleException: Unresolved constraint in bundle RestFulDep [448]: Unable to resolve 448.0: missing requirement [448.0] osgi.wiring.package; (osgi.wiring.package=javax.security.auth.x500)) org.osgi.framework.BundleException: Unresolved constraint in bundle RestFulDep [448]: Unable to resolve 448.0: missing requirement [448.0] osgi.wiring.package; (osgi.wiring.package=javax.security.auth.x500) at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4095) at org.apache.felix.framework.Felix.startBundle(Felix.java:2114) at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:977) at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:964) at org.apache.felix.webconsole.internal.core.BundlesServlet.doPost(BundlesServlet.java:365) at javax.servlet.http.HttpServlet.service(HttpServlet.java:644) at javax.servlet.http.HttpServlet.service(HttpServlet.java:725) --------- And also ------- An error occurred at line: 5 in the jsp file: /apps/restservice/components/page/templateRest/query.json.jsp com.adobe.restservice.Distance cannot be resolved to a type 2: <%@ page import="org.apache.sling.commons.json.io.*,org.w3c.dom.*" %><% 3: String filter = request.getParameter("filter"); 4: 5: com.adobe.restservice.Distance cs = sling.getService(com.adobe.restservice.Distance.class); 6: 7: String myJSON= cs.getDistance() ; 8: at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:388) at org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:171) at org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:463) at org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:533) at org.apache.sling.engine.impl.filter.SlingComponentFilterChain.render(SlingComponentFilterChain.java:44) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:77)



