I have developed a Java application that uses ArangoDB as backend database (Used ArangoDB Java-Driver/Interface to access ArangoDB).
Everything is good until my ArangoDB and Application resides on same machine.
Once i moved ArangoDB to remote machine(Dedicated Server), my application is unable to access it :(
I have given my remote machine details(ArangoDB Server) in some properties file and feeding that file location to ArangoConfigure Constructor while creating ArangoDriver Object. But still i'm unable to access ArangoDB :(
Small snippet of my code is below:
protected static ArangoConfigure getConfiguration() {
//ArangoConfigure configure = new ArangoConfigure();
ArangoConfigure configure = new
ArangoConfigure("/Volumes/Official/ZLabs/arangodb.properties");
configure.init();
return configure; }
protected static ArangoDriver getArangoDriver(ArangoConfigure
configuration) { return new ArangoDriver(configuration); }
Please help me in this regard.
Awaiting your response.
Thanks & Best Regards,
- Mahi
First of all thank you #dothebart for all your help.
#dothebart, I have checked all the details that you have mentioned, before i posted here. Only thing is missed is HTTP connectivity thanks for pointing that.
Actually the below code change has fixed the problem for me.
Earlier code:
ArangoConfigure configure = new ArangoConfigure("/home/arango.properties");
configure.init();
ArangoDriver driver = new ArangoDriver(configuration);
Modified Code:
ArangoConfigure configure = new ArangoConfigure("/home/arango.properties");
ArangoHost hostObj = new ArangoHost(<IP-Address>, 8529);
configure.setArangoHost(hostObj);
configure.setUser(<user-name>);
configure.setPassword(<password>);
configure.init();
ArangoDriver driver = new ArangoDriver(configuration);
Setting up of host, username and password again is making it to work :(
File has all the details, then why should i provide them again.. I didn't understand that.
#dothebart i'm unable to find the log file, please let me know where can i find it.
If the Aranngodb Java driver fails to open or parse /Volumes/Official/ZLabs/arangodb.properties it issues a log message.
If arangodb properties looks like that:
port=8529
host=192.168.22.17
user=root
password=OpenSesame
enableCURLLogger=false
You start walking up the OSI model to debug TCP connection problems to evade possible connection issues due to firewals, routing etc.
One uses the commonly available telnet command to test the availability of the server:
telnet 192.168.22.17 8529
Trying 192.168.22.17...
If it sits there forever, you most probably have a firewall filtering you away, you finaly will get:
telnet: Unable to connect to remote host: Connection timed out
If it immediately exits with:
telnet: Unable to connect to remote host: Connection refused
It seems the server doesn't answer.
On the server side you then can check whether the service has bound the port (8529) you're trying to connect:
netstat -alpnt |grep 8529
tcp 0 0 0.0.0.0:8529 0.0.0.0:* LISTEN 19912/arangod
If you instead see it binding 127.0.0.1:8529 you won't be able to connect it remotely and need to change arangod.conf like this:
[server]
endpoint = tcp://0.0.0.0:8529
And then restart ArangoDB. Then, you should be able to see something like this:
telnet 192.168.22.17 8529
Trying 192.168.22.17...
Connected to 192.168.22.17.
Escape character is '^]'. <start to type now: >
GET / HTTP/1.0
<server should reply:>
HTTP/1.1 301 Moved Permanently
Location: /_db/_system/_admin/aardvark/index.html
Content-Type: text/html
Server: ArangoDB
Connection: Close
Content-Length: 197
<html><head><title>Moved</title></head><body><h1>Moved</h1>
<p>This page has moved to /_db/_system/_admin/aardvark/index.html.
</p></body></html>Connection closed by foreign host.
This looks like the properties-file isn't found in the classpath.
The path of the log-file should be configured in your log-configuration-file in your project.
Your project may use for example Logback (logback.xml) or another slf4j implementation.
Related
We are using grpc spring boot starter on our Java application service in order to establish a connection to another 'server' service, so I define in the application.properties the following address:
grpc.client.name.address=static://service-name:port
When tried to connect it I got the following error message:
StatusRuntimeException: UNAVAILABLE: io exception
So I know for sure I have a connectivity issue. On the documentation it says regarding the static scheme:
A simple static list of IPs (both v4 and v6), that can be use connect to the server
So I guess this is not what I need to use. It seems the best option in my case is using the discovery scheme, but it doesn't contains any port...
What is the right scheme configuration I need to use to set the server address?
Wanted to share the resolution for this very annoying issue for those who will encounter the same problem in the future like I did.
So first, the scheme needs to be set indeed of dns type, like the following: grpc.client._name_.address=dns:///<service-name>:26502
but this alone is not enough. (at least in my case) The server was configured to run in PLAINTEXT, while my client, by default, was configured to run with TLS mode, so it must be set with grpc.client.__name__.negotiationType=PLAINTEXT property.
See the following documentation for further information
It caused by gRPC can't resolve addresss service-name:port;
If you use static, the value must be ip:port; The service-name need to be resolved as ip address;
If you are using register center like consul or eureka etc., you should use discovery:///service-name without specify port.
If you didn't use register center, only end to end with server, replace service-name as a ip like 127.0.0.1 which belong to server;
Or modify host config for parse service-name like below, the file on Linux is /etc/hosts
127.0.0.1 service-name
I am working on app (android) that is supposed to visit website & retrieve some data from there. I was thinking it would be nice to use tor so I would not leave so much info about myself.
I've completed scraping part and everything works. Problem is, i can not make proxy accessing internet. I wanted to use Orbot as proxy. I always get 405 error and text:
"this is an http connect tunnel, not a full http proxy it appears you have configured your browser to use this tor port as an http proxy this is not correct: this port is configured as connect tunnel, not an http proxy. please configure your client accordingly. you can also use https; then the client should automatically use http connect"
Code:
UserAgent agent = new UserAgent();
agent.setProxyHost("127.0.0.1");
agent.setProxyPort(8118);
agent.visit("http://stackoverflow.com");
I've tried
System.setProperty("http.proxyHost", "127.0.0.1");
System.setProperty("http.proxyPort", "8118");
instead of the two middle lines from previous code as well plus few other probably not smart things (: and nothing has helped.
From error text about connect tunnel and proxy I figured problem is somewhere in networking but although I searched about it, I couldn't fix it. Perhaps something in Orbot's settings?
My question is, what am I missing please? :)
I need some help with doing netty socket io over https. I have got it to in my local env but not on a server with secure domain. The server starts but client isn't able to connect. Tried by starting the socket server with IP as well as domain name. For the server to start with domain name as hostname value in setHostname method, I added an entry in /etc/hosts file as following
127.0.0.1 localhost example.com
Socket server started by giving example.com as hostname but client isn't able to connect using the same hostname over https as following
var socket = io.connect('https://example.com:10443')
Tried with options - { secure: true, reconnect: true, rejectUnauthorized : false } too but the same issue.
On server side my configuration is as following
Configuration configuration = new Configuration();
configuration.setHostname("example.com");
configuration.setPort(10443);
configuration.setKeyStorePassword("mypassword");
InputStream stream = getClass().getClassLoader().getResourceAsStream("keystore.jks");
configuration.setKeyStore(stream);
The jsk file was created using keytool command for the same domain (example.com)
Is there something more to be done for the port - 10443 to be used by the socket server? Or is there any other configuration to be done?
Got the solution! I had not mentioned that the domain was set up on cloudflare. Here the issue was with the port I used - 10443. It's not supported by cloudflare. Changed it to 8443 and it worked!
For those who come across this, please find here the list of supported ports that Cloudflare work with. May save much of your time unlike me.
Also, please note that I used my public IP as hostname in setHostname() method so that I don't need anything added in my hosts file. Then gave the actual domain name with https on client side to connect to the server. That's it. Thank you all!
Sandeep
I run my Solr engine on Ubuntu 14.04 in VirtualBox. The guest operating system is connect to local network. It has this IP address: 192.168.10.102.
I'm trying to connect with Solr engine using my browser. I'm going to http://192.168.10.102:8983/solr/ and everything is works.
I wrote an application in Java (with SolrJ). I try to connect to the Solr engine and delete everything. The code looks like this:
server = new HttpSolrServer("http://192.168.10.102:8983/solr/");
server.deleteByQuery("*:*");
server.commit();
Sadly I get an exception:
[main] INFO org.apache.solr.client.solrj.impl.HttpClientUtil -
Creating new http client,
config:maxConnections=128&maxConnectionsPerHost=32&followRedirects=false
Exception in thread "main" org.apache.solr.common.SolrException:
Server at http://192.168.10.102:8983/solr returned non ok status:404,
message:Not Found at
org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:372)
at
org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:181)
at
org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:117)
at
org.apache.solr.client.solrj.SolrServer.deleteByQuery(SolrServer.java:285)
at
org.apache.solr.client.solrj.SolrServer.deleteByQuery(SolrServer.java:271)
...
Everything is good when I comment deleteByQuery() and commit() functions.
How can I solve it?
You have to create any collection your url should look like http://192.168.10.102:8983/solr/collection1 and then you can try do something
I have configured a proxy in my java source code as:
systemSettings.put("http.proxyHost", "www.proxyserver.com");
systemSettings.put("http.proxyPort", "8080");
systemSettings.put("http.nonProxyHosts", "10.x.y.z");
Here 10.x.y.z is the actual IP of my weblogic server.
But whenever code tried to connect to weblogic server, I receive error as:
Caused by: java.net.ConnectException: t3://10.x.y.z:7001: Destination
unreachable; nested exception is: java.net.ProtocolException:
unrecognized response from proxy: 'HTTP/1.0 403 Forbidden'; No
available router to destination at
weblogic.rjvm.RJVMFinder.findOrCreateInternal(RJVMFinder.java:216) at
weblogic.rjvm.RJVMFinder.findOrCreate(RJVMFinder.java:170) at
weblogic.rjvm.ServerURL.findOrCreateRJVM(ServerURL.java:153) at
weblogic.jndi.WLInitialContextFactoryDelegate$1.run(WLInitialContextFactoryDelegate.java:345)
at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
at
weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:340)
It seems that setting http.nonProxyHosts is not working as expected. I tried to find solution over the Internet, but most of them says remove proxy settings. I can not remove proxy, as my code tries to connect to some of the Internet URLs. Also note that, weblogic server is on remote machine.
Can you please give me a hint, what must be the issue here?
Have a look at this OTN thread.
From 3rd comment :
You are setting nonProxyHosts, which doesn't exist as a system property, via System.setProperties().
I haven't read all so far, but it seems the system.properties is not the convenient way to set
nonProxyHosts.
Did you tried to set it from command line ?
-Dhttp.nonProxyHosts="*.foo.com|localhost".
I resolved the issue. I had setup the proxy initially when connection with weblogic was setup. So due to some network restrictions I believe it didnt work. In modified code, I used the same 3 lines to setup proxy:
System.setProperty("java.net.useSystemProxies", "false");
System.setProperty("http.proxyHost", "www.proxyserver.com");
System.setProperty("http.proxyPort", "8080");
The only difference is, I did it at exact place where I needed. So for initial connection setup with weblogic proxy wont be used. I also did not have to bypass, weblogic server URL to not to use proxy.
#Arcadien: I appreciate your efforts to help me. Thanks.