Java SFTP client application in Cloud Foundary Environment - java

I have a java application ,which trasfters a file to SFTP server.
Our application use jsch for implementation of sftp client in java.
Jsch requires below parameters to connect to a SFTP server:
Host name of SFTP server: XX.XX.XXX.XXX
Port : 22
Username : abc
Password : ****
My application is working fine and transferring the file when I deploy it on Unix boxes or run in my local machine.
Now I am going to deploy the application on Cloud Foundry, but this is giving me ConnectException.
2018-03-14T19:07:40.41+0530 [APP/PROC/WEB/0] OUT com.jcraft.jsch.JSchException: java.net.ConnectException: Connection refused (Connection refused)
I have updated the security group :
{
"destination": "XX.XX.XXX.XXX",
"protocol": "tcp",
"ports": "22"
}
PS:
"protocol": "sftp" is invalid ,so I gave "protocol": "tcp"
Cloud foundary(Private cloud) and SFTP server both are in my local premises.
I read about volume services but ,I did not find any clue. We do not have marketplace accessible, so If volume service can help then we will have to build those service.
Queries:
How can I access my SFTP server via a application which is deployed on Cloud Foundry?

Related

Couldn't connect to vault server using e2vault api in java

am trying to connect to our vault server hosted in a know IP using vault api "e2vault.jar" through my java application.
*note:
I can connect to the server remotly. so my device ip are connected to the server
When i use the runnable jar of my application in the vault server, i works successfully
*
sample code:
VaultClient vaultClient = new VaultClient();
vaultClient.connect("Vault_Server_IP", 6002);

IntelliJ Community, remote debugging on server with user and password

I have a java maven application. I want to remote debug this application on server. Im using IntellJ Community. I tried to connect to localhost jar by -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 and all works great. But now I want to debug application which is on remote server (I login into this server by Microsoft Remote Server by passing ip, user and password.) I run jar on server with argument from code snippet, but in intellij I get an error ("Connection timed out"). Is it any possibility to connect with host by user and password (in intellij debug configuration I only can set host and port)?

spring server cannot connect to redis using jedis client

I am getting this issue when I deploy redis server and spring server in two different servers and try to connect to spring server through my application.
App Details:
We have mobile application which publish gps coordinates to spring server using stomp. In the spring server we create jedis pubsub connection and publish those gps data to our web application and web users subscribe to those jedis pubsub connections.
Library versions:
stomp:1.7.1
jedis: 2.8.1
spring: 4.3.0
Working scenarios:
*Deploy spring server in my local machine and redis server in remote production server.
*Deploy spring server in remote server and redis server in same remote server where spring server is deployed.
Partially Working scenarios:
*Deploy spring server in remote server and redis server in different remote server where spring server is deployed. In this scenario I monitor redis server using redis cli and I can see the "HGETALL", "PUBLISH" key words with its data. But the same time I got following error in spring server:
Caused by:
java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at redis.clients.jedis.Connection.connect(Connection.java:158)
... 4 more
redis.clients.jedis.exceptions.JedisConnectionException: java.net.ConnectException: Connection refused (Connection refused)
at redis.clients.jedis.Connection.connect(Connection.java:164)
at redis.clients.jedis.BinaryClient.connect(BinaryClient.java:80)
at redis.clients.jedis.Connection.setTimeoutInfinite(Connection.java:68)
at redis.clients.jedis.Jedis.subscribe(Jedis.java:2626)
at shipxpress.pubsubservice.controllers.SubscriberThread.run(MainController.java:227)
The spring server can successfully depoyed to the server and exception occurs when jedis try to publish or subscripe to the connection.
I can succesfully ping to redis server from the server where we deploy the spring server through the redis-cli and the redis server prtected-mode is no and and bind ip is set to 0.0.0.0
Links:
I went through following links but no luck
Redis bind to more than one IP
https://github.com/xetorthio/jedis/issues/1405
Cannot connect to redis using jedis
This issue means that the Spring remote server is not able to communicate with the other remote server(Redis server) on the default Redis port.
Maybe you could confirm this by trying to access the Remote Redis server from the other remote Server using netstat from the console.
I had the same issue, and the simplest solution was
Find the following line in your redis.conf file and comment it out:
bind 127.0.0.1
By adding a # in front of it:
# bind 127.0.0.1
and change the line protected-mode yes to be protected-mode no
save your redis.conf and restart redis using the config file
redis-server /configFileLocation

How to access Apache Mina sshd sftp server from remote machine

I start up sftp server using Apache Mina Sshd Api. please refer follow link to see more details about my local SFTP server.Link.
I tried to connect to that server from remotely by giving host name as my ip address but i couldn't enable to connect with the sftp server. I got "connection refused" error message.But i can connect locally.To connect locally i use winscp sftp client giving my host name as "localhost" but in remotely i can not give host name as localhost.So i gave host name as my machine IP address.When i gave that i got above error message.
So i would like to know that how can i connect with my local sftp server from remote machine.
Thank you.
Hi finally found out How to access Apache Mina sshd sftp server from remote machine. The problem was on my Apache Mina sshd sftp server set up.You can refer attached link to see my Apache Mina sshd sftp server details.
In there previously i set host as sshd.setHost("localhost"); instead of that i changed it into sshd.setHost(0.0.0.0);.So now you can access your local sftp server providing your machine ip address as a host name from remote machine.

Failed to connect to a valid mail server in liferay

I implement a mail service which works fine with local machine(liferay 6.1 with tomcat).
But when I deploy mail service into server(liferay 6.1 with webSphere server on Linux machine ) It wont work
It gives error as
[liferay/scheduler_dispatch-164][MailEngine:560]
Failed to connect to a valid mail server. Please make sure one is properly configured. Could not connect to SMTP host: smtp.gmail.com, port: 465
Please suggest any solution

Categories