Java server on OpenShift - java

At the moment i have an android client app which connects to my java server through socket - serversocket. It sends and receive strings. The java server is connected to a mysql database (actually mariadb) using the jdbc driver.
I succeed to create a jbossas application and upload the code of the java server to openshift, but i didn't find any detailed tutorial on how do i connect to this new uploaded server from my socket client (This one (RMI or socket connection to Java Program on OpenShift) gives some tips but i'm still stucked).
More on this, how do i know that my server runs just fine on openshift and how do i control de calls to the database after i connect it (found this: $ rhc app create MyApp jbossas-7
$ rhc cartridge add mysql-5.5 -a MyApp), using org.mariadb.jdbc.Driver and java.sql is still working ?
Any small guide or tip is highly appreciated. I'm new to these things so please don't be too heavy on comments.

You can only make connections to your OpenShift server on http/https or ws/wss ports. If you want to connect to your java application and pull data from it from an android device, I would suggest using a RESTful api or a servlet, etc.

I had similar problem: My app server originally was running as a ServerSocket listener, and any clients/devices connect to it directly via Socket binding.
To deploy it into OpenShift, my previous initial solution was to change its host:port configuration by following the suggestion as described in this link [Socket connection to Java Program on OpenShift]. It worked nice as far as my app server was successfully up and running. But it did not work well with the port forwarding approach in order to accept remote requests.
So for the final solution, I modified the app server by wrapping my original code with a RESTful webservice around it, and deploy it as a web service.

Related

gRPC server hosting on AWS Windows server

I have a Java gRPC server which I'm trying to host on a AWS Windows Server.
I have connected to it via the RDP, put my server in there and run it, everything it's fine, but I can't reach it from my client side app.
Is there some steps and configurations I have to take before I will be able to touch the server with my client? Something that has to do with security groups maybe?
Any help is welcomed, thank you!

connect via WebSocket HTML5 client app with Java server app in Windows 7

I am currently working on some project in NetBeans IDE using HTML5 and JavaScript.
My new task is to use WebSocket in JavaScript and connect to server. Since I have some previous knowledge of Java I decided to make that in Java. But am new with this server thing, so I am interested is it possible to connect this two application in Windows and how to do it? Can I just provide in JavaScript hostname "localhost" and port number, and than i Java app provide port number?
Or do I need install TomCat or some other server program, and if so, how do I make in NetBeans that my HTML5 app is running on that server instead of localhost?
Thank you

connect remote MQ using Java?

Friends,
I installed IBM explorer 7.1 which have server and GUI. Locally I connected the queue using inter process communication. Now I need to connect the server QM from remote machine using java standalone program.
In server I have created a queue, port and server channel. when I trying to connect using host name , unable to get the connection. Is this the right way?. else I have to install client where I tried connect that server.but getting error code 2035 when i run that java program. listener and queue manage is running in remote machine. Some forum i seen that AMQCLCHL.TAB file using for client connection. I had confusion whether i have to use that for client connection. if yes how i can use that?

Amazon EC2 server TCP Socket Connection

I have developed a Java server using Eclipse that accepts TCP socket connection from android client, performs some computations, and returns the result to the android phone using this socket. I tried it on Wi-Fi.
I want now to move the Java server to the cloud - basically amazon EC2. Is this possible? I am just using a simple tcp socket connection. I have checked and couldn't find an example but came across "elastic beanstalk". Any help is appreciated, maybe a link or tutorial with such an example.
can i convert my java project to .war and use it or can i install eclipse on the cloud and run it as i do locally?
It is definitely possible. And you don't have to convert your project to a .war, unless you want to.
All you have to do is:
Pick the Amazon Image (AMI) you want to use - Amazon Linux is a good place to start, but there are plenty of other options, including Ubuntu and Windows.
Set up a security group - you need to set an incoming rule for your server's port number. It is pretty easy to do this from the Amazon web-based console.
Start a machine and assign it to the security group you created. Again, this is easily accomplished from the amazon web console.
Once the machine is up, log in (using ssh for Linux or Remote Desktop for windows) and install your server.
A few things to remember:
Since you are now running on a public server, sooner or later your server will be attacked. EVERYONE gets attacked. If all you are opening is your single application port, make sure it is secured.
An Amazon server has a private and public IP. Your client application will connect to the public IP.
Servers can fail, and new servers get new public IPs! You need to prepare for this. Either make the IP in the client configurable, or look into something like Amazon Elastic IPs or dynamic DNS.

Java Commons.net & FTP Permissions

I regularly upload files to a particular RedHat 5.5 Server with no problems using FileZilla.
I am now trying to FTP to the same server with the Java Library org.apache.commons.net.ftp.FTPClient while using the exact same credentials (un, pw, and ip address). I keep getting an error Connection Refused: Connect at java.net.PlainSocketImpl.socketConnect(NativeMethod) at...........
It seems like if the permisions work for FileZilla, they should work for commons.net also. Does this sound right?
From the serverside everything should be ok. When you can log in with one client the other client should be ok as well.
I cannot tell however if the server for example uses something like passive mode and your library doesn't support that feature.
Are you sure that you are connecting to the same port and the server is not using sftp, etc?

Categories