wood burning stoves 2.0*
The moose likes Other Java Products and Servers and the fly likes Glassfish can be accessed locally but not remotely. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » Other Java Products and Servers
Bookmark "Glassfish can be accessed locally but not remotely." Watch "Glassfish can be accessed locally but not remotely." New topic
Author

Glassfish can be accessed locally but not remotely.

Jiafan Zhou
Ranch Hand

Joined: Sep 28, 2005
Posts: 192

I have installed the Sun Application Server 9.0 with a bundled Glassfish server I think. Starting the server per Sun's manual and I am able to connect to the server using the IP address (localhost) and port(8080) locally. (http://localhost:8080/). However if I try to connect to the server from another computer in the LAN, e.g. http://192.168..123.156:8080/ (.156 is where I install the GlassFish), I got a timeout error in my browser connecting to the server.

Also I captured the packets that I found there is an ICMP destination unreachable (The destination host is administratively prohibited) occurred. I am new to the Sun Application Server and have no idea how to configure the server. Does anybody have the same problem?

Regards,
Jiafan


SCJP, SCJD, SCWCD, SCBCD, SCEA
Masoud Kalali
Author
Ranch Hand

Joined: Jul 08, 2004
Posts: 531

There could be several reason for this problem.

1-there are some firewall or something between you and the machine running glassfish.

2-By any chance which is small possibility, glassfish http listener is listening on loopback address instead of your network interface.

solutions:
1-Ping the server and see whether you can see the server from remote host. if you can not access the remote computer as your network adminstrator to take a look.

2-From local computer open glassfish adminstration console by pointing you browser to http://localhost:4848 . by default you can use admin/adminadmin for authentication. You can see the configuration node in left side tree.

Then take a look at Configuration> HTTP Service> HTTP Listeners> http-listener-1 and check whether it is binded to 0.0.0.0 , 127.0.0.1 or your network interface. If the IP address is not your netwrork interface address or 0.0.0.0 Change the ip address to your network interface address or 0.0.0.0.

Restart the glassfish using
glassfish_home/bin/asadmin stop-domain
glassfish_home/bin/asadmin start-domain

I think it should resolve your problem, let me know the outcome if it does not resolve your problem.


Masoud Kalali
Software Engineer - My Weblog - GlassFish Security
Jiafan Zhou
Ranch Hand

Joined: Sep 28, 2005
Posts: 192

Originally posted by Masoud Kalali:
There could be several reason for this problem.

1-there are some firewall or something between you and the machine running glassfish.

There is no firewall between the client machine and the server(Glassfish) machine. I explicitly ran a back-to-back test in the same collision domain instead of through a router.
Meanwhile, I have another Apache Http server on port 80 running on the same machine as Glassfish resides. The client machine is able to connect to the apache server on port 80 but not Glassfish on port 8080.


2-By any chance which is small possibility, glassfish http listener is listening on loopback address instead of your network interface.

At the beginning I also thought it was the problem but it seems not. see my following comments.


solutions:
1-Ping the server and see whether you can see the server from remote host. if you can not access the remote computer as your network adminstrator to take a look.

ping from my client machine works fine, also the Apache server working on port 80 works fine too.


2-From local computer open glassfish adminstration console by pointing you browser to http://localhost:4848 . by default you can use admin/adminadmin for authentication. You can see the configuration node in left side tree.

Then take a look at Configuration> HTTP Service> HTTP Listeners> http-listener-1 and check whether it is binded to 0.0.0.0 , 127.0.0.1 or your network interface. If the IP address is not your netwrork interface address or 0.0.0.0 Change the ip address to your network interface address or 0.0.0.0.

Restart the glassfish using
glassfish_home/bin/asadmin stop-domain
glassfish_home/bin/asadmin start-domain

I think it should resolve your problem, let me know the outcome if it does not resolve your problem.


http-listener-1 is bound with the network address "0.0.0.0" by default. You said Change the ip address to your network interface address or 0.0.0.0. You mean I need to change to the network interface address(then what is the network interface address? (0.0.0.0? or the server's IP address?).
Also I see that "0.0.0.0, any, or ANY or INADDR_ANY" seems options to the network address, I tried INADDR_ANY, the Glassfish cannot even be started now, and got the following exception.

rgetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.enterprise.server.PELaunch.main(PELaunch.java:272)
Caused by: java.lang.Error: Untranslated exception
at sun.nio.ch.Net.translateToSocketException(Net.java:63)
at sun.nio.ch.Net.translateException(Net.java:79)
at sun.nio.ch.Net.translateException(Net.java:85)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:61)
at com.sun.enterprise.server.ss.provider.ASServerSocket.bind(ASServerSocket.java:292)
at com.sun.enterprise.server.ss.provider.ASServerSocket.bind(ASServerSocket.java:263)
at com.sun.enterprise.server.ss.ASSocketService._initializeService(ASSocketService.java:154)
at com.sun.enterprise.server.ss.ASSocketService.start(ASSocketService.java:98)
at com.sun.enterprise.server.ss.ASLazyKernel.startService(ASLazyKernel.java:169)
at com.sun.enterprise.server.ss.ASLazyKernel.setupSocketListeners(ASLazyKernel.java:120)
at com.sun.enterprise.server.ss.ASLazyKernel.startASSocketServices(ASLazyKernel.java:81)
at com.sun.enterprise.server.ondemand.OnDemandServer.onInitialization(OnDemandServer.java:84)
at com.sun.enterprise.server.PEMain.run(PEMain.java:316)
at com.sun.enterprise.server.PEMain.main(PEMain.java:260)
... 5 more
Caused by: java.net.SocketException: Unresolved address
at sun.nio.ch.Net.translateToSocketException(Net.java:55)
... 18 more
Caused by: java.nio.channels.UnresolvedAddressException
at sun.nio.ch.Net.checkAddress(Net.java:30)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:115)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:59)
... 15 more


