3 Replies Latest reply on Dec 2, 2001 10:46 PM by IPOz

    Why i canot deploy cd.jar

    IPOz Newbie

      Hi,friends
      I have successfully deploy the interest.jar on my linux box.But when deploying cd.jar it tells me that "Could not deploy file:/usr/local/JBoss-2.4.3_Tomcat-3.2.3/jboss/tmp/deploy/Default/cd.jar,
      Cause:org.jboss.ejb.DeploymentException: Bean com.web_tomorrow.cd.CDBean not found within this application."
      The source directory is described as below:
      src
      |_com
      | |_web_tomorrow
      | |_cd
      | | (CD.class,CDBean.class,CDHome.class,
      | | CDCollection.class,
      | | CDCollectionBean.class,
      | | CDCollectionHome.class,
      | | CDExistsException.class)
      | |_jspcd
      | |_utils()
      |_MATA-INF
      | (ejb-jar.xml,jboss.xml)
      |_WEB_INF
      On src directory
      #jar -cvf cd.jar com/web_tomorrow/cd/*.class \
      com/web_tomorrow/utils/*.class META-INF/
      When i cp the cd.jar to deploy directory jboss automatically begin deploying the cd.jar and echo the above message and stop deploying.
      Here is my configuration file:
      [ejb-jar.xml]
      <?xml version="1.0" encoding="Cp1252"?>

      <ejb-jar>
      <display-name>MusicCDs</display-name>
      <enterprise-beans>

      Models a music CD
      <ejb-name>CDBean</ejb-name>
      com.web_tomorrow.cd.CDHome
      com.web_tomorrow.cd.CD
      <ejb-class>com.web_tomorrow.cd.CDBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.String</prim-key-class>
      False
      <cmp-field><field-name>id</field-name></cmp-field>
      <cmp-field><field-name>title</field-name></cmp-field>
      <cmp-field><field-name>artist</field-name></cmp-field>
      <cmp-field><field-name>type</field-name></cmp-field>
      <cmp-field><field-name>notes</field-name></cmp-field>
      <primkey-field>id</primkey-field>



      Models a music CD collection
      <ejb-name>CDCollectionBean</ejb-name>
      com.web_tomorrow.cd.CDCollectionHome
      com.web_tomorrow.cd.CDCollection
      <ejb-class>com.web_tomorrow.cd.CDCollectionBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Bean</transaction-type>
      <ejb-ref>
      <ejb-ref-name>ejb/CD</ejb-ref-name>
      <ejb-ref-type>Entity</ejb-ref-type>
      com.web_tomorrow.cd.CDHome
      com.web_tomorrow.cd.CD
      <ejb-link>com.web_tomorrow.cd.CDBean</ejb-link>
      </ejb-ref>


      </enterprise-beans>

      <assembly-descriptor>
      <container-transaction>

      <ejb-name>CDBean</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      </assembly-descriptor>
      </ejb-jar>

      [jboss.xml]
      <?xml version="1.0" encoding="Cp1252"?>


      false
      <container-configurations />
      <resource-managers />

      <enterprise-beans>

      <ejb-name>CDCollectionBean</ejb-name>
      <jndi-name>cd/CDCollection</jndi-name>
      <configuration-name></configuration-name>



      <ejb-name>CDBean</ejb-name>
      <jndi-name>cd/CD</jndi-name>
      <configuration-name></configuration-name>


      </enterprise-beans>


      I am frustrated now! Any help is greatly appreciated!

      Best Regards!

        • 1. Re: Why i canot deploy cd.jar
          IPOz Newbie

          I have posted this question on serveral forum but i cannot get any response :(
          Wish i would get any suggestion here!


          Best Regards!

          • 2. I have solved the problem  :)
            IPOz Newbie

            $(jboss_home)/log/server.log told me that i should have a look at Container.java first.So i openned it and found the following code snippet:
            ......
            Logger.debug("Binding an EJBReference "+ref.getName());

            if (ref.getLink() != null) {
            // Internal link
            Logger.debug("Binding "+ref.getName()+" to internal JNDI source: "+ref.getLink());
            Container refContainer = getApplication().getContainer(ref.getLink());
            if (refContainer == null)
            throw new DeploymentException ("Bean "+ref.getLink()+" not found within this application.");
            ......
            OK,the DeploymentException is thrown because the refContainer is null.
            Have a look at getContainer method below:
            public Container getContainer(String name)
            {
            return (Container)containers.get(name);
            }
            where,
            containers is a HashMap which holds the mapping between ejbName and container.So the reason is the jboss cannot find corresponding container from the given parameter - name.Its value is ref.getLink()'s return value,com.web_tomorrow.cd.CDBean.
            open the ejb-jar.xml,i found link is defined as below:
            ......
            <ejb-ref>
            <ejb-ref-name>ejb/CD</ejb-ref-name>
            <ejb-ref-type>Entity</ejb-ref-type>
            com.web_tomorrow.cd.CDHome
            com.web_tomorrow.cd.CD
            <ejb-link>com.web_tomorrow.cd.CDBean</ejb-link> <- ´íÎóÖ®´¦
            </ejb-ref>
            ......
            After i changed it to <ejb-link>CDBean</ejb-link> the jboss can deploy cd.jar normally.

            The problem itself isnot complicate but it demonstrated that the open source is good for you to fix the bug up!
            BTW,in order to making it easy to fix the bug, the jboss binay version is built with debug infomation.So you can rebuid it without any debug infomation.
            ......


            <javac srcdir="${src.dir}"
            destdir="${build.classes.dir}"
            debug="on" <- ¸ÄΪ"off",¾ÍÄܹصôµ÷ÊÔÐÅÏ¢????????????
            deprecation="off"
            optimize="on"
            includes="org/**"
            excludes="**/activation/**, **/*BeanInfo.java"
            >


            ......


            Best Regards!

            • 3. I have solved the problem
              IPOz Newbie

              $(jboss_home)/log/server.log told me that i should have a look at Container.java first.So i openned it and found the following code snippet:
              ......
              Logger.debug("Binding an EJBReference "+ref.getName());

              if (ref.getLink() != null) {
              // Internal link
              Logger.debug("Binding "+ref.getName()+" to internal JNDI source: "+ref.getLink());
              Container refContainer = getApplication().getContainer(ref.getLink());
              if (refContainer == null)
              throw new DeploymentException ("Bean "+ref.getLink()+" not found within this application.");
              ......
              OK,the DeploymentException is thrown because the refContainer is null.
              Have a look at getContainer method below:
              public Container getContainer(String name)
              {
              return (Container)containers.get(name);
              }
              where,
              containers is a HashMap which holds the mapping between ejbName and container.So the reason is the jboss cannot find corresponding container from the given parameter - name.Its value is ref.getLink()'s return value,com.web_tomorrow.cd.CDBean.
              open the ejb-jar.xml,i found link is defined as below:
              ......
              <ejb-ref>
              <ejb-ref-name>ejb/CD</ejb-ref-name>
              <ejb-ref-type>Entity</ejb-ref-type>
              com.web_tomorrow.cd.CDHome
              com.web_tomorrow.cd.CD
              <ejb-link>com.web_tomorrow.cd.CDBean</ejb-link> <- ´íÎóÖ®´¦
              </ejb-ref>
              ......
              After i changed it to <ejb-link>CDBean</ejb-link> the jboss can deploy cd.jar normally.

              The problem itself isnot complicate but it demonstrated that the open source is good for you to fix the bug up!
              BTW,in order to making it easy to fix the bug, the jboss binay version is built with debug infomation.So you can rebuid it without any debug infomation.
              ......


              <javac srcdir="${src.dir}"
              destdir="${build.classes.dir}"
              debug="on" <- ¸ÄΪ"off",¾ÍÄܹصôµ÷ÊÔÐÅÏ¢????????????
              deprecation="off"
              optimize="on"
              includes="org/**"
              excludes="**/activation/**, **/*BeanInfo.java"
              >


              ......


              Best Regards!