Hey,

I have a solution for this annoying bug. Perhaps someone ( ?Rickard) maybe
able to give a better explanation.

It seems that when we start jBoss inside an IDE - i.e. JBuilder or NetBeans
etc. we get this message "java.lang.ClassCastException:
sun.misc.Launcher$AppClassLoader". I have submitted a diff of what I changed
to get this to work, in a nutshell - both changes are in
org.jboss.util.ClassPathExtension.java:

1) get the ClassLoader from the currentThread() - this gets rid of the
ClassCastException, but uncovers 2)a NullPointerException, which is fixed by
doing a simple null check.

Diff is below. 14 hour flights give you plenty of time to debug :-)



regards,

-Rob

----------

Robert Castaneda  [EMAIL PROTECTED]
CustomWare        http://www.customware.com



<diff>

D:\apps\WinCvs 1.1>diff -u -w -B
D:\sw\jBoss2.0_pr3\src\org\jboss\util\ClassPathExtension.java_cvs.j
ava D:\sw\jBoss2.0_pr3\src\org\jboss\util\ClassPathExtension.java
--- D:\sw\jBoss2.0_pr3\src\org\jboss\util\ClassPathExtension.java_cvs.java
Sun Aug 06 03:04:08
2000
+++ D:\sw\jBoss2.0_pr3\src\org\jboss\util\ClassPathExtension.java       Sun
Aug 06 03:06:43 2000
@@ -44,7 +44,8 @@
    public ObjectName preRegister(MBeanServer server, ObjectName name)
       throws java.lang.Exception
    {
-      MLet mlet = (MLet)getClass().getClassLoader();
+      MLet mlet = (MLet) Thread.currentThread().getContextClassLoader();
+

       if (url.endsWith("/"))
       {
@@ -63,6 +65,8 @@
          {
             String[] files = dir.list();
             int found = 0;
+            if ( files != null )
+            {
             for (int i = 0; i < files.length; i++)
             {
                if (files[i].endsWith(".jar") || files[i].endsWith(".zip"))
@@ -74,6 +78,7 @@
                   found++;
                }
             }
+            }//if files != null

             if (found == 0)
             {

</diff>


Reply via email to