Inconsistent connection behaviour between AdminConnection and StardogRepository

1 view
Skip to first unread message

oklma...@gmail.com

unread,
Jul 14, 2015, 4:43:25 AM7/14/15
to sta...@clarkparsia.com
Hi,

I came across an inconsistent behaviour in the implementation of AdminConnection and StardogRepository when they connect to a URL with a default port 80.

For example, if Stardog is running at http://somehost/ and listens to port 80,  passing the URL http://somehost/ to AdminConnection will work, but StardogRepository will fail with a misleading error message "org.openrdf.repository.RepositoryException: Unable to obtain a connection to the Stardog database. The configuration could be incorrect or the database not available"

What I have discovered is when the port is not explicitly specified, StardogRepository will silently default to port 5820 while AdminConnection defaults to port 80. This explains why StardogRepository fails while AdminConnection works. The fix currently is to make the port explicit http://somehost:80 , and both StardogRepository and AdminConnection will work.

Is this difference in behaviour on purpose, or is this a bug that needs to be fixed ?

Michael Grove

unread,
Jul 14, 2015, 8:34:51 AM7/14/15
to stardog
On Tue, Jul 14, 2015 at 4:43 AM, <oklma...@gmail.com> wrote:
Hi,

I came across an inconsistent behaviour in the implementation of AdminConnection and StardogRepository when they connect to a URL with a default port 80.

For the record, AdminConnection and StardogRepository are not analogous in terms of functionality, Connection is the native Stardog equivalent to StardogRepository.  There's no Sesame equivalent for our admin connection.
 

For example, if Stardog is running at http://somehost/ and listens to port 80,  passing the URL http://somehost/ to AdminConnection will work, but StardogRepository will fail with a misleading error message "org.openrdf.repository.RepositoryException: Unable to obtain a connection to the Stardog database. The configuration could be incorrect or the database not available"

What I have discovered is when the port is not explicitly specified, StardogRepository will silently default to port 5820 while AdminConnection defaults to port 80. This explains why StardogRepository fails while AdminConnection works. The fix currently is to make the port explicit http://somehost:80 , and both StardogRepository and AdminConnection will work.

Is this difference in behaviour on purpose, or is this a bug that needs to be fixed ?

The issue is that when creating an AdminConnection over HTTP we use the default of the URL (80) when no port is specified rather than the expected Stardog default (5820).  I have created issue #2391 for this, and in the next release AdminConnection via HTTP will default to the default Stardog port like Connection does.

Cheers,

Mike
 

--
-- --
You received this message because you are subscribed to the C&P "Stardog" group.
To post to this group, send email to sta...@clarkparsia.com
To unsubscribe from this group, send email to
stardog+u...@clarkparsia.com
For more options, visit this group at
http://groups.google.com/a/clarkparsia.com/group/stardog?hl=en

oklma...@gmail.com

unread,
Jul 14, 2015, 10:01:52 AM7/14/15
to sta...@clarkparsia.com
Thanks for the clarification on AdminConnection and StardogRepository difference.

It seems odd to me about the choice to diverge from the HTTP conventional default port in favour of Stardog's 5820 when no port is specified. This will catch a lot of users by surprise (it certainly got me and took me about a day to troubleshoot). I discovered this problem when putting Stardog behind a Load Balancer that listens on port 80. It is most common that we do not typically specify a port when assuming the default HTTP port. 

For your consideration :)
Reply all
Reply to author
Forward
0 new messages