Not able to establish box connection with proxy configuration
Hi,
Can anyone help on how to connect to Boxapi with proxy. I am using below method to connect to BoxApi.
BoxDeveloperEditionAPIConnection appUserAPI = null;
File configFile = new File(configFilePath);
Reader reader = new FileReader(configFilePath);
BoxConfig config = BoxConfig.readFrom(reader);
Proxy proxy = new Proxy(Type.HTTP, new InetSocketAddress("xx.xx.xx.xx",xxxx));
appUserAPI = BoxDeveloperEditionAPIConnection.getAppUserConnection("xxxxxxxxx", config);
appUserAPI.setProxy(proxy);
appUserAPI.authenticate();
It is working fine when i run in eclipse without any issue.
but when i run the application through cmd It is throwing below error:
Caused by: com.box.sdk.BoxAPIException: Couldn't connect to the Box API due to a network error.
at com.box.sdk.BoxAPIRequest.writeBody(BoxAPIRequest.java:468)
at com.box.sdk.BoxAPIRequest.trySend(BoxAPIRequest.java:545)
at com.box.sdk.BoxAPIRequest.send(BoxAPIRequest.java:354)
at com.box.sdk.BoxAPIRequest.send(BoxAPIRequest.java:329)
at com.box.sdk.BoxDeveloperEditionAPIConnection.authenticate(BoxDeveloperEditionAPIConnection.java:358)
at com.box.sdk.BoxDeveloperEditionAPIConnection.getAppUserConnection(BoxDeveloperEditionAPIConnection.java:251)
at com.box.sdk.BoxDeveloperEditionAPIConnection.getAppUserConnection(BoxDeveloperEditionAPIConnection.java:283)
at com.bt.sfdc.box.app.configuration.BoxAccessTokenProviderConfig.getBoxConnection(BoxAccessTokenProviderConfig.java:65)
at com.bt.sfdc.box.app.configuration.BoxAccessTokenProviderConfig$$EnhancerBySpringCGLIB$$768c9cd6.CGLIB$getBoxConnection$0(<generated>)
at com.bt.sfdc.box.app.configuration.BoxAccessTokenProviderConfig$$EnhancerBySpringCGLIB$$768c9cd6$$FastClassBySpringCGLIB$$dcb35aad.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
at com.bt.sfdc.box.app.configuration.BoxAccessTokenProviderConfig$$EnhancerBySpringCGLIB$$768c9cd6.getBoxConnection(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
... 28 common frames omitted
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.security.ssl.SSLSocketImpl.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.<init>(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.New(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(Unknown Source)
at com.box.sdk.BoxAPIRequest.writeBody(BoxAPIRequest.java:457)
Thanks
サインインしてコメントを残してください。
コメント
0件のコメント