[ale] Java socket problem

David Cleveland Haynes gt9900b at prism.gatech.edu
Thu Aug 1 10:47:01 EDT 1996


Thanks for the help. 
	I figured out that I had a symbolic link to /usr/local/java/bin/java in
/usr/bin. Since /usr/bin is earlier in my PATH list than /usr/local/java/bin,
"java" was run from /usr/bin and bash set $PRG to "/usr/bin". As a result, the
.java_wrapper script assumed "/usr/bin" as the java "root" directory (
instead of "/usr/local/java/bin" ) and then could not find libnet.so .
	I now have the problem fixed and am happy to report the code works
flawlessly. 

						Thanks again,
						   David
	

> > I have written a server in Java that is supposed to listen for connections
> > on a specified port. Pretty standard. Here is the error message I get when
> > I run the compiled ( .class ) code :
> > 
> > java.lang.NullPointerException
> >         at java.lang.Runtime.loadLibrary(Runtime.java)
> >         at java.lang.System.loadLibrary(System.java)
> >         at java.net.PlainSocketImpl.<clinit>(PlainSocketImpl.java:43)
> >         at java.net.ServerSocket.<init>(ServerSocket.java:48)
> >         at java.net.ServerSocket.<init>(ServerSocket.java:69)
> >         at java.net.ServerSocket.<init>(ServerSocket.java:58)
> >         at Server.<init>(Server.java:19)
> >         at Server.main(Server.java:48)
> > java.lang.UnsatisfiedLinkError: socketCreate
> >         at java.net.PlainSocketImpl.create(PlainSocketImpl.java:53)
> >         at java.net.ServerSocket.<init>(ServerSocket.java:76)
> >         at java.net.ServerSocket.<init>(ServerSocket.java:58)
> >         at Server.<init>(Server.java:19)
> >         at Server.main(Server.java:48)
> > 
> 
> Well.. First, you have a typo (that I think is probably not in your
> code)  in that you're missing a "}" at the end of the try.  Also, in
> newer versions of the JDK, you must put the catch block in "{}"'s.  This
> isn't true in 1.0.1, so you're alright, but if you want it portable, you
> ought to get familiar with it.
> 
> > Here is the code from Server.java, starting at line 19:
> > 
> >       try { listen_socket = new ServerSocket( port );
> >       catch( IOException e ) fail( e, "Exception creating server socket" );
> >       System.out.println( "Server: listening on port " + port );
> > 
> 
> It looks like the problem is that Java can't find the libnet.so file. 
> Make sure that that file is either in one of the places that ldconfig
> looks (i.e. /usr/local/lib/) or that your LD_LIBRARY_PATH points to the
> directory it's located in. (Usually something like
> /usr/local/java/lib/i586/).
> 
> Hope this helps.
> 
> Bill
> 
> 
> > I have set the port to 9999.
> > 
> > Any ideas would be much appreciated.
> > 
> >                                         Dave
> 






More information about the Ale mailing list