<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:56:29 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-2158] Java+Spark+Mongodb+web app+heroku</title>
                <link>https://jira.mongodb.org/browse/JAVA-2158</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;I am making a web application with java and mongodb on Heroku. But I keep getting error like this:&lt;br/&gt;
1:38:42 AM web.1 |  Exception in thread &quot;main&quot;&lt;br/&gt;
1:38:42 AM web.1 |  java.lang.NullPointerException&lt;br/&gt;
1:38:42 AM web.1 |  	at com.mongodb.MongoClientURI.&amp;lt;init&amp;gt;(MongoClientURI.java:174&#8230;&lt;br/&gt;
1:38:42 AM web.1 |  	at com.mongodb.MongoClientURI.&amp;lt;init&amp;gt;(MongoClientURI.java:159&#8230;&lt;br/&gt;
1:38:42 AM web.1 |  	at Main.main(Main.java:32)&lt;br/&gt;
I have searching and trying for more than ten hours. Please help me with this issue. &lt;/p&gt;</description>
                <environment>Mac Pro, heroku</environment>
        <key id="275032">JAVA-2158</key>
            <summary>Java+Spark+Mongodb+web app+heroku</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</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="9">Done</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="zhugerock@gmail.com">Junwei Zhuge</reporter>
                        <labels>
                            <label>connection</label>
                            <label>crash</label>
                    </labels>
                <created>Fri, 25 Mar 2016 06:28:42 +0000</created>
                <updated>Wed, 11 Sep 2019 19:13:48 +0000</updated>
                            <resolved>Tue, 29 Mar 2016 09:06:39 +0000</resolved>
                                    <version>2.11.3</version>
                                                    <component>Build</component>
                    <component>Connection Management</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="1217713" author="ross@10gen.com" created="Tue, 29 Mar 2016 09:06:39 +0000"  >&lt;p&gt;Closing as this is a question better suited to the wider MongoDB Java community.&lt;/p&gt;</comment>
                            <comment id="1217712" author="ross@10gen.com" created="Tue, 29 Mar 2016 09:06:10 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=zhugerock%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;zhugerock@gmail.com&quot;&gt;zhugerock@gmail.com&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Just to let you know the JAVA project is specifically for driver based bugs or issues. For questions please use the &lt;a href=&quot;https://groups.google.com/group/mongodb-user&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;mailing list&lt;/a&gt; or &lt;a href=&quot;http://stackoverflow.com/questions/tagged/mongodb&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;stackoverflow&lt;/a&gt; as you will reach the broader community.&lt;/p&gt;

&lt;p&gt;As stated in a previous comment there is a bug here: &lt;tt&gt;System.getenv(&quot;mongodb://heroku:111:10385/app45876994&quot;)&lt;/tt&gt; is the cause of the NPE - there is no environment variable called &lt;tt&gt;mongodb://heroku:111:10385/app45876994&lt;/tt&gt;.  If you have a &lt;tt&gt;MONGOHQ_URL&lt;/tt&gt; environment variable then update the code to use it eg:  &lt;tt&gt;System.getenv(&quot;MONGOHQ_URL&quot;)&lt;/tt&gt; or just pass the string URI to &lt;tt&gt;MongoClientURI&lt;/tt&gt;.&lt;/p&gt;
</comment>
                            <comment id="1216009" author="mallakimahdi" created="Sat, 26 Mar 2016 04:20:25 +0000"  >&lt;p&gt;Hi Junwei,&lt;/p&gt;

&lt;p&gt;that wasn&apos;t correct. change line 28 to this:&lt;br/&gt;
MongoClientURI uri = new MongoClientURI(&quot;mongodb://heroku:111:10385/app45876994&quot;);&lt;br/&gt;
instead of this:&lt;br/&gt;
MongoClientURI uri = new MongoClientURI(System.getenv(&quot;mongodb://heroku:111:10385/app45876994&quot;));&lt;/p&gt;</comment>
                            <comment id="1215480" author="zhugerock@gmail.com" created="Fri, 25 Mar 2016 17:58:37 +0000"  >&lt;p&gt;Hi Mahdi,&lt;/p&gt;

&lt;p&gt;Thank you very much for your time. I changed it to mongodb://user:passwd@host1:port1,host2:port2/dbname as I mentioned before this comment. Is that not correct? I changed the Main.java in the attachments. Please let me know if you have any suggestions, I will be very appreciated. &lt;/p&gt;</comment>
                            <comment id="1215430" author="mallakimahdi" created="Fri, 25 Mar 2016 17:21:48 +0000"  >&lt;p&gt;java can&apos;t access the MONGOHQ_URL variable that you used in line 32 of your code. maybe this is an alternative solution: new MongoClientURI(&quot;mongodb://heroku:111111@111:1111:11111/app45876994&quot;)&lt;/p&gt;</comment>
                            <comment id="1215353" author="zhugerock@gmail.com" created="Fri, 25 Mar 2016 15:59:55 +0000"  >&lt;p&gt;Hi mahdi, I changed this MONGOHQ_URL to mongodb://user:passwd@host1:port1,host2:port2/dbname, because I use MONGOHQ on Heroku, so I didn&apos;t use localhost. &lt;/p&gt;

&lt;p&gt;But I still get this error, almost the same error:&lt;/p&gt;

&lt;p&gt;11:17:05 AM web.1 |  SLF4J: Class path contains multiple SLF4J bindings.&lt;br/&gt;
11:17:05 AM web.1 |  SLF4J: Found binding in [jar:&lt;a href=&quot;file:/Users/zhugejunwei/full-sta&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;file:/Users/zhugejunwei/full-sta&lt;/a&gt;&#8230;&lt;br/&gt;
11:17:05 AM web.1 |  SLF4J: Found binding in [jar:&lt;a href=&quot;file:/Users/zhugejunwei/full-sta&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;file:/Users/zhugejunwei/full-sta&lt;/a&gt;&#8230;&lt;br/&gt;
11:17:05 AM web.1 |  SLF4J: See &lt;a href=&quot;http://www.slf4j.org/codes.html#multiple_bindings&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://www.slf4j.org/codes.html#multiple_bindings&lt;/a&gt; &#8230;&lt;br/&gt;
11:17:05 AM web.1 |  SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerF&#8230;&lt;br/&gt;
11:17:05 AM web.1 |  Exception in thread &quot;main&quot; java.lang.NullPointerException&lt;br/&gt;
11:17:05 AM web.1 |  	at com.mongodb.ConnectionString.&amp;lt;init&amp;gt;(ConnectionString.java&#8230;&lt;br/&gt;
11:17:05 AM web.1 |  	at com.mongodb.MongoClientURI.&amp;lt;init&amp;gt;(MongoClientURI.java:176&#8230;&lt;br/&gt;
11:17:05 AM web.1 |  	at com.mongodb.MongoClientURI.&amp;lt;init&amp;gt;(MongoClientURI.java:158&#8230;&lt;br/&gt;
11:17:05 AM web.1 |  	at Main.main(Main.java:28)&lt;/p&gt;</comment>
                            <comment id="1215331" author="mallakimahdi" created="Fri, 25 Mar 2016 15:45:26 +0000"  >&lt;p&gt;in line 32 you used a system variable:&lt;br/&gt;
        MongoClientURI uri = new MongoClientURI(System.getenv(&quot;MONGOHQ_URL&quot;));&lt;/p&gt;

&lt;p&gt;I suggest you to use change above code to this:&lt;br/&gt;
        MongoClientURI uri = new MongoClientURI(&quot;mongodb://localhost:27017&quot;);&lt;br/&gt;
or&lt;br/&gt;
       MongoClient uri = new MongoClient(&quot;localhost&quot;, 27017);&lt;/p&gt;

&lt;p&gt;(27017 is mongodb default port )&lt;/p&gt;</comment>
                            <comment id="1215300" author="zhugerock@gmail.com" created="Fri, 25 Mar 2016 15:15:52 +0000"  >&lt;p&gt;It seems this log has never stopped. &lt;br/&gt;
```&lt;br/&gt;
2016-03-25T07:20:45.268343+00:00 heroku&lt;span class=&quot;error&quot;&gt;&amp;#91;api&amp;#93;&lt;/span&gt;: Deploy 67af248 by zhugerock@gmail.com&lt;br/&gt;
2016-03-25T07:20:45.433350+00:00 heroku&lt;span class=&quot;error&quot;&gt;&amp;#91;slug-compiler&amp;#93;&lt;/span&gt;: Slug compilation finished&lt;br/&gt;
2016-03-25T07:20:54.738554+00:00 heroku&lt;span class=&quot;error&quot;&gt;&amp;#91;router&amp;#93;&lt;/span&gt;: at=error code=H14 desc=&quot;No web processes running&quot; method=GET path=&quot;/&quot; host=aqueous-journey-2399.herokuapp.com request_id=816312a3-d0cb-4d59-969f-c3484d55d83c fwd=&quot;100.6.12.76&quot; dyno= connect= service= status=503 bytes=&lt;br/&gt;
2016-03-25T15:06:09.212397+00:00 heroku&lt;span class=&quot;error&quot;&gt;&amp;#91;slug-compiler&amp;#93;&lt;/span&gt;: Slug compilation started&lt;br/&gt;
2016-03-25T15:06:09.212402+00:00 heroku&lt;span class=&quot;error&quot;&gt;&amp;#91;slug-compiler&amp;#93;&lt;/span&gt;: Slug compilation finished&lt;br/&gt;
2016-03-25T15:06:09.008255+00:00 heroku&lt;span class=&quot;error&quot;&gt;&amp;#91;api&amp;#93;&lt;/span&gt;: Deploy 70353e7 by zhugerock@gmail.com&lt;br/&gt;
2016-03-25T15:06:09.008255+00:00 heroku&lt;span class=&quot;error&quot;&gt;&amp;#91;api&amp;#93;&lt;/span&gt;: Release v35 created by zhugerock@gmail.com&lt;br/&gt;
```&lt;/p&gt;

&lt;p&gt;It just keep logging the same issue. I don&apos;t know what that mean. Whatever I have changed in my project, it seems log the same issue, so annoying. Any help would be appreciated. &lt;/p&gt;</comment>
                            <comment id="1215280" author="zhugerock@gmail.com" created="Fri, 25 Mar 2016 14:57:11 +0000"  >&lt;p&gt;@mahdimallaki this is the result of my `cat .env`:&lt;br/&gt;
```&lt;br/&gt;
=== aqueous-journey-2399 Config Vars&lt;br/&gt;
DATABASE_URL:         postgres:/11111:111111@ec2-107-21-224-11.compute-1.amazonaws.com:5432/dcrsbkpptstngi&lt;br/&gt;
ENERGY:               20 GeV&lt;br/&gt;
JAVA_OPTS:            -XX:+UseCompressedOops&lt;br/&gt;
MONGOHQ_URL:          mongodb://heroku:111111@111:1111:11111/app45876994&lt;br/&gt;
MONGOLAB_URI:         mongodb:/1111:11111@ds01111.mlab.com:15111/heroku_9b1msnk8&lt;br/&gt;
PAPERTRAIL_API_TOKEN: awWCQ3yWa4xfpZ1cdBUh&lt;br/&gt;
PROD_MONGODB:         mongodb://heroku_9b1msnk8:qg4gd778v5o71j63bleh4ir0c0@ds015869.mlab.com:15869/heroku_9b1msnk8&lt;br/&gt;
```&lt;br/&gt;
I use *&lt;b&gt;1111&lt;/b&gt;* replace username and password.&lt;/p&gt;

&lt;p&gt;I am new to mongodb and heroku, can you explain more clearly what &lt;b&gt;&apos;MONGOHQ_URL&apos; variable&lt;/b&gt; mean? There is *&lt;b&gt;MONGOHQ_URL&lt;/b&gt;* in the .env&lt;/p&gt;</comment>
                            <comment id="1215156" author="mallakimahdi" created="Fri, 25 Mar 2016 09:50:32 +0000"  >&lt;p&gt;you didn&apos;t set &apos;MONGOHQ_URL&apos; variable in your system.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="115082" name="Main.java" size="1365" author="zhugerock@gmail.com" created="Fri, 25 Mar 2016 17:57:58 +0000"/>
                            <attachment id="115016" name="pom.xml" size="4021" author="zhugerock@gmail.com" created="Fri, 25 Mar 2016 06:29:48 +0000"/>
                    </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|hsjrnr:</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>