2 Replies Latest reply on May 9, 2002 1:28 PM by fstarsinic

    HELP deploying an ear file... with details :)

    fstarsinic

      i'm re-posting this with as many details as i can cough up. hopefully someone can shed some light on this issue
      i have.

      in a general sense, i am trying to deploy an ear archive that contains a "utility.jar". "utility.jar" is neither an ejb or a web archive. just classes i need.

      i would assume that the problem lies in the correct configuration of the Manifest.mf files. i've read many articles, a tremendous number of posts in the forum and a tremendous number of hours trying different configurations.

      i have a jar file that i want accessible to my application without putting it in the jboss classpath (to enable re-deployment). how do i allow access from a .war and from my ejbs. i thought the way to do that was to add the jar file (call it "utility.jar") to the .ear archive
      and to the .war archive.

      here's what i'm doing.

      i have a jar file "bootstrap.jar" that is put in the jboss classpath
      by adding a classpath extension in jboss.conf (works great).
      i do this because i have 3 mbeans that get loaded on jboss startup.
      that all works perfectly. i'm assumming this is the right way to go.

      i have more base classes and utility classes that are used on all projects where i work that i put in a jar file
      (call it "utility.jar"). these classes are necessary but since they
      are not needed in the 3 mbeans, i can keep them out of the jboss classpath to enable re-deployment.

      i have my application jar file which contains an ejb, and basically the rest of the application. i have the necessary deployment descriptor for the ejb (call it "application.jar"). also in this file is a meta-inf directory that contains a Manifest.mf file

      i also have a web archive that contains all the web pages, the servlets, and a web-inf\lib and a meta-inf\Manifest.mf
      "application.war"

      i have my .ear archive that contains everything!
      "application.ear"

      So here are the details....

      ======ear archive=====
      application.jar
      application.war
      utility.jar
      application.xml meta-inf\
      Manifest.mf meta-inf\
      ======================

      and Manifest.mf looks like this (basically empty)...
      ======================
      Manifest-Version: 1.0
      Created-By: Ant 1.4
      ======================

      and application.xml looks like this
      ===================================

      <display-name>AFSP</display-name>



      <web-uri>application.war</web-uri>
      <context-root>/afsp</context-root>




      application.jar


      ====================================

      my application.jar has all my classes and
      the following as well (because there is an ejb in the jar)
      i'm assumming that putting an ejb in any jar file is
      ok, as long as there is a deployment descriptor
      as opposed to have one jar for the ejb and another
      jar for helper classes?
      ========================================
      ejb-jar.xml meta-inf\
      jboss.xml meta-inf\
      Manifest.mf meta-inf\
      ========================================

      and Manifest.mf looks like this...
      ========================================
      Manifest-Version: 1.0
      Created-By: Ant 1.4
      Class-Path: utility.jar
      ========================================
      putting utility.jar in this Manifest.mf file
      i thought was the key to making sure that utility.jar
      was accessible to the application upon deployment


      now for Application.war which contains
      all the web pages, servlets, and...
      =======================================
      web.xml web-inf\
      application.jar web-inf\lib
      utility.jar web-inf\lib
      Manifest.mf meta-inf\
      jsp pages
      images
      =======================================

      where the Manifest.mf looks like this...
      =======================================
      Manifest-Version: 1.0
      Created-By: Ant 1.4
      Class-Path: application.jar utility.jar
      =======================================
      originally, i did not think that these jar files should
      be necessary in the .war archive but from reading posts
      in the forum, apparently they need to be here too.


      So that is the configuration of my application.

      I wish i could say that i have a straightforward
      problem but what i'm experiencing does not quite
      make sense to me.


      I get a NoClassDefFoundError
      on a base class in utility.jar.

      The class that is trying to instantiate the "bad" class,
      is in the same package as the "bad" class, which is strange.
      (See the NOTE in the stacktrace below)


      The only nuance I can come up with is that the class that
      is being instantiated is done so via
      Class.forName("badclass.class");
      I bring this up because I saw some post in the forum about
      possible ClassLoader problems using Class.forName();


      Here is the stacktrace. . .

      java.lang.NoClassDefFoundError: gov/ca/boe/wf/BaseActivity
      at java.lang.ClassLoader.defineClass0(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
      at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
      at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
      at javax.management.loading.MLet.findClass(MLet.java:775)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:290)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
      at java.lang.ClassLoader.defineClass0(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
      at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
      at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:120)
      ***************************************************************************************************
      NOTICE THAT THIS CLASS HERE IS IN THE SAME PACKAGE (IN UTILTY.JAR) AS THE CLASS THAT CANNOT BE FOUND
      at gov.ca.boe.wf.Workcase.execute(Workcase.java)
      ***************************************************************************************************
      at gov.ca.boe.afsp.ejb.jms.WorkflowEngine.onMessage(WorkflowEngine.java)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDrivenContainer.java:400)
      at org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenInstanceInterceptor.java:58)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:133)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:307)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:99)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:128)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:195)
      at org.jboss.ejb.MessageDrivenContainer.invoke(MessageDrivenContainer.java:281)
      at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:165)
      at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:644)
      at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:420)
      at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:295)
      at org.jboss.mq.SpySession.run(SpySession.java:216)
      at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:177)
      at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:655)
      at java.lang.Thread.run(Thread.java:484)
      setting up logging for gov.ca.boe.afsp.ejb.jms.WorkflowEngine
      INFO gov.ca.boe.afsp.ejb.jms.WorkflowEngine WorkflowEngine [Thread Pool Worker-0] (?:?) - Setting up Logging for gov.ca.boe
      .afsp.ejb.jms.WorkflowEngine
      DEBUG gov.ca.boe.afsp.ejb.jms.WorkflowEngine WorkflowEngine [Thread Pool Worker-0] (?:?) - ejbCreate()
      DEBUG org.jboss.jms.asf.StdServerSessionPool [Thread Pool Worker-0] (StdServerSessionPool.java:219) - recycled server sessi
      on: org.jboss.jms.asf.StdServerSession@1722c9
      DEBUG org.jboss.jms.asf.StdServerSession [Thread Pool Worker-0] (StdServerSession.java:225) - done




      I hope this question is of an appropriate format.
      If i still have terrible voids in my details, please let me know.

      thanks,
      frank

        • 1. Re: HELP deploying an ear file... with details :)
          fstarsinic

          here is my jboss configuration.
          let that out.
          sorry,
          frank


          jboss 2.4.1
          windows 2000
          jdk 1.3.1

          • 2. Re: HELP deploying an ear file... with details :)
            fstarsinic

            Here's something else i notice.

            if i create a jsp file,
            i can put in an import statement to the "bad class"

            <%@ page import="gov.ca.boe.wf.BaseActivity"%>

            and it compiles fine so the internal jsp compiler can see the class.
            but when i actually try to create an instance
            at runtime it fails.

            to test further i created another import
            (changed explitives to pg-13 words for the forum)
            <%@ page import="darn.shoot.gee.whiz"%>

            this fails when the internal jsp compiler tries
            to compile the page, as expected.

            so, it appears that part of jboss can see the class
            (or classes in that package) and part cannot.

            i also tried to instantiate the class with and
            without using Class.forName() and both seem to
            fail, so perhaps Class.forName() is not an issue.