Thanks,
Jiafan

[ August 20, 2007: Message edited by: Jiafan Zhou ]
[ August 20, 2007: Message edited by: Jiafan Zhou ]
Jiafan Zhou
Ranch Hand

Joined: Sep 28, 2005
Posts: 192

This exception actually blocks me from starting Glassfish successfully now.
Masoud Kalali
Author
Ranch Hand

Joined: Jul 08, 2004
Posts: 531

OK,
first to make your application server start again you should:
-goto: glassfish_home/domains/domain1/config
-open domain.xml in an xml or text editor
-look for http-service node and change the address attribute to 0.0.0.0 .
It will let you start the application again.

0.0.0.0 means that the listener will listen on every possible address, so it it is sets to 0.0.0.0 you should be able to see the page from remote server.


Please try http://192.168.123.156:8080/ from the same computer that you installed glassfish on it and see whether it shows the page or not. make sure you have no additional dot after 168. [:-)]

getting time out error on remote computer is something very odd, becasue you can ping the computer from remote server.

let me know the result for the above test.

have good time.
Jiafan Zhou
Ranch Hand

Joined: Sep 28, 2005
Posts: 192

First of all, thanks very much for your help, Masoud.

"..156" is just a typo. The "Directory Listing For /" is shown when I typed the "http://192.168.123.156:8080/" locally where I install the Glassfish. However back to the issue here, still no way to connect to the GlassFish remotely. The port 8080 is blocked by GlassFish somehow.

Following is the pdu capture log:

No. Time Source Destination Protocol Info
1 0.000000 192.168.123.157 192.168.123.156 TCP scol > webcache [SYN] Seq=0 Len=0 MSS=1460

Frame 1 (62 bytes on wire, 62 bytes captured)
Ethernet II, Src: Nec_b7:10:89 (00:00:4c:b7:10:89), Dst: AbitComp_4d:a4:90 (00:50:8d:4d:a4:90)
Internet Protocol, Src: 192.168.123.157 (192.168.123.157), Dst: 192.168.123.156 (192.168.123.156)
Transmission Control Protocol, Src Port: scol (1200), Dst Port: webcache (8080), Seq: 0, Len: 0

No. Time Source Destination Protocol Info
2 0.000149 192.168.123.156 192.168.123.157 ICMP Destination unreachable (Host administratively prohibited)

Frame 2 (90 bytes on wire, 90 bytes captured)
Ethernet II, Src: AbitComp_4d:a4:90 (00:50:8d:4d:a4:90), Dst: Nec_b7:10:89 (00:00:4c:b7:10:89)
Internet Protocol, Src: 192.168.123.156 (192.168.123.156), Dst: 192.168.123.157 (192.168.123.157)
Internet Control Message Protocol


Because I have Apache installed in my computer as well, now I am thinking if it is the Apache server actually blocks the port 8080 rather than the GlassFish server. I remember I have the same issue with port 80 long time ago when I was installing the Apache server.

I will update this bug once I figure out why. At least the GlassFish came back working "locally".

Thanks,
Jiafan
[ August 20, 2007: Message edited by: Jiafan Zhou ]
Jiafan Zhou
Ranch Hand

Joined: Sep 28, 2005
Posts: 192

FYI, I m running GlassFish on Linux Fedora 5, Apache server listens port 80, GlassFish listens 8080.
Jiafan Zhou
Ranch Hand

Joined: Sep 28, 2005
Posts: 192

OK, eventually I figured it out.

Under linux FC5 there is a firewall that block all access through the WWW(HTTP) !!

the solution is:
(Genome) Application > System Settings > Security Level
(KDE) Administration> Security Level and firewall

and put the WWW(HTTP) as a Trusted services
and put eth(0) {my network card} as a Trusted devices

(Or completely disable the firewall at all).

Thanks to my good habit of bookmarking issues I have encountered, I can fix this problem quickly. And now I realize that sometime firewalls not only blocks hackers from cracking computers but also developers who write code.

Thanks Masoud for your help again.

I am going to mark this bug as fixed.



Regards,
Jiafan
[ August 20, 2007: Message edited by: Jiafan Zhou ]
Masoud Kalali
Author
Ranch Hand

Joined: Jul 08, 2004
Posts: 531

Very good to know that it is solved. Glassfish is an stable and scaleable application server. You have choosed one of the best, imho.

If could undersand that you are running the GF on linux i would give you similar advice :-) maybe i jumped over your mentioning or you have not mention it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Glassfish can be accessed locally but not remotely.