LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-22-2014, 08:17 AM   #1
EODSteven
Member
 
Registered: Oct 2012
Location: Manchester, Tn
Distribution: Ubuntu 14.04, Windows 8, Windows Server 2012. Ubuntu Server 14.04
Posts: 196

Rep: Reputation: 3
Java 8


Does anyone have any idea what could cause ports not to bind when switching from Java 8 back to Java 7...I'm stumped.
 
Old 08-22-2014, 08:28 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
What exactly do you mean by "switching back"?

If you were running Java 8 and started your process that relied on a given port then tried to restart that process using Java 7 it may simply be you forgot to stop the original process (or it didn't stop when you thought it did) so the port is still in use.

Run "lsof -i :<port>" for the port you're talking about to see if it is already in use. If lsof sees it then it will give you the PID of the process that is using it.
 
Old 08-22-2014, 08:38 AM   #3
EODSteven
Member
 
Registered: Oct 2012
Location: Manchester, Tn
Distribution: Ubuntu 14.04, Windows 8, Windows Server 2012. Ubuntu Server 14.04
Posts: 196

Original Poster
Rep: Reputation: 3
Quote:
Originally Posted by MensaWater View Post
What exactly do you mean by "switching back"?

If you were running Java 8 and started your process that relied on a given port then tried to restart that process using Java 7 it may simply be you forgot to stop the original process (or it didn't stop when you thought it did) so the port is still in use.

Run "lsof -i :<port>" for the port you're talking about to see if it is already in use. If lsof sees it then it will give you the PID of the process that is using it.
I wish is was that easy...when I do a netstat the ports I'm trying to bind are not used but nonetheless they will not bind...Thx. BTW switching back is made via command line with Java 8 but I did do a complete shutdown and reboot...I had the same idea that the port was in use.

Last edited by EODSteven; 08-22-2014 at 08:44 AM. Reason: Added Information
 
Old 08-22-2014, 08:41 AM   #4
EODSteven
Member
 
Registered: Oct 2012
Location: Manchester, Tn
Distribution: Ubuntu 14.04, Windows 8, Windows Server 2012. Ubuntu Server 14.04
Posts: 196

Original Poster
Rep: Reputation: 3
Quote:
Originally Posted by EODSteven View Post
I wish is was that easy...when I do a netstat the ports I'm trying to bind are not used but nonetheless they will not bind...Thx.
Could it be some kind of dependency with ssh and Java 7...I've tried all the usual things and its a bare bones Ubuntu 14.04 and Java server install ...I finally broke down and installed Gnome shell so I could navigate easiar but I didn't want to. Does IPTables have anything to do with Ports?...and yes, I did all the IPTables -F -X -N for both IP4 and IP6.

Last edited by EODSteven; 08-22-2014 at 08:46 AM. Reason: Added Information
 
Old 08-22-2014, 09:18 AM   #5
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Certainly iptables deals with ports. In fact I'd say that mostly is its purpose though of course it can do NATting and other things.

However, iptables if tied to ports should either allow or forbid them regardless of which application is attempting to use them. You should be able to determine if iptables is your issue simply by stopping it and testing. If it works when iptables is stopped then it means you need to add a rule allowing the port.

I'd still suggest looking with lsof -i since you can specify the port easily instead of having to look for it. Linux netstat has some capabilities along those lines but IMHO it is still inferior to what you can glean with lsof.
 
Old 08-22-2014, 02:56 PM   #6
EODSteven
Member
 
Registered: Oct 2012
Location: Manchester, Tn
Distribution: Ubuntu 14.04, Windows 8, Windows Server 2012. Ubuntu Server 14.04
Posts: 196

Original Poster
Rep: Reputation: 3
Quote:
Originally Posted by MensaWater View Post
Certainly iptables deals with ports. In fact I'd say that mostly is its purpose though of course it can do NATting and other things.

However, iptables if tied to ports should either allow or forbid them regardless of which application is attempting to use them. You should be able to determine if iptables is your issue simply by stopping it and testing. If it works when iptables is stopped then it means you need to add a rule allowing the port.

I'd still suggest looking with lsof -i since you can specify the port easily instead of having to look for it. Linux netstat has some capabilities along those lines but IMHO it is still inferior to what you can glean with lsof.
Ok I just switched to Java 7 and did losf -i...hold on switch computers for copy and paste...
 
Old 08-22-2014, 02:57 PM   #7
EODSteven
Member
 
Registered: Oct 2012
Location: Manchester, Tn
Distribution: Ubuntu 14.04, Windows 8, Windows Server 2012. Ubuntu Server 14.04
Posts: 196

Original Poster
Rep: Reputation: 3
Quote:
Originally Posted by EODSteven View Post
Ok I just switched to Java 7 and did losf -i...hold on switch computers for copy and paste...
Code:
Java 8 running all servers running

java    5253 steve   40u  IPv6 113558      0t0  TCP localhost:46088->localhost:mysql (ESTABLISHED)
java    5253 steve   44u  IPv6 114808      0t0  TCP *:25565 (LISTEN)
java    6238 steve   28u  IPv6 139795      0t0  TCP *:25568 (LISTEN)
java    6238 steve   79u  IPv6 145592      0t0  TCP localhost:8193 (LISTEN)
java    6238 steve   89u  IPv6 163542      0t0  UDP *:25569 
java    6238 steve   90u  IPv6 352727      0t0  TCP eodsteven.org:42175->192.230.66.3.ip.incapdns.net:https (ESTABLISHED)
java    6238 steve   91u  IPv6 163351      0t0  TCP *:19002 (LISTEN)
java    6238 steve  108u  IPv6 163551      0t0  TCP localhost:46210->localhost:mysql (ESTABLISHED)
java    6367 steve   28u  IPv6 140975      0t0  TCP *:25572 (LISTEN)
java    6367 steve   45u  IPv6 146849      0t0  TCP localhost:46180->localhost:mysql (ESTABLISHED)
java    6367 steve   46u  IPv6 146850      0t0  TCP localhost:46181->localhost:mysql (ESTABLISHED)
java    6367 steve   55u  IPv6 160083      0t0  TCP *:19003 (LISTEN)
java    6367 steve   56u  IPv6 160252      0t0  UDP *:25573 
java    6487 steve   28u  IPv6 150747      0t0  TCP *:25570 (LISTEN)
java    6487 steve   81u  IPv6 157847      0t0  TCP *:8192 (LISTEN)
java    6487 steve   90u  IPv6 159438      0t0  TCP localhost:46186->localhost:mysql (ESTABLISHED)
java    6487 steve   95u  IPv6 161785      0t0  UDP *:25571 
java    6487 steve   99u  IPv6 160528      0t0  TCP *:19001 (LISTEN)
java    6487 steve  113u  IPv6 160674      0t0  TCP localhost:46195->localhost:mysql (ESTABLISHED)

I switch over to Java 7
I shut down the server using port 25570...

steve@eodsteven:~$ lsof -i
COMMAND  PID  USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
java    5253 steve   40u  IPv6 113558      0t0  TCP localhost:46088->localhost:mysql (ESTABLISHED)
java    5253 steve   44u  IPv6 114808      0t0  TCP *:25565 (LISTEN)
java    6238 steve   28u  IPv6 139795      0t0  TCP *:25568 (LISTEN)
java    6238 steve   79u  IPv6 145592      0t0  TCP localhost:8193 (LISTEN)
java    6238 steve   89u  IPv6 163542      0t0  UDP *:25569 
java    6238 steve   91u  IPv6 163351      0t0  TCP *:19002 (LISTEN)
java    6238 steve  108u  IPv6 163551      0t0  TCP localhost:46210->localhost:mysql (ESTABLISHED)
java    6367 steve   28u  IPv6 140975      0t0  TCP *:25572 (LISTEN)
java    6367 steve   45u  IPv6 146849      0t0  TCP localhost:46180->localhost:mysql (ESTABLISHED)
java    6367 steve   46u  IPv6 146850      0t0  TCP localhost:46181->localhost:mysql (ESTABLISHED)
java    6367 steve   55u  IPv6 160083      0t0  TCP *:19003 (LISTEN)
java    6367 steve   56u  IPv6 160252      0t0  UDP *:25573 

and when I restart the server....

[14:43:00 INFO]: Starting minecraft server version 1.7.10
[14:43:00 INFO]: Loading properties
[14:43:01 INFO]: Default game type: SURVIVAL
[14:43:01 INFO]: This server is running CraftBukkit version git-Spigot-1610 (MC: 1.7.10) (Implementing API version 1.7.10-R0.1-SNAPSHOT)
[14:43:02 INFO]: Debug logging is disabled
[14:43:02 INFO]: Server Ping Player Sample Count: 12
[14:43:02 INFO]: Using 4 threads for Netty based IO
[14:43:02 INFO]: Generating keypair
[14:43:03 INFO]: Starting Minecraft server on *:25570
[14:43:04 WARN]: **** FAILED TO BIND TO PORT!
[14:43:05 INFO]: Stopping server

and finally...

steve@eodsteven:~$ lsof -i:25570
steve@eodsteven:~$ 

switch back to Java8...

steve@eodsteven:~$ sudo update-java-alternatives -s java-8-oracle
[sudo] password for steve: 
steve@eodsteven:~$ 
COMMAND  PID  USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
java    5253 steve   40u  IPv6 113558      0t0  TCP localhost:46088->localhost:mysql (ESTABLISHED)
java    5253 steve   44u  IPv6 114808      0t0  TCP *:25565 (LISTEN)
java    6238 steve   28u  IPv6 139795      0t0  TCP *:25568 (LISTEN)
java    6238 steve   79u  IPv6 145592      0t0  TCP localhost:8193 (LISTEN)
java    6238 steve   89u  IPv6 163542      0t0  UDP *:25569 
java    6238 steve   91u  IPv6 163351      0t0  TCP *:19002 (LISTEN)
java    6238 steve  108u  IPv6 163551      0t0  TCP localhost:46210->localhost:mysql (ESTABLISHED)
java    6367 steve   28u  IPv6 140975      0t0  TCP *:25572 (LISTEN)
java    6367 steve   45u  IPv6 146849      0t0  TCP localhost:46180->localhost:mysql (ESTABLISHED)
java    6367 steve   46u  IPv6 146850      0t0  TCP localhost:46181->localhost:mysql (ESTABLISHED)
java    6367 steve   55u  IPv6 160083      0t0  TCP *:19003 (LISTEN)
java    6367 steve   56u  IPv6 160252      0t0  UDP *:25573 

[14:50:29] [Server thread/INFO]: Starting minecraft server version 1.7.10
[14:50:29] [Server thread/INFO]: Loading properties
[14:50:29] [Server thread/INFO]: Default game type: SURVIVAL
[14:50:30] [Server thread/INFO]: This server is running CraftBukkit version git-Spigot-1610 (MC: 1.7.10) (Implementing API version 1.7.10-R0.1-SNAPSHOT)
[14:50:30] [Server thread/INFO]: Server Ping Player Sample Count: 12
[14:50:30] [Server thread/INFO]: Using 4 threads for Netty based IO
[14:50:30] [Server thread/INFO]: Debug logging is disabled
[14:50:31] [Server thread/INFO]: Generating keypair
[14:50:31] [Server thread/INFO]: Starting Minecraft server on *:25570
[14:50:32] [Server thread/INFO]: Set PluginClassLoader as parallel capable
[14:50:34] [Server thread/INFO]: [WorldEdit] Loading WorldEdit v5.6.3
[14:50:34] [Server thread/INFO]: [OpenInv] Loading OpenInv v2.2.2
[14:50:34] [Server thread/INFO]: [LimitCreative] Loading LimitCreative v1.7.2
[14:50:34] [Server thread/INFO]: [Essentials] Loading Essentials vDev2.14.95
[14:50:34] [Server thread/INFO]: [Prison] Loading Prison v2.0.4

Server starts up just fine.....see what I mean? Very weird!
 
Old 08-23-2014, 12:37 PM   #8
EODSteven
Member
 
Registered: Oct 2012
Location: Manchester, Tn
Distribution: Ubuntu 14.04, Windows 8, Windows Server 2012. Ubuntu Server 14.04
Posts: 196

Original Poster
Rep: Reputation: 3
Well as much as I like to brag, I don't like saying I have stumped the panel....I have 4 diffrent forums trying to brain storm with me to figure this out. I have even tried setting it up to run as a java 7 server inside a java 8 environment and same thing...failed to bind port. I also forced it to use IPv4 instead of 6, no change, and I have disabled Netty...nothing seems to work. It woud be a lot easiar for the developer to program his plugin to work with java 8 but thats not gonna happen....I wish I new how to code!

Last edited by EODSteven; 08-23-2014 at 12:41 PM. Reason: Added Information
 
Old 08-25-2014, 09:05 AM   #9
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Most Java applications expect a certain version of Java and won't run on anything else. (Sometimes they want a very old version which is insecure). It may simply be Minecraft only runs on the one version. The failed to bind port may be a red herring for port 25570 - it may be trying to do something else (e.g. open another port as well) that it isn't telling you about but that is already in use. I notice on your second lsof -i output although 25570 has gone away other ports in the same range are still active.

To verify you can actually LISTEN on port 25570 after stopping the Java application run:
nc -l 25570
That should start a local LISTENer on the specified port. If it works you can stop it and you'll know the port itself isn't your issue.

You can run strace on your application and see what it is actually doing at the point it gives the failed to bind message.
 
1 members found this post helpful.
Old 08-27-2014, 04:16 AM   #10
EODSteven
Member
 
Registered: Oct 2012
Location: Manchester, Tn
Distribution: Ubuntu 14.04, Windows 8, Windows Server 2012. Ubuntu Server 14.04
Posts: 196

Original Poster
Rep: Reputation: 3
Quote:
Originally Posted by MensaWater View Post
Most Java applications expect a certain version of Java and won't run on anything else. (Sometimes they want a very old version which is insecure). It may simply be Minecraft only runs on the one version. The failed to bind port may be a red herring for port 25570 - it may be trying to do something else (e.g. open another port as well) that it isn't telling you about but that is already in use. I notice on your second lsof -i output although 25570 has gone away other ports in the same range are still active.

To verify you can actually LISTEN on port 25570 after stopping the Java application run:
nc -l 25570
That should start a local LISTENer on the specified port. If it works you can stop it and you'll know the port itself isn't your issue.

You can run strace on your application and see what it is actually doing at the point it gives the failed to bind message.
I have tried several other different Ports but thank you very much for those useful tools...I'm gonna give up on that one particular plugin and find one that works with Java 8. I hate to think of going backwards due to one particular lazy coder...Thank you. I always wondered how to do a Stack Trace and I assume strace is just that.

Last edited by EODSteven; 08-27-2014 at 04:20 AM.
 
  


Reply

Tags
java7-ubuntu



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mountain Lion (OS X 10.8) Java Update: Unable to Access Java Settings and Preferences rm_-rf_windows Other *NIX 2 01-03-2013 09:34 AM
To install java in solaris sparcv9 and removing the preinstalled java versions saurabh593 Solaris / OpenSolaris 6 06-14-2012 01:43 PM
[SOLVED] Java Woes: A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available ... chytraeus Slackware 10 11-27-2010 10:04 AM
LXer: Java news met with cautious optimism in free Java community LXer Syndicated Linux News 0 11-14-2006 10:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration