Connecting to remote Glassfish hosted EJB - networking

The application i'm currently working on start to enter in a pre-release phase.
In this phase, the server-side application components are to be deployed on Amazon VMs while the client-side application remains on the user machine.
This applications connects to server using JNDI and RMI to call remote EJB methods. This works well on localhost and local network.
But, when trying to connect to Amazon host, the application hangs up on context.lookup method. that's to say a JNDI context can be obtained from this remote server, but no lookup can be performed on that context.
What can I do to obtain good diagnostic on the failure ?
Are there logs that can be generated for the RMI handshake/whatever ?
Is there any way to see on server side if query really drive its way through the internet to the server ?
Also notice I've already enabled public IP usage on my Glassfish server (using recommended Oracle procedure).
EDIT According to a fast TCP capture on server, it seems that server receives the client context query with in-lan client address, which it of course isn't aware of :
query is
[3/27/2012 11:05:22 AM:169]
GIOP.......(................NameService....._is_a...................
NEO................ª.......(IDL:omg.org/SendingContext/CodeBase:1.0.
...........n........172.27.63.145.ܺ....¯«Ë........e................
........... ................... ... ...........&...............(IDL:
omg.org/CosNaming/NamingContext:1.0.
reply is
[3/27/2012 11:05:22 AM:171]
GIOP.......2............NEO................0.......(IDL:omg.org/Send
ingContext/CodeBase:1.0............ô........46.137.114.67.'5....¯
«Ë........d........................... ................... .........
.....&...........!...|...............$....f............10.241.42.208
.'6.#........g..............g........default...................g....
...........+IDL:omg.org/CosNaming/NamingContextExt:1.0..............
.......10.241.42.208.'5...M¯«Ë.... ...d... S1AS-ORB............Root
POA....TNameService............................... .................
.. ... ...........&......
(as read using SmartSniff ASCII output).
The IP in query (172.27.63.145) is my IP in my company LAN. From what I understand of communication over itnernet, it should be my company LAN public IP, no ? How can I make Glassfish client udnerstand it should use that IP ?

Diagnostic has been clearly obtained : the client, which connects from a LAN to the server, sends its own internal network private address to server, which server can't forward any answer to. As a consequence, server doesn't answer, hence the hangup.

Related

Remote Server access with tunneling

I want to integrate service on my website, but the requirement from the service provider is that, data transfer must be performed using Tunneling, could you tell me detailed process how to connect remote server and send requests there. I have all credentials: remote server IP, ISAKMP key and stuff like that.
I tried configuring strongswan on my VPS, but I was not able to complete process due to some errors.

Derby Database Access thorugh a local network LAN

I created a java desktop application with derby client driver using netbeans 8.1.
I used this code to get connected to the database.
Class.forName("org.apache.derby.jdbc.ClientDriver");
Connection conn = DriverManager.getConnection("jdbc:derby://localhost:1527/LibertySchool;create=true;user=liberty;password=liberty");
conn.setSchema("LIBERTY");
Statement s = conn.createStatement();
s.executeQuery("SELECT * FROM USUARIOS");
ResultSet rs = s.getResultSet();
if (rs.next()) {
Login entrar = new Login();
entrar.setVisible(true);
}
The standalone application is working normal on the pc that it was created on after build the dist file has the app.jar file and everything works normal.
I created this so few client computers can access the same application to update data. I have started the derby network on client machine, I have also change the connection from localhost to use the app database location ip server.
But my app does not work on clients on the same network only on the computer where it was built. Other applications that do not use databases works well over the network, it seems that derby database folder has to be moved also to the client machine.
I need to know how to set the client machine properly so users can access the app with the database.
Can someone please give some hints.
If you want to make a client-server connection with the client on a different machine than the server, you'll have to do several things:
Change localhost to a valid externally visible address for the server machine. You can use an IP address, or a host name, e.g., 192.168.1.104:1527 or Carlos-Mac-Pro.att.net:1527, but you're going to need to figure out the right network address to use. localhost:1527 will only work when the client and server are on the same machine.
Ensure that your network allows connections between the client machines and the server machine. Nowadays, most machines will, by default, prevent most inbound network connections from other machines, as a security measure, so you'll need to configure the server machine's firewall, as well as any network devices that are being used in your local network between the client machines and the server machine, to allow TCP/IP connections on port 1527.
I don't think you want to move the derby database folder to the client machines. That would be a completely different architecture for your application (embedded vs client-server). Here's some good background material about the differences between the two configurations: https://db.apache.org/derby/docs/10.13/getstart/cgsquck70629.html

How to get client IP in 3-tier architecture?

I am currently working on module which has the following architecture:
When a client makes a request it is forwarded to a node server which has a ELB in front of it. The node server gets the data from backend .NET code hosted in another server with a different call.
Is it possible to access the client IP in the backend code written in .NET considering this architecture?
you can get ip in node
In your request object there is a property called connection, which is a net.Socket object. The net.Socket object has a property remoteAddress but it may be possible ip server is behind proxy server so try the below code to get IP
request.headers['x-forwarded-for']
Check the below Stack Link for more answers
How to determine a user's IP address in node

azure connect between azure myWebRole and nonazure server not working

My webapplication hosted on windows azure, needs to communicate with TFS Server. When any one login to my web app using live id, I want the logged in user to use my Team foundation server(TFS) credentials -username,password and domain to programatically authenticate and connect to our TFS server and create some work items.
I configured my azure connect for the communication to happen between azure WebRole and TFS server (our TFS is non-azure ).I added both the WebRole and the TFS Server into single Connection Group
In my azureportal ,I can see mywebrole and my TFSServer as connected the machine endpoint is active, and that it refreshes since the last connected updates
.But when I try to run my web application from azure and when it tries to communicate with our TFS server ,its throwing error message saying Error message : Team Foundation services are not available from server eg.,http://xyz-abcxyx-01:8080/tfs/eas/. Technical information (for administrator): The remote name could not be resolved: 'xyz-abcxyx-01'
Any suggestions to resolve this issue ?
You should enable remote desktop on your WebRole and connect to one of your instances. Then, try to ping the IP of your TFS server (not the hostname xyz-abcxyx-01). Maybe this is simply a DNS issue (even though using hostnames works with Windows Azure Connect).
If pinging the IP works, but pinging the hostname doesn't work you have a few options left:
Use the IP instead of the hostname. This won't work if you configured your TFS to use host headers.
Create an elevated startup task to modify the hosts file and map the IP to the hostname. In your code you can keep working with the hostname.
Try to modify the DNS server configured in your WebRole to use the default DNS server + your internal DNS server. But to me this doesn't look like a clean solution.
Anyways, in each solution you'll want to store the IP/hostname in the ServiceConfiguration and make sure your code supports changes to the ServiceConfiguration. This will allow you to change the IP/hostname without having to redeploy.
You should check if TFS server is listening on all network interfaces, include the one created by Azure Connect (start with 2a01). Next try to connect to TFS from a machine on the local LAN, just to make sure it is configured correctly. You don't need to use IP for referring to TFS, DNS name is definitely supported out of box.

Accessing remote web application using LogMeIn Hamachi2

I am trying to remotely access a web application hosted on the office LAN.
I have setup LogMeIN Hamachi and I can connect to an office machine and see shared resources (folders and printers) on that machine.
I selected a Hub-and-spoke network and made the machine with the web app the hub.
While in the office I type http://192.168.1.6:8080/mituz_oc in my browser to get access to the web app.
However, when I try to do the same remotely I get the message "Firefox can't establish a connection to the server at 192.168.1.6:8080."
So I see that the IP address to the computer I have VPN-ed to is 5.14.212.196 and so I try to gain access to the web app by replacing the office LAN's IP with the Hamachi IP (I can only post one hyperlink hence the verbose alternative )
I get the same error message as before, only this time with the HAMACHI IP address.
I can access all the shared resources but can not access the web app.
Is it possible to do what am attempting - remotely access a web application on office server?
If so what am I doing wrong / not doing ?
TIA.
Clemens
1) Check if your Windows Personal Firewall setting blocks connections from Hamachi's 5.x.x.x IP address ranges.
2) Check if your Web Server listens on 5.x.x.x. You can find it out by this command:
netstat -na
Look for local address of "0.0.0.0:8080" which is in the state of "LISTENING".
3) Replace Hamachi with different VPN provider, like www.remobo.com
(Disclosure: I work for the Remobo team)

Resources