I'm trying to connect to salesforce from a java application. I was earlier getting a login error as follows which was resolved by setting the appropriate proxy settings.
com.sforce.ws.ConnectionException: Failed to send request to https://login.salesforce.com/services/Soap/c/29.0
Now, I'm getting the following error:
com.sforce.ws.ConnectionException: Failed to send request to https://ap1.salesforce.com/services/Soap/m/29.0/00D90000000q0ZR
at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:121)
at com.sforce.soap.metadata.MetadataConnection.describeMetadata(MetadataConnection.java:281)
at integration.IntegrationClass.describeMetadata(IntegrationClass.java:80)
at integration.IntegrationClass.main(IntegrationClass.java:26)
Caused by: java.net.ConnectException: Connection refused: connect
Any ideas on how to resolve this error? Thanks!
UPDATE: I tried the code at my home (free from the restrictions of the office firewalls et al :) ) and found that the code ran successfully. Any ideas about changes that I should make to do the same at the company. As I already said, I added the config.setProxy(host, port) which allowed me to successfully log in, but not access the application. I have also enabled proxy from eclipse using Preferences -> General -> Network Connections. What am I missing?
Thanks a lot for your help. Cheers!
Ok, I got the solution and it's kinda silly, but since I didn't spot it anywhere else inspite of seeing similar questions, I'm going to post the solution.
The ConnectorConfig config = new ConnectorConfig(); is used multiple times; in my case, it is first used to login using new EnterpriseConnection(config)).login(username, password); and next to obtain a metadata connection using new MetadataConnection(config);. Since I'm creating 2 ConnectorConfig objects, I would need to use the setProxy method on both, which I...forgot. Hope this solution helps other people having the same problem.
Cheers!
Related
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 am trying to evaluate ofbiz ( v17.2.03 ) just now. I can access it via https://127.0.0.1:8443/.../ from local machine (192.168.110.182) but not from other machines. The error message is like(from Chrome),
org.apache.ofbiz.webapp.control.RequestHandlerException: Domain
192.168.110.182 not accepted to prevent host header injection.
No idea at all, and please if someone can help with this.
You need to set host-headers-allowed property in security.properties file. I'll make the error message more explicit!
Update: done with
https://github.com/apache/ofbiz-framework/commit/3c9fe5f91684de54570e6ec61575c11368a2ffd6/
https://github.com/apache/ofbiz-framework/commit/d0fceffadda57dbe6e87398c47b4a575bc33137d/
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.
My code was working fine with out any exception, i recently connected to a server , in my code i just changed the server host name, username and password. i got the following exception
javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: Certificates does not conform to algorithm constraints
When i googled , i found that we have to change the file Java\jre7\lib\security\java.security i referred this link click here.
But if we develop a client application this solution is not good enough. Is there any better way to resolve this problem.
Any help is appreciable
I am trying to connect java to MySQL.when i try to connect,it shows the error message:
But i don't know where the error is.I am using windows 7.Netbeans 6.5.1.please help.
and when i click on start:
and this opens:
what to set in this??
UPDATE:
Its strange that Derby is getting connected:
and i din't provide any username and password.
download heidisql from follwing link
http://heidisql.googlecode.com/files/HeidiSQL_7.0_Setup.exe
and try to connect to your mysql using heidisql. If its success then use the same properties(username,password etc) in netbeans too...
The error is saying 'Access denied for user', so it means that the username/password you provided are not correct.
Probably you did something wrong with the configuration. Recreate the connection and test it before clicking Finish.
I've just tried to do this with my local MySql and Netbeans:
The connection was successful. If you can't succeed the connection at this point, then check if the database exists, and check your username and password you are providing for the connection.