Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Spring with Hibernate Integrating Hibernate with Spring Add JPA Annotations to Entities

Chris Jones
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Chris Jones
Java Web Development Techdegree Graduate 23,933 Points

java.net.ConnectException: Connection refused: connect

I am getting this error when I run bootRun. The only thing I've changed from the GitHub project is the giflib.db.url property in the app.properties file. That property is correct, because I can connect to the database with the browser like Chris shows in this video. Here is the app.properties file in case it helps.

# Hash salt for shortened URLs
giflib.hash.salt = xOBtdmJZxRcz^jkkyHfkrkT1*02bJUn+YQts0*xCeka%cGHCN1fjaC*faFtY

# Package where our entities (models) are located
giflib.entity.package = com.teamtreehouse.giflib.model

# Details for our datasource
giflib.db.driver = org.h2.Driver
# giflib.db.url = jdbc:h2:mem:giflib
giflib.db.url = jdbc:h2:tcp://localhost/C:/Users/my_name/IdeaProjects/giflib-hibernate/data/giflib
giflib.db.username = sa
giflib.db.password =

Any help would be appreciated! I'm at a loss since I can connect to the database via the browser using the same properties.

Here is part of the exception, if it helps.

Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method) ~[na:1.8.0_111]
    at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85) ~[na:1.8.0_111]
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_111]
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_111]
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_111]
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) ~[na:1.8.0_111]
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_111]
    at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_111]
    at org.h2.util.NetUtils.createSocket(NetUtils.java:122) ~[h2-1.4.191.jar:1.4.191]
    at org.h2.util.NetUtils.createSocket(NetUtils.java:102) ~[h2-1.4.191.jar:1.4.191]
    at org.h2.engine.SessionRemote.initTransfer(SessionRemote.java:114) ~[h2-1.4.191.jar:1.4.191]
    at org.h2.engine.SessionRemote.connectServer(SessionRemote.java:448) ~[h2-1.4.191.jar:1.4.191]
    ... 58 common frames omitted

1 Answer