<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 09:02:05 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-4437] GettingClusterSettings.getSrvHost() method not found error on application deployment while upgrading mongo java driver from 3.11.2 to 4.2.3 </title>
                <link>https://jira.mongodb.org/browse/JAVA-4437</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;Getting method not found error  java.lang.NoSuchMethodError: com.mongodb.connection.ClusterSettings.getSrvHost() on application deployement after mongo java driver upgrade from mongo-java-driver 3.11.2 to mongodb-driver-core 4.2.3 mongodb-driver-sync 4.2.3 &lt;/p&gt;

&lt;p&gt;Spring boot version : 2.5.8&lt;br/&gt;
&lt;b&gt;threw exception; nested exception is java.lang.NoSuchMethodError: com.mongodb.connection.ClusterSettings.getSrvHost()Ljava/lang/String;&lt;/b&gt;&lt;/p&gt;</description>
                <environment></environment>
        <key id="1958746">JAVA-4437</key>
            <summary>GettingClusterSettings.getSrvHost() method not found error on application deployment while upgrading mongo java driver from 3.11.2 to 4.2.3 </summary>
                <type id="6" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14720&amp;avatarType=issuetype">Question</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</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="13202">Works as Designed</resolution>
                                        <assignee username="jeff.yemin@mongodb.com">Jeffrey Yemin</assignee>
                                    <reporter username="vijaych@yopmail.com">VIjay Chauhan</reporter>
                        <labels>
                            <label>external-user</label>
                    </labels>
                <created>Wed, 5 Jan 2022 13:27:42 +0000</created>
                <updated>Fri, 27 Oct 2023 13:20:54 +0000</updated>
                            <resolved>Thu, 6 Jan 2022 12:58:40 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="4278182" author="jeff.yemin" created="Thu, 6 Jan 2022 13:43:57 +0000"  >&lt;p&gt;The exception you&apos;re getting is not an issue with the driver itself, so this is probably not the place to be asking this question anymore.&#160; Nevertheless, I referred your question to our colleagues on the Spring Data team.&#160; If they have any information, they will respond.&lt;/p&gt;</comment>
                            <comment id="4278125" author="JIRAUSER1264235" created="Thu, 6 Jan 2022 13:12:03 +0000"  >&lt;p&gt;Hiii,&lt;br/&gt;
I am using modern API only import com.mongodb.client.MongoClient; ,import com.mongodb.client.MongoClients only there are no compile time error but I am getting runtime error on deployment that* &lt;b&gt;Caused by: java.lang.NoClassDefFoundError: com/mongodb/MongoClient Caused by: java.lang.ClassNotFoundException: com.mongodb.MongoClient&lt;/b&gt;*&lt;/p&gt;

&lt;p&gt;I had mongo-java-driver 3.12.1 and spring-data-mongodb 2.2.5.RELEASE spring-boot-starter-parent 2.2.5.RELEASE previously&lt;/p&gt;


&lt;p&gt;Is there is any change or dependency we are missing or anything we are doing wrong please let us know the reason for such runtime error.&lt;br/&gt;
now I have upgraded to &lt;/p&gt;

&lt;p&gt;mongodb-driver-sync-4.2.3 spring-data-mongodb 3.2.3 spring-boot-starter-parent 2.5.8 no compilation error with this but getting runtime error of class not found without using legacy &lt;/p&gt;</comment>
                            <comment id="4278109" author="jeff.yemin" created="Thu, 6 Jan 2022 12:58:25 +0000"  >&lt;p&gt;If you&apos;re using the legacy &lt;tt&gt;com.mongodb.MongoClient&lt;/tt&gt; instead of the more recently added&#160;&lt;tt&gt;com.mongodb.client.MongoClient&lt;/tt&gt;, you&apos;ll need to also take a dependency on mongodb-driver-legacy.&lt;/p&gt;</comment>
                            <comment id="4277833" author="JIRAUSER1264235" created="Thu, 6 Jan 2022 07:33:29 +0000"  >&lt;p&gt;Hi I found that old dependency of version 3.3.0 was used in project so after removal of that the issue is resolved now there is no old dependency is present only mongodb-driver-core 4.2.3 mongodb-driver-sync 4.2.3 and spring-data-mongodb-3.2.3 is present &lt;/p&gt;

&lt;p&gt;Now this error is observed:&lt;br/&gt;
*Caused by: java.lang.NoClassDefFoundError: com/mongodb/MongoClient&lt;br/&gt;
    Caused by: java.lang.ClassNotFoundException: com.mongodb.MongoClient*&lt;/p&gt;

&lt;p&gt;Spring boot version : 2.5.8&lt;/p&gt;</comment>
                            <comment id="4276311" author="jeff.yemin" created="Wed, 5 Jan 2022 15:34:30 +0000"  >&lt;p&gt;I suspect that what&apos;s happening is that when you moved from the uber jar (mongo-java-driver) to the non-uber jar (mongodb-driver-sync), you exposed a dependency on an earlier release (pre-3.10, where that method was added) of either mongodb-driver-core or mongo-java-driver.  You&apos;ll need to check your dependencies/classpath to see where it&apos;s coming from.  One way to do that is to enable verbose class loading (&lt;a href=&quot;https://stackoverflow.com/questions/10230279/java-verbose-class-loading&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://stackoverflow.com/questions/10230279/java-verbose-class-loading&lt;/a&gt;) to determine from which jar &lt;tt&gt;ClusterSettings&lt;/tt&gt; is being loaded.&lt;/p&gt;

&lt;p&gt;Please let us know what you find.&lt;/p&gt;</comment>
                            <comment id="4275958" author="JIRAUSER1264235" created="Wed, 5 Jan 2022 13:31:56 +0000"  >&lt;p&gt;On further debugging, looks like  it is getting this error from DefaultClusterFactory.createCluster() method, &lt;br/&gt;
 if (&lt;b&gt;clusterSettings.getSrvHost()&lt;/b&gt; == null) &lt;/p&gt;
{
                return new MultiServerCluster(clusterId, clusterSettings, serverFactory);
            }
&lt;p&gt; else &lt;/p&gt;
{
                return new DnsMultiServerCluster(clusterId, clusterSettings, serverFactory, dnsSrvRecordMonitorFactory);
            }</comment>
                    </comments>
                    <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|hzz5af:</customfieldvalue>

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