This Tuesday, I am presenting at the Philadelphia JBoss Users Group on using Embedded JBoss, a very cool way that allows you to do things like test EJBs using JUnit without having to install an application server.  The slides are ready but I wanted to make sure my demos are running.  So I go to run the tests and my first error is:

Class not found: [Ljava.lang.String;

What the hell?  Of course I initially assume it is something I did wrong, then that it is something in the JBoss configuration.  After much anguish and googling, it turns out there is an awesome bug/feature in Java 1.6 where the following code (which worked in Java 1.5) throws a ClassNotFoundException in Java 1.6.

  public class test {

      public static void main(String[] args) throws Exception {
          String[] s = new String[] { “123” };
          String clName = s.getClass().getName();
          test.class.getClassLoader().loadClass(clName);  // throws exception in JDK 1.6!
      }
  }

But the lameness did not stop there.  The next issue that popped up was a NullPointerException when trying to read a file.  Turns out there is a bug on Windows XP with directory names involving spaces.  I was running it off of my desktop, c:\Documents and Settings\rdimarco\Desktop.  Moving the application to the c:\jboss directory solved my problems.  I’m not sure if it is a JDK or JBoss bug, but at this point I’m just frustrated.