<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:52:40 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[JAVA-600] Getting com.mongodb.MongoException: can&apos;t find a master exception on AWS</title>
                <link>https://jira.mongodb.org/browse/JAVA-600</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;Hello, We are trying to deploy our app on AWS. We are running a replica set configuration with 2 data nodes and 1 arbiter. Same configuration works fine on local environment but throws following exception on AWS&lt;/p&gt;

&lt;p&gt;com.mongodb.MongoException: can&apos;t find a master&lt;br/&gt;
	com.mongodb.DBTCPConnector.checkMaster(DBTCPConnector.java:434)&lt;br/&gt;
	com.mongodb.DBTCPConnector.call(DBTCPConnector.java:209)&lt;br/&gt;
	com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:305)&lt;br/&gt;
	com.mongodb.DBCollection.findOne(DBCollection.java:647)&lt;br/&gt;
	com.mongodb.DBCollection.findOne(DBCollection.java:626)&lt;br/&gt;
	com.mongodb.DBApiLayer$MyCollection.createIndex(DBApiLayer.java:364)&lt;br/&gt;
	com.mongodb.DBCollection.createIndex(DBCollection.java:436)&lt;br/&gt;
	com.mongodb.DBCollection.ensureIndex(DBCollection.java:515)&lt;br/&gt;
	com.google.code.morphia.DatastoreImpl.ensureIndex(DatastoreImpl.java:245)&lt;br/&gt;
	com.google.code.morphia.DatastoreImpl.ensureIndexes(DatastoreImpl.java:310)&lt;br/&gt;
	com.google.code.morphia.DatastoreImpl.ensureIndexes(DatastoreImpl.java:279)&lt;br/&gt;
	com.google.code.morphia.DatastoreImpl.ensureIndexes(DatastoreImpl.java:340)&lt;br/&gt;
	com.google.code.morphia.DatastoreImpl.ensureIndexes(DatastoreImpl.java:333)&lt;br/&gt;
	com.intuit.spark.MongoConnectionManager.&amp;lt;init&amp;gt;(MongoConnectionManager.java:37)&lt;/p&gt;


&lt;p&gt;Here is the config of replia set&lt;br/&gt;
PRIMARY&amp;gt; rs.config()&lt;br/&gt;
{&lt;br/&gt;
	&quot;_id&quot; : &quot;sparkReplicaSet&quot;,&lt;br/&gt;
	&quot;version&quot; : 5,&lt;br/&gt;
	&quot;members&quot; : [&lt;br/&gt;
		&lt;/p&gt;
{
			&quot;_id&quot; : 0,
			&quot;host&quot; : &quot;ip-10-46-223-117:27017&quot;
		}
&lt;p&gt;,&lt;br/&gt;
		&lt;/p&gt;
{
			&quot;_id&quot; : 1,
			&quot;host&quot; : &quot;ip-10-46-167-177.ec2.internal:27017&quot;
		}
&lt;p&gt;,&lt;/p&gt;
		{
			&quot;_id&quot; : 2,
			&quot;host&quot; : &quot;domU-12-31-39-04-D6-95.compute-1.internal:27017&quot;,
			&quot;arbiterOnly&quot; : true
		}
&lt;p&gt;	]&lt;br/&gt;
}&lt;/p&gt;


&lt;p&gt;I have installed mongo shell on the app server(TOMCAT) host and I am able to connect to PRIMARY via the shell, that rules out networking issue. &lt;/p&gt;

&lt;p&gt;The code which gets the connection string is as follows&lt;br/&gt;
      List&amp;lt;ServerAddress&amp;gt; addrs = getMongoAddress();	&lt;br/&gt;
      m = new Mongo(addrs);&lt;br/&gt;
      morphia = new Morphia();&lt;/p&gt;

&lt;p&gt;addrs List is created using &lt;br/&gt;
ec2-23-22-74-137.compute-1.amazonaws.com:27017&lt;br/&gt;
ec2-23-23-87-249.compute-1.amazonaws.com:27017&lt;br/&gt;
ec2-23-22-156-48.compute-1.amazonaws.com:27017&lt;/p&gt;

&lt;p&gt;What are we missing in all this? Same code works on 3 node replica set on local machine. Here is config from my local setup&lt;br/&gt;
PRIMARY&amp;gt; rs.config()&lt;br/&gt;
{&lt;br/&gt;
	&quot;_id&quot; : &quot;sparkdb&quot;,&lt;br/&gt;
	&quot;version&quot; : 3,&lt;br/&gt;
	&quot;members&quot; : [&lt;br/&gt;
		&lt;/p&gt;
{
			&quot;_id&quot; : 0,
			&quot;host&quot; : &quot;MPKL09407ef8d.local:27017&quot;
		}
&lt;p&gt;,&lt;br/&gt;
		&lt;/p&gt;
{
			&quot;_id&quot; : 1,
			&quot;host&quot; : &quot;MPKL09407ef8d.local:27088&quot;
		}
&lt;p&gt;,&lt;/p&gt;
		{
			&quot;_id&quot; : 2,
			&quot;host&quot; : &quot;MPKL09407ef8d.local:27098&quot;
		}
&lt;p&gt;	]&lt;br/&gt;
}&lt;/p&gt;


