Using HttpClient = Error importing OSGI bundle from Eclispe
Hi Everyone,
I hope someone can help.
Im trying to import a servlet into CQ via maven and getting an error which I dont understand. My servlet is using HttpClient to call a third party api.
When I import via maven I get the following error
16.09.2013 12:36:08.210 *ERROR* [OsgiInstallerImpl] org.apache.sling.servlets.resolver.internal.SlingServletResolver bindServlet: Servlet service not available from reference [javax.servlet.Servlet, javax.servlet.ServletConfig, java.io.Serializable]
Here is my code
@Component(immediate = true, metatype = false, description = "Darren Test") @Service @Properties({ @Property(name = "sling.servlet.paths", value = "/bin/darrentest") }) /** * How to send a request via proxy using {@link HttpClient}. * * @since 4.0 */ public class DarrenTest extends SlingSafeMethodsServlet { /** * */ private static final long serialVersionUID = 1L; private final int connectionTimeoutMillis = 5000; private final int socketTimeoutMillis = 5000; protected final void doGet(final SlingHttpServletRequest request, final SlingHttpServletResponse response) throws ServletException, IOException { HttpClient httpClient = new DefaultHttpClient(); HttpParams httpParams = httpClient.getParams(); httpParams.setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3,false)); HttpConnectionParams.setConnectionTimeout(httpParams, connectionTimeoutMillis); HttpConnectionParams.setSoTimeout(httpParams, socketTimeoutMillis);
Can anyone help me unsertand what is going on here?