Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

Crashing Java code

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
7 posts • Page 1 of 1
Author
Message
mikej_96
n00b
n00b
Posts: 10
Joined: Tue Mar 18, 2008 6:13 am

Crashing Java code

  • Quote

Post by mikej_96 » Tue Mar 18, 2008 6:27 am

Hello, I have a weird problem with some types of java programs not executing properly. As far as I know I have java set up on my machine the right way. I am running java 1.6.0_03 and have used it to develop many java apps without a problem.
The problem occurs with java applications that require networking functionality. For example, a java client server based game that runs fine on an ubuntu or windows systems crashes and throws exceptions when executed on my gentoo box.
Another example is an Apache Derby demo that can be found here... http://developers.sun.com/javadb/overvi ... /index.jsp

I imagine that it must have something to do with how my kernel is configured, as this sort of thing likely happens as a result of an operating system call.
I have the java use flag set as well. Other than this java seems to work fine.

Any Ideas?
Top
db_404
Guru
Guru
Posts: 336
Joined: Thu Dec 05, 2002 2:41 pm

  • Quote

Post by db_404 » Tue Mar 18, 2008 1:23 pm

Can you post an example exception?

My initial suspicion would be a DNS issue, as Java can be a bit odd about having correct DNS resolution (in both directions) at times.
Top
mikej_96
n00b
n00b
Posts: 10
Joined: Tue Mar 18, 2008 6:13 am

  • Quote

Post by mikej_96 » Tue Mar 18, 2008 5:56 pm

The firefox java console tells me that while running the Apache Derby demo, a null pointer exception occurs right away.
When running my own code, I get an "unknown host" exception and I also can get an "IO exception."

The unknown host exception happens when an instance of a java server is running and a java client tries to connect to it.
This is the line of code is chokes on: board.setPlayerName(InetAddress.getLocalHost().getHostAddress());
So, the getLocalHost() method is throwing the unknown host exception.

Could it be because I have ipv6 disabled in the kernel? This doesnt seem likely..I will try enabling it and see what happens.

Any Ideas?
Top
Arniepoo
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 76
Joined: Fri Jun 17, 2005 10:47 am
Location: UK

  • Quote

Post by Arniepoo » Tue Mar 18, 2008 6:05 pm

It's more likely that you don't have your hosts file set up correctly. I have had similar problems to this on windows boxes and unix boxes. Sometimes (I don't know why) getLocalHost() will return your hostname (e.g. whatever your local machine name is) and sometimes it will return localhost. If hosts doesn't have the correct aliases set it can cause the "unknown host" error.

Arnie
Top
mikej_96
n00b
n00b
Posts: 10
Joined: Tue Mar 18, 2008 6:13 am

  • Quote

Post by mikej_96 » Tue Mar 18, 2008 7:08 pm

Arnie-
That makes sense as to why I am getting that exception, however, how would one have their /etc/hosts file set up incorrectly?
This is not a file I have ever modified, and the only uncommented lines in it are:
# IPv4 and IPv6 localhost aliases
127.0.0.1 localhost
::1 localhost

This seems right to me. I read that man page but couldn't find anything that told me to set it up differently.

Any ideas?

Also in response to my previous post - enabling ivp6 did not help.
Top
notHerbert
Advocate
Advocate
User avatar
Posts: 2228
Joined: Tue Mar 11, 2008 11:55 pm
Location: 45N 73W

  • Quote

Post by notHerbert » Tue Mar 18, 2008 7:27 pm

All your stuff should work better if your /etc/hosts looks like this

Code: Select all

127.0.0.1 mybox.at.myplace mybox localhost
If you don't use ipv6 you can safely comment out the ::1 line.
make sure your /etc/hostname is ok too :wink:
run

Code: Select all

hostname -f
Top
mikej_96
n00b
n00b
Posts: 10
Joined: Tue Mar 18, 2008 6:13 am

  • Quote

Post by mikej_96 » Tue Mar 18, 2008 7:52 pm

That was the fix!
Thanks everyone for your help! That was not something I would have ever thought of.
Top
Post Reply

7 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic