LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-16-2005, 02:04 PM   #1
ramman
LQ Newbie
 
Registered: Jun 2005
Posts: 1

Rep: Reputation: 0
Java cannot create sockets in redhat fc4.


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");

} catch (Exception ex) {
ex.printStackTrace();
}
}

}

-------------------------------------------------

java.net.SocketException: Invalid argument or cannot assign requested address

Last edited by ramman; 06-16-2005 at 02:09 PM.
 
Old 06-18-2005, 01:26 PM   #2
zoomster
LQ Newbie
 
Registered: Jun 2005
Posts: 1

Rep: Reputation: 0
I am having exactly the same problem. Could not connect to MySQL database. Tested your program - gives the same exception.

java.net.SocketException: Invalid argument or cannot assign requested address

I am also on 32-bit FC4.

Any clues?
 
Old 06-19-2005, 01:03 PM   #3
jefferson117
LQ Newbie
 
Registered: Sep 2002
Posts: 4

Rep: Reputation: 0
Same problem

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)


SQLState: 08S01
VendorError: 0
 
Old 06-19-2005, 11:01 PM   #4
jefferson117
LQ Newbie
 
Registered: Sep 2002
Posts: 4

Rep: Reputation: 0
think i found solution

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.
 
Old 06-22-2005, 03:41 AM   #5
sbielmann
LQ Newbie
 
Registered: Jun 2005
Posts: 1

Rep: Reputation: 0
1.5 works fine for me

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.

Regards

Stephan
 
Old 06-22-2005, 04:37 AM   #6
lurker79
Member
 
Registered: Jan 2005
Location: UK
Posts: 55

Rep: Reputation: 16
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.
 
Old 06-22-2005, 10:06 AM   #7
johnMG
Member
 
Registered: Jul 2003
Location: CT, USA
Distribution: Debian Sarge (server), Etch (work/home)
Posts: 601

Rep: Reputation: 32
Doesn't FC4 come with GCJ installed? There may also be a compatibility package installed that makes a link from java --> gij.

Take that with a grain of salt though; I'm using Debian Etch instead of FC4, and Sun's Java 1.4.2 instead of GCJ at the moment.
 
Old 06-30-2005, 07:45 PM   #8
dissonance
LQ Newbie
 
Registered: Jun 2005
Posts: 1

Rep: Reputation: 0
http://www.jroller.com/page/dissonan...core_4_and_jdk
 
Old 07-26-2005, 10:32 AM   #9
jimjay
LQ Newbie
 
Registered: Jul 2005
Location: Ohio
Posts: 1

Rep: Reputation: 0
The information in the post by dissonance fixed my problem on Fedora Core 3, Kernel 2.6.12-1.1372_FC3.

Thanks!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
FC4 and java UmneyDurak Fedora 13 10-27-2005 03:13 PM
Java - sockets ok in Linux, not Win? rylan76 Programming 6 09-05-2005 01:33 AM
[FC4] how to list sockets? polemon Linux - Newbie 2 08-20-2005 06:21 PM
FC4 and JAVA if050204 Fedora 13 06-20-2005 02:33 AM
netstat doesn't show tcp sockets in Redhat 7.2 pfpalmer Linux - General 3 10-31-2002 03:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:44 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