SoftInstigate / restheart

Rapid API Development with MongoDB
https://restheart.org
GNU Affero General Public License v3.0
807 stars 171 forks source link

Config file error gives NullPointerException #138

Closed kalahari closed 8 years ago

kalahari commented 8 years ago

I am attempting to start RESTHeart 2.0.1 with a config file I built, clearly there is an issue with my config file, but the config error handler is itself throwing an exception:

Exception in thread "main" java.lang.NullPointerException
        at org.restheart.Bootstrapper.main(Bootstrapper.java:122)

It would be good to get the real source of the problem instead of the NPE.

kalahari commented 8 years ago

Submitted pull request #139 to resolve this issue.

kalahari commented 8 years ago

I know the suspense is hard to bear, so here's what the output looks like with the above fix in place:

14:08:53.825 [main] INFO  org.restheart.Bootstrapper - Starting RESTHeart instance null
14:08:53.827 [main] INFO  org.restheart.Bootstrapper - version 2.0.2-SNAPSHOT
14:08:53.831 [main] ERROR org.restheart.Bootstrapper - wrong parameter mongo-uri, exiting...
org.restheart.ConfigurationException: wrong parameter mongo-uri
        at org.restheart.Configuration.<init>(Configuration.java:706)
        at org.restheart.Configuration.<init>(Configuration.java:642)
        at org.restheart.utils.FileUtils.getConfiguration(FileUtils.java:72)
        at org.restheart.utils.FileUtils.getConfiguration(FileUtils.java:67)
        at org.restheart.Bootstrapper.main(Bootstrapper.java:117)
Caused by: java.lang.IllegalArgumentException: The connection string is invalid. Connection strings must start with 'mongodb://'
        at com.mongodb.ConnectionString.<init>(ConnectionString.java:203)
        at com.mongodb.MongoClientURI.<init>(MongoClientURI.java:176)
        at com.mongodb.MongoClientURI.<init>(MongoClientURI.java:158)
        at org.restheart.Configuration.<init>(Configuration.java:704)
        ... 4 common frames omitted
14:08:53.855 [main] INFO  org.restheart.Bootstrapper - Stopping RESTHeart...
14:08:53.858 [main] INFO  org.restheart.Bootstrapper - Cleaning up temporary directories...
14:08:53.907 [main] INFO  org.restheart.Bootstrapper - RESTHeart stopped

Sure enough, I fat-fingered the connection string in the config file.

mkjsix commented 8 years ago

Thank you @kalahari, your PR has been merged. If you need some help with the configuration please let us know, otherwise feel free to close this issue.

kalahari commented 8 years ago

I was able to correct my configure issue, cheers!