views:

121

answers:

3

I'm running into a problem with a java app constantly throwing:

java.lang.NoClassDefFoundError: Could not initialize class java.net.ProxySelector.

I am running Suse Linux 10.3 and running java 1.6.0. My CLASSPATH is set to

/usr/lib/jvm/jre-1.6.0-openjdk/lib.

No other users seem to be having this error so I'm assuming its my setup. For those wondering the app is yamj (http://code.google.com/p/moviejukebox/)

Any ideas as to what maybe missing or what I maybe doing wrong?

Edit the full trace of the error is as follows:

java.lang.NoClassDefFoundError: Could not initialize class java.net.ProxySelector at sun.net.www.protocol.http.HttpURLConnection$5.run(HttpURLConnection.java:736) at java.security.AccessController.doPrivileged(Native Method) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:732) at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:672) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:997) at com.moviejukebox.thetvdb.tools.XMLHelper.getEventReader(XMLHelper.java:19) at com.moviejukebox.thetvdb.model.Mirrors.(Mirrors.java:30) at com.moviejukebox.thetvdb.TheTVDB.(TheTVDB.java:37) at com.moviejukebox.plugin.TheTvDBPlugin.(TheTvDBPlugin.java:57) at sun.reflect.GeneratedConstructorAccessor2.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:532) at java.lang.Class.newInstance0(Class.java:372) at java.lang.Class.newInstance(Class.java:325) at com.moviejukebox.plugin.DatabasePluginController.getMovieDatabasePlugin(DatabasePluginController.java:96) at com.moviejukebox.plugin.DatabasePluginController.access$000(DatabasePluginController.java:30) at com.moviejukebox.plugin.DatabasePluginController$1.initialValue(DatabasePluginController.java:44) at com.moviejukebox.plugin.DatabasePluginController$1.initialValue(DatabasePluginController.java:39) at java.lang.ThreadLocal.setInitialValue(ThreadLocal.java:160) at java.lang.ThreadLocal.get(ThreadLocal.java:150) at com.moviejukebox.plugin.DatabasePluginController.scan(DatabasePluginController.java:70) at com.moviejukebox.MovieJukebox.updateMovieData(MovieJukebox.java:1051) at com.moviejukebox.MovieJukebox.access$100(MovieJukebox.java:80) at com.moviejukebox.MovieJukebox$4.call(MovieJukebox.java:613) at com.moviejukebox.MovieJukebox$4.call(MovieJukebox.java:600) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java

+1  A: 

ProxySelector is an abstract class. Are you trying to instantiate it directly?

Jim Garrison
@Jim: Lets say Shinda is instantiating it directly, will it result in a NoClassDefFoundError ?
codaddict
Only in strange situations where the compiler can't detect that at runtime due to the compile-time class definition not being the same one used at runtime.
Jim Garrison
A: 

My CLASSPATH is set to /usr/lib/jvm/jre-1.6.0-openjdk/lib.

don't think that should be in your CLASSPATH

try clearing the CLASSPATH and running it

objects
Not having the class path didn't make a difference with this error.
SS44
A: 

Firstly, you shouldn't have to put "/usr/lib/jvm/jre-1.6.0-openjdk/lib" on your classpath. The "java" command should put all of the standard J2SE libraries on the bootclasspath without you doing anything.

Second, it would help if you gave us the full stacktrace, not just the exception message. I suspect that the real problem is that java.net.ProxySelector (or something it depends on) is failing during static initialization. But only a stacktrace would confirm that.

Stephen C