&lt;p&gt;Thanks&lt;br/&gt;
Sankate&lt;/p&gt;</description>
                <environment>Amazon web services</environment>
        <key id="43844">JAVA-600</key>
            <summary>Getting com.mongodb.MongoException: can&apos;t find a master exception on AWS</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</type>
                                            <priority id="1" iconUrl="https://jira.mongodb.org/images/icons/priorities/blocker.svg">Blocker - P1</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="3">Duplicate</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="sankate_sharma@intuit.com">Sankate Sharma</reporter>
                        <labels>
                            <label>driver</label>
                            <label>replicaset</label>
                    </labels>
                <created>Tue, 10 Jul 2012 20:33:11 +0000</created>
                <updated>Wed, 11 Sep 2019 19:13:01 +0000</updated>
                            <resolved>Tue, 10 Jul 2012 21:25:39 +0000</resolved>
                                    <version>2.7.3</version>
                                                    <component>Connection Management</component>
                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="141576" author="kristina" created="Tue, 10 Jul 2012 21:33:02 +0000"  >&lt;p&gt;Can the appserver connect to the members of the replica set using the hostnames in the config, as well?  (domU-12-31-39-04-D6-95.compute-1.internal:27017, ip-10-46-167-177.ec2.internal:27017, and ip-10-46-223-117:27017?)&lt;/p&gt;</comment>
                            <comment id="141570" author="sankate_sharma@intuit.com" created="Tue, 10 Jul 2012 21:25:51 +0000"  >&lt;p&gt;Hi Kristina&lt;/p&gt;

&lt;p&gt;Yes, I am able to connect to all three nodes from shell. Here is the output of rs.status()&lt;/p&gt;

&lt;p&gt;PRIMARY&amp;gt; rs.status()&lt;br/&gt;
{&lt;br/&gt;
	&quot;set&quot; : &quot;sparkReplicaSet&quot;,&lt;br/&gt;
	&quot;date&quot; : ISODate(&quot;2012-07-10T21:23:30Z&quot;),&lt;br/&gt;
	&quot;myState&quot; : 1,&lt;br/&gt;
	&quot;members&quot; : [&lt;br/&gt;
		{&lt;br/&gt;
			&quot;_id&quot; : 0,&lt;br/&gt;
			&quot;name&quot; : &quot;ip-10-46-223-117:27017&quot;,&lt;br/&gt;
			&quot;health&quot; : 1,&lt;br/&gt;
			&quot;state&quot; : 1,&lt;br/&gt;
			&quot;stateStr&quot; : &quot;PRIMARY&quot;,&lt;br/&gt;
			&quot;optime&quot; : &lt;/p&gt;
{
				&quot;t&quot; : 1341950670000,
				&quot;i&quot; : 1
			}
&lt;p&gt;,&lt;br/&gt;
			&quot;optimeDate&quot; : ISODate(&quot;2012-07-10T20:04:30Z&quot;),&lt;br/&gt;
			&quot;self&quot; : true&lt;br/&gt;
		},&lt;br/&gt;
		{&lt;br/&gt;
			&quot;_id&quot; : 1,&lt;br/&gt;
			&quot;name&quot; : &quot;ip-10-46-167-177.ec2.internal:27017&quot;,&lt;br/&gt;
			&quot;health&quot; : 1,&lt;br/&gt;
			&quot;state&quot; : 2,&lt;br/&gt;
			&quot;stateStr&quot; : &quot;SECONDARY&quot;,&lt;br/&gt;
			&quot;uptime&quot; : 132059,&lt;br/&gt;
			&quot;optime&quot; : &lt;/p&gt;
{
				&quot;t&quot; : 1341950670000,
				&quot;i&quot; : 1
			}
&lt;p&gt;,&lt;br/&gt;
			&quot;optimeDate&quot; : ISODate(&quot;2012-07-10T20:04:30Z&quot;),&lt;br/&gt;
			&quot;lastHeartbeat&quot; : ISODate(&quot;2012-07-10T21:23:30Z&quot;),&lt;br/&gt;
			&quot;pingMs&quot; : 3&lt;br/&gt;
		},&lt;br/&gt;
		{&lt;br/&gt;
			&quot;_id&quot; : 2,&lt;br/&gt;
			&quot;name&quot; : &quot;domU-12-31-39-04-D6-95.compute-1.internal:27017&quot;,&lt;br/&gt;
			&quot;health&quot; : 1,&lt;br/&gt;
			&quot;state&quot; : 7,&lt;br/&gt;
			&quot;stateStr&quot; : &quot;ARBITER&quot;,&lt;br/&gt;
			&quot;uptime&quot; : 130936,&lt;br/&gt;
			&quot;optime&quot; : &lt;/p&gt;
{
				&quot;t&quot; : 0,
				&quot;i&quot; : 0
			}
&lt;p&gt;,&lt;br/&gt;
			&quot;optimeDate&quot; : ISODate(&quot;1970-01-01T00:00:00Z&quot;),&lt;br/&gt;
			&quot;lastHeartbeat&quot; : ISODate(&quot;2012-07-10T21:23:29Z&quot;),&lt;br/&gt;
			&quot;pingMs&quot; : 0&lt;br/&gt;
		}&lt;br/&gt;
	],&lt;br/&gt;
	&quot;ok&quot; : 1&lt;br/&gt;
}&lt;/p&gt;</comment>
                            <comment id="141554" author="kristina" created="Tue, 10 Jul 2012 21:02:49 +0000"  >&lt;p&gt;Did you try connecting with the shell using the hostnames Java&apos;s using in particular, i.e.,&lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;$ mongo ec2-23-22-74-137.compute-1.amazonaws.com:27017/test&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;$ mongo ec2-23-23-87-249.compute-1.amazonaws.com:27017/test&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;$ mongo ec2-23-22-156-48.compute-1.amazonaws.com:27017/test&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;and that works?&lt;/p&gt;

&lt;p&gt;Also, can you run &lt;tt&gt;rs.status()&lt;/tt&gt; once you&apos;ve started the mongo shell and send the output?&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                                        </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrhb0n:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>14585</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>