6 Replies Latest reply on Jan 26, 2004 3:04 PM by juha

    Deploying an EJB

    nagulapati

       

      "nagulapati" wrote:
      Hi Guys,

      Does anyone know how to deploy an EJB whose bean accesses a different class[by instantiating an object of that class]?

      I tried copying the class file into lib directory and made sure that this class file was on my CLASSPATH but in vain. I always get the following error when deploying the bean.

      java.lang.NoClassDefFoundError: AdminWebService

      Here AdminWebService is an entirely different class which is accessed by my EJB bean.

      Any pointers?

      Thanks in advance,
      Vivek


        • 1. Re: Deploying an EJB

          Thread.getContextClassLoader().loadClass("full.package.name");

          • 2. Re: Deploying an EJB
            razor_harm78

            I might be missing the point here. But can't you simply package your class into a jar file, and then package that jar into your ear file?

            I usualy do this:

            EAR --> ejb.jar
            dependend_classes.jar
            a_war_file.war
            a_second_war_file.war
            a_sar_file.sar

            (All the jar's / war's / sar's are packaged into a single ear file).

            • 3. Re: Deploying an EJB
              nagulapati

              Hello Juha,

              I tried loading the class using

              Thread.currentThread.getContextClassLoader().loadClass("AdminWebService");

              as you said but I am still getting the java.lang.NoClassDefFoundError.

              Any pointers?
              Vivek

              • 4. Re: Deploying an EJB
                darranl

                I tried copying the class file into lib directory

                I know that JBoss will automatically make classes located in jars in the lib directory available but will it actually make classes available.

                Also is your class definately in the default package?

                • 5. Re: Deploying an EJB
                  nagulapati

                  Hello Darran,

                  When you say:
                  Also is your class definately in the default package?

                  What do you mean by "default package"? Are you referring to the jar/ear file we pack our classes into or is it something else?

                  Thanks,
                  Vivek

                  • 6. Re: Deploying an EJB

                    you need to package the class into a jar, and make sure to provide the FQN of the class.