0

I have an exposed GraphDB instance in an ip address and port with http protocol. I want to make it more secure so I decided to expose it through https and a domain (with the port included in it). The problem is when I try to call the instance from Java code with the library rdf4j, if I the ip address and port as repository endpoint the code connects perfectly and adds the statements, nevertheless, if I set the domain as endpoint it returns a timeout. This is the code I am using:

HTTPRepository repository = new HTTPRepository("https://example.com", "repository_name");    
RepositoryConnection dataSource = repository.getConnection();
dataSource.add(statements);

This is the thrown exception:

org.apache.http.conn.HttpHostConnectException: Connect to example.com:80 [example.com/"here there is the resolved ip address"] failed: Connection timed out: connect

Rdf4j uses apache http library which supports https connection. However, in the exception the port 80 is shown, that's make my think it is attacking the port without considering the https at the begining of the address.

If more information is required I can add it.

  • It's a bit hard to see what's going with not seeing the actual urls and ports you're using, but at a guess, I'd say you need to add the port your https service is running on to the URL in your Java code. – Jeen Broekstra Oct 04 '20 at 22:18
  • Same result, I already added the secure port in the endpoint. is rdf4j prepared to manage https connection? in the documentation almost nothing is commented about this. – Fernando Luján Martínez Oct 05 '20 at 08:59
  • I am not aware of anything in RDF4J that would stop you from using HTTPS, and I'm pretty sure I have seen succesful setups using it in the past. – Jeen Broekstra Oct 09 '20 at 02:30
  • Have you tried using a `RepositoryProvider` to obtain a `RepositoryManager` and connections from it? We've used it with HTTPS accessed GraphDB without any issues (even using username/password authentication). – kidney Oct 10 '20 at 16:15
  • I tried as @kidney comments but I still gets the same exception. The exception is thrown during the call of the method add. IF you have some example code I will apreciate it. – Fernando Luján Martínez Oct 17 '20 at 15:17
  • Ok, I checked with our server admin and I have another hint: check that HTTPS configuration and certificate paths are set in `graphdb.properties`. The only other issue I can think of is incorrect proxy setting on the server... – kidney Oct 19 '20 at 08:41
  • I am using https://github.com/SODALITE-EU/semantic-reasoner/blob/master/source%20code/semantic-reasoner/reasoning-engine/src/main/java/kb/repository/SodaliteRepository.java#L34 RemoteManager, but it does not work with HTTPS, any idea? – zoe vas Jan 25 '22 at 08:32

0 Answers0