2 Replies Latest reply on Nov 9, 2004 1:24 PM by meatus

    Applet problem - ClassNotFoundException

    alehrens

      Hi,

      I'm trying to run an applet with Jboss 3.2.3.

      I only want to put my one main applet class in the jar that resides in the war file and then have the utility classes reside in a common area so that other .ears can see them as well. Originally, I thought this would be in the server lib directory, but I believe that I see that the files need to go into the client directory to be accessed by the applet. The problem is that the applet class is not finding my utility classes and throwing a ClassNotFoundException.

      Thoughts on things to try? Is my thinking off base on whether or not this should work? Do I need to somehow specify what's in the lib directory?

      The archive tag in the applet looks like this...

      ARCHIVE = "Applet.jar, log4j.jar, jboss-client.jar, jboss-j2ee.jar, jbosssx-client.jar, jnp-client.jar, jndi.jar, jaas.jarjboss-j2ee.jar, jsse.jar, jboss-common-client.jar, jnp-client.jar, jnet.jar, jboss-transaction-client.jar, Oromatcher.jar, quicktable2swing11.jar, SimShopAppNonEJB.jar"

      With SimShopAppNonEJB.jar containing my utility class. I thought that just putting it in the same directory with these other jboss classes would work, but apparently I'm still off base.

      Thoughts?

      Thanks,
      Aaron

        • 1. Re: Applet problem - ClassNotFoundException
          alehrens

          Turns out that everything that the applet is going to use had to go into my applet ear. So, the classes reside in two places, but theoretically, should never conflict because they're the same classes.

          • 2. Re: Applet problem - ClassNotFoundException
            meatus

            As far as never conflicting, there definitely could be a problem there. In a very similar deployment scheme, I was getting ClassCastExceptions because I had redundant files in different archives. In looking into the matter, I found similar stories with most developers blaming the fact that java identifies classes, not only by their byte-code, but also by the classloader that loaded them. In JBoss (I believe), every archive in the deploy directory gets its own classloader. So, if a class is created with the class from one archive and later cast (as mine was after being down cast to an Object) to the class from the second archive, you'll get a ClassCastException. I only managed to resolve the problem by grouping everything into an exploded ear which eliminated the redundant file.

            I'm still working my way through the classloader paradigm, and, it seems, 4.0 has made some changes. If I've missed the lollipop on this, someone correct me.

            ~Brett