Re: Null URI when testing the project

14 views
Skip to first unread message

Carleton Moore

unread,
Mar 25, 2015, 8:00:43 AM3/25/15
to wattdep...@googlegroups.com
It looks like the database URL has a typo.  I think it should be postgres://ubuntu:ubuntu@localhost:5432/wattdepot. You need the two // to make it a URL. 
See if that fixes the problem.

On Tue, Mar 24, 2015 at 12:43 PM Ke Ning <nin...@gmail.com> wrote:
Hi,

Hope you could help me out here. I am new to Java. Here is my environment. I have to lower my java version from 1.8 to 1.7, otherwise I got different error.

$ mvn -version
Apache Maven 3.3.1 (cab6659f9874fa96462afef40fcf6bc033d58c1c; 2015-03-13T20:10:27+00:00)
Maven home: /usr/local/apache-maven-3.3.1
Java version: 1.7.0_75, vendor: Oracle Corporation
Java home: /usr/java/jdk1.7.0_75/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.13.0-46-generic", arch: "amd64", family: "unix"
ubuntu@ip-172-31-19-246:~/wattdepot/wattdepot-3.0.2$ ^C
ubuntu@ip-172-31-19-246:~/wattdepot/wattdepot-3.0.2$ mvn -version
Apache Maven 3.3.1 (cab6659f9874fa96462afef40fcf6bc033d58c1c; 2015-03-13T20:10:27+00:00)
Maven home: /usr/local/apache-maven-3.3.1
Java version: 1.7.0_75, vendor: Oracle Corporation
Java home: /usr/java/jdk1.7.0_75/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.13.0-46-generic", arch: "amd64", family: "unix"



And, I downloaded source from release page wattdepot-3.0.2. 

$ mvn test

Running org.wattdepot.server.TestStrongAES
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.857 sec - in org.wattdepot.server.TestStrongAES
Running org.wattdepot.server.depository.impl.hibernate.TestWattDepotPersistenceImpl
>>> postgres:/ubuntu:ubuntu@localhost:5432/wattdepot                     // Here is my print for the url string
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.021 sec <<< FAILURE! - in org.wattdepot.server.depository.impl.hibernate.TestWattDepotPersistenceImpl
org.wattdepot.server.depository.impl.hibernate.TestWattDepotPersistenceImpl  Time elapsed: 0.021 sec  <<< ERROR!
java.lang.NullPointerException: null
        at org.wattdepot.server.ServerProperties.processDatabaseURL(ServerProperties.java:380)       // It crashed here in original code String username = dbUri.getUserInfo().split(":")[0];
        at org.wattdepot.server.ServerProperties.initializeProperties(ServerProperties.java:260)
        at org.wattdepot.server.ServerProperties.<init>(ServerProperties.java:134)
        at org.wattdepot.server.ServerProperties.<init>(ServerProperties.java:122)
        at org.wattdepot.server.depository.impl.hibernate.TestWattDepotPersistenceImpl.setupImpl(TestWattDepotPersistenceImpl.java:73)



Could you give me some pointers?

Thank you so much!

--
You received this message because you are subscribed to the Google Groups "wattdepot-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wattdepot-use...@googlegroups.com.
To post to this group, send email to wattdep...@googlegroups.com.
Visit this group at http://groups.google.com/group/wattdepot-users.
For more options, visit https://groups.google.com/d/optout.

Ke Ning

unread,
Mar 25, 2015, 9:50:49 AM3/25/15
to wattdep...@googlegroups.com
Thanks Carleton!  

It looks like that was in the wattdepot-server.properties release file. We might want to correct that.

## WattDepot database uri. format postgres:/<db.username>:<db.password>@<database-host>:<database-port>/<database-name>
# wattdepot-server.database.url=postgres:/myuser:secret@localhost:5432/wattdepot

Carleton Moore

unread,
Mar 25, 2015, 11:38:12 AM3/25/15
to wattdep...@googlegroups.com
I'll fix it when I get back home.
Reply all
Reply to author
Forward
0 new messages