Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi I am running fedora core (fc4 32bit) and when i run simple test program from java i get the following error :
java.net.SocketException: Invalid argument or cannot assign requested address
All programs using java (e.g. tomcat) have the same error when executing code trying to use the network however the same version of java running on solaris os has no problem and the program executes flawlessly.
Does anyone know what might be going on?
note: Network access is fine, browsing is fine, ping fine ftp , telnet etc.....
note2: I deliberately installed this version of fedora with no firewall.
Thanks
----------------------
a) here is the program that i wrote to test the network after discovering the problem in tomcat.: (it works fine on sun solaris but causes the below error on fedora)
b) i had to replace the url with the capitalisation below because ic annot post a url on this forum
import java.io.*;
import java.net.*;
public class network_test {
public static void main(String [] args) {
try {
System.out.println("aa22222");
URL u = new URL("URLCONNECTSTRING GOES HERE");
InputStream in = u.openStream();
System.out.println("a");
int b;
while ((b = in.read()) != -1) {
System.out.write(b);
}
System.out.println("B");
I had a java program running fine in Redhat 9, and now I get the same error (with FC4):
java.net.SocketException: java.net.SocketException: Invalid argument or cannot assign requested address
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:151)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:280)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1774)
at com.mysql.jdbc.Connection.<init>(Connection.java:437)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:268)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:193)
at DBConnector.getConnection(DBConnector.java:49)
I found another forum on the same google search that i found this one, and someone said they tried jdk 1.5.0 instead of 1.4.2_08 and said they fixed their problem. I've just set everything up as well, and it seems to work. So it's some sort of problem with Fedora Core 4 and java 1.4.2_08.
Thanks for the hint about using 1.5. I had two problems, however, leading to the
main source, that there are problems with Sockets using Java and Fedora Core IV.
Java, however, in version 1.4.X. I tried out almost every sub version of 1.4 and
had everytime the same result.
Using the actual 1.5 update3 mysql connections do work, and other programs
or classes that are using sockets, like tomcat for example.
Do you have an active SELinux Policy running?
This may prevent your program from creating a socket, check your /var/log/messages file for avc denial messages connected to your java program.
If it is an SELinux problem you will need to either disable SELinux, or alter the context for you java program.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.