Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7047233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:44:47+00:00 2026-05-28T02:44:47+00:00

I am trying to connect to a mongodb through mongolabs REST interface in the

  • 0

I am trying to connect to a mongodb through mongolabs REST interface in the android app I’m developing, but it is not connecting, and instead it is throwing an exception (or at least i think it is). I am not familiar with backends, so if I am making a fatal rookie’s mistake, please forgive me. This is the logcat

01-10 16:28:50.377: W/System.err(630): javax.net.ssl.SSLException: hostname in certificate didn’t match: != OR OR >01-10 16:28:50.377: W/System.err(630): at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:185) 01-10 >16:28:50.388: W/System.err(630): at org.apache.http.conn.ssl.BrowserCompatHostnameVerifier.verify(BrowserCompatHostnameVerifier.java:54)

Below is the part of MongoLabHelper class i wrote to access the database and get items like names

HttpClient client;
JSONObject db;

MongoLabHelper() throws ClientProtocolException, IOException, JSONException{
    client = new DefaultHttpClient();
    HttpGet request = new HttpGet("https://api.mongolab.com/api/1/databases/breadcrumbs/collections/crumbs?apiKey=xxxxxxxxxxxxx");
    HttpResponse response = client.execute(request);
    HttpEntity entity = response.getEntity();
    InputStream in = entity.getContent();
    String json = in.toString();
    db = new JSONObject(json); 
}

public String getName(String name) throws JSONException {
    JSONObject doc = db.getJSONObject(name);
    return doc.getString("name");               
}

and here is part the class it is used in

   public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    String name = "Crumb Not Available";

    MongoLabHelper help;
    try {
        help = new MongoLabHelper();
        name = help.getName("Chipotle");
    } catch (ClientProtocolException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (JSONException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }




    setContentView(R.layout.breadcrumb);
    TextView crumbName = (TextView) findViewById(R.id.crumb_name);
    crumbName.setText(name);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T02:44:47+00:00Added an answer on May 28, 2026 at 2:44 am

    You actually need to explicitly setup the HttpClient to handle SSL. I believe this stackoverflow thread has the information you need:

    Secure HTTP Post in Android

    I’ll copy the relevant bit of code from the thread for convenience:

    private HttpClient createHttpClient()
    {
        HttpParams params = new BasicHttpParams();
        HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
        HttpProtocolParams.setContentCharset(params, HTTP.DEFAULT_CONTENT_CHARSET);
        HttpProtocolParams.setUseExpectContinue(params, true);
    
        SchemeRegistry schReg = new SchemeRegistry();
        schReg.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
        schReg.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));
        ClientConnectionManager conMgr = new ThreadSafeClientConnManager(params, schReg);
    
        return new DefaultHttpClient(conMgr, params);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to connect to a mongodb instance through a python socket. The url
Am trying to connect the App Delegate to the View Controller in Xcode4, but
I am trying to connect to a Microsoft SQL 2005 server which is not
I'm trying to execute this: <?php // connect $m = new Mongo(); ?> But
Trying to connect to a SQL Server 2005 instance remotely but getting the following
Well guys, I'm trying to get that MongoDB feature working for hours: http://www.mongodb.org/display/DOCS/Http+Interface I
I'm trying to connect to mongodb in php. There's no problem if mongodb is
Am trying to connect to a remote system which is not in the same
I am running into a weird error when trying connect to mongodb. I am
Im trying to connect to the Magento 1.4.0.1 API, but until now I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.