Failed port-forward for my diy application in Openshift - java

I have a java application with a server socket, but i don't know how to connect with another java web application in openshift. Looking in forums i saw i had to do port-forward to see wich ports i had to use in the connection between the web application(client) and the java application(server). But i have this error:
http://postimg.org/image/gjrrs80lp/
I did ssh -N 536(..) too, but it didn't work. I'm full blocked, i've never worked with sockets and ports and i'm blocked.
Thanks for the help guys ;)

You might do better to read up on sockets and ports then. Can you give a specific error that you are getting? If you are trying to use a non-supported port, then it will be blocked. If you want to do port forwarding between gears then you need to make sure you have a public/private key setup on your gears for that purpose and added to your account.

Related

Can i host my ServerSocket or Java file somewhere on the web?

Heyy guys. I'm writing a chat application in java, works pretty well. But can i somehow host my Server file or the Serversocket on the web? I want to make it so my friends from other pcs can use the client and connect to the server file which is hosted on the web. Is that possible? Can i host the File/socket online?
When you run a java application that opens a ServerSocket, it opens a port on your local machine and starts listening for incoming connections. What you do with those connections is up to the implementation of the java code that you write.
The "web" is much less foreign than you are making it out to be. Your own computer can be on the web that you're talking about and people can connect to your chat service. Or you can choose to host it on something like an AWS server.
The following approach is assuming you are behind a pretty standard NAT config.
Once you run your java application, you need to make sure other computers can see you, either inside your LAN or outside on the internet. You want to start testing from as close to your computer as possible, then start expanding outward.
First you need to make sure that your computer's firewall is actually allowing connections on the port that your java application is listening on.
Opening ports in the Windows Firewall
Setting up and opening ports in Linux
Now computers on your LAN will be able to connect to your java program. Now you need to go one layer out, and port forward your router. This is much less standard so I can't help you too much, but Google can.
At this point, anyone on this internet, knowing your external ip and what port your java application is listening, can connect to your service.
If you chose to host this on an third party hosting service, you'll need to go through similar steps, but there may be slight differences that you can either ask about, or again Google is a great resource.

Need to call from jxfs client to jxfs server

I am very new to jxfs things. I have a requirement to call jxfs server which is in cloud server from the jxfs client which is in ATM environment.. How can i call?.. I need to call this one through the Jxfs RMI concept. It would be appreciated one if any example code is available. If atleast you are having code for calling from jxfs server to jxfs client, please post it.
Thanks in advance guys.
One of the interesting things about J/XFS and remote device access (based on RMI) is that it is just matter of configuration.
You need to configure a J/XFS repository in order to handle a remote device (basically set 'remoteAccess' to true).
Then accessing these devices from the programming point of view is just the same as they were local devices.
Architecture is explained here: ftp://ftp.cencenelec.eu/CWA/CEN/WS-J-XFS/cwa14923/cwa14923-01-2004-May.pdf
Details, when programming may differ depending on the J/XFS implementation you are using.
Trying to answer your question below:
Whenever you want to access a device remotely in J/XFS, RMI is used. You need to make the following setup:
On a server (should be accessible) you need to start a JxfsServer. The JxfsServer will use a Read.repository
whith all the ATM's and devices configured on them as workstations, with the right IP addresses.
On the ATM, you need to install:
J/XFS libs
J/XFS device services for the devices on the ATM
Setup the DSstarter:
Will use the SpecificDeviceManagerRMI connecting to the JxfsServer you started before.
On your server (cloud) wherever you are going to use the J/XFS client you can get the remote controls by performing
the J/XFS initialization as follows:
jxfsDM_ = JxfsDeviceManager.getReference();
jxfsDM_.initialize("com.jxfs.forum.communication.rmi.SpecificDeviceManagerRMI,<atmWorkstation>,AppTest,2006;<jxfsserverhostname>,");
Then you can get the remote device controls with getDevice(...), and start using them as if they were local devices.
Please, note that handling RMI ports can be tricky, specially in a secured environment as ATM network. Make sure all the ports you need are open.

Is it possible to implement a tcp serverSocket in a java web application on glassfish?

I would like to know if it is possible to open a tcp serversocket within a java web application, i've tried, but it always fails to bind the socket to an address and port.
I was trying to open it within the application context listner, in a strait forward manner, just created an instance and gave it an ip address and port.
I've tried several combinations of ip addresses and ports, and nothing worked,maybe it's impossible to opened that kind of connnection from within the glassfish serer, but I haven't seen nothing to tell me that.
It may be possible, but it's forbidden by the specification. See http://www.oracle.com/technetwork/java/restrictions-142267.html for further details. You shouldn't even start a new thread from EJB or web application.
For this purpose, the only allowed way is to open the server socket using JCA resource adapter. The communication with your EJB is then performed through message-driven beans.
Yes, it sounds complicated. A good starting point is http://code.google.com/p/jca-sockets/ . I have implemented a CIFS server using this approach and it works perfectly.
Another complication could be, that the port you are trying to bind is occupied, or the GlassFish is not allowed to bind to it. For example on Linux, only root user could bind to "privileged" ports (<1024).

How to debug Java Server working for localhost but not public IP

Noob question but I'm not sure where to look:
I'm running a Java Web App on a remote linux machine (Jersey RESTful API is the goal). The server successfully runs and can handle requests locally to localhost:8080/foobar but I cannot make requests to the various urls from anywhere else (For example, my laptop through a browser).
This is a simple problem I've have many times but have no idea what terms to search on google or where to look for help debugging the problem, so any leads or advice would be greatly appreciated.
Further details:
Project is code added to a Maven2 generated archetype of a Jersey Service
This is most likely caused by firewalling on the server or in front of the internal network your server is running on. Talk to your network administrators about opening a hole for port 8080, or consider using a reverse proxy on port 80 (if open) to forward requests to port 8080. See http://en.wikipedia.org/wiki/Reverse_proxy if you are not familiar with the idea of a reverse proxy or load balancers.
Change the localhost entry in your "/etc/hosts" file, with the network configs, and if server is tomcat, edit the $CATALINA_HOME/conf/server.xml to add IP the relevant <Connector> element.
Make sure you have better idea handling /etc/hosts

How to access Jade Main Container via internet?

I am working on an Agent based application and i want to access agents running on a container in a machine. I am using jadeGateWay to connect to Main container. It is working in localhost but when i run the jadeGateWay on a server it doesn't connect eventhough correct IP address of the jade main container are given. Can anybody suggest me a work around? Thanks in advance.
I suggest you, for the beginning, that you try to make the connection using jadegateway in the same machine, if works, try to do the same in other machine, as you want. If do not works, you could send more information about the problem.
And if you did not read yet, it's interesting read the jadegateway api on: http://jade.tilab.com/doc/api/jade/wrapper/gateway/JadeGateway.html.

Categories

Resources