3 Replies Latest reply on Dec 28, 2006 8:28 AM by chrismalan

    Class not found

    chrismalan

      There is a utility class (UsernamePasswordHandler) in the war container. It is used for log-ins. When instantiated from any class in the war container, things are fine.

      However, when the only class in the jar container that needs it tries to instantiate it, a java.lang.NoClassDefFoundError exception is thrown.

      The package structure is as for EJB3, a war and a jar inside an ear.

      The UsernamePasswordHandler is not mentioned in the web.xml - I don't know if this is relevant.

      The jboss-app.xml looks like this:

      <jboss-app>
       <loader-repository>
       transportsite:app=ejb3
       </loader-repository>
      </jboss-app>


      Any idea how to solve this problem that seems to be class loader related?

      As an aside, the time and dates displayed by the console as JBoss starts up are all 11 hours behind. Same for the log files. That safely places it in one of the USA time zones. I am in Aussie. The system time is correct. Is this a JBoss problem, a log4j problem or a Java problem? Any idea how to fix it? There is a timer which which needs times. Subtracting 11 hours from the time the timer should fire makes things work, but that is not really the way to go.

      Thanks for any help.

        • 1. Re: Class not found
          peterj

          Where is the UsernamePasswordHandler class located? If it is in the war file, nothing in the jar file will have access to it. If you require that classes in the jar fiel access this class, you must move the class to the jar file. Then classes in both the war and jar file will have access.

          Regarding the the time issue, I am going to make the assumption that you are running Linux. I always end up with the same issue, where I cannot seem to get the system clock and the operating system time zone to match up correctly (I never seem to have this problem in Windows). I always end up with various programs thinking the time is something other than what it is. I believe the JVM gets the time zone from the operating system and works accordingly. I wish I could tell you exactly where to fix this at, but poking around the time settings should help (start with what you bios thinks the time is, and work from there). Good luck.

          • 2. Re: Class not found
            chrismalan

            Hi Peter,

            Thanks for your answer. Clear, unambiguous and easy to implement. I like them that way. ;-)

            Yes, I am running Gentoo. I am just finished updating everything - new gcc (4.1), new kernel (2.6.18), new KDE (3.5.5) and new everything else, including JDK.

            When I do "date" on the command line the time is Aussie time, Sydney, as it should be. So, no problem with the system time. I'll post on the Java forums and see what they say. If I get anything back I'll post it here.

            I made a mistake with the time zone returned; it is not a USA zone but GMT. We are in summer time and 11 hours ahead of GMT.

            Thanks again.

            • 3. Re: Class not found
              chrismalan

              Hi Peter,

              Here is the solution to the java time problem in Linux. I added one line to my JBoss start-up script and that does it. Here is the whole start-up script:

              #!/bin/bash
              export JBOSS_HOME=/usr/local/jboss-4.0.4.GA
              export JAVA_OPTS=-Duser.timezone=Australia/Sydney
              /usr/local/jboss-4.0.4.GA/bin/run.sh


              Another problem bites the dust.