2 Replies Latest reply on Jan 4, 2011 5:48 PM by momsse

    Problem with importing a simple Java project on an Ejb

    momsse Newbie

      Hello and happy new year,

       

      Please excuse me for my English (i am French).

       

      I'm new to JBoss (AS version 4.4 GA), I work on a project with EJB 3.0, and am having a problem to import a project (a simple java project) in my EJB:

       

      My project contains an EJB module:

      - DemoEJB

      an WAR:

      - DemoWAR

      and an EAR that includes them:

      -DemoEAR

       

      I want to use a Java project that contains the example for this simple class:

       

      public class Hello {
      
          public String hello(){
           return "Hello";
          }
      }
      

       

       

       

      When I made it like that:

       

      @Entity
      @Table(name = "addresses")
      public class Address implements Serializable {
      
          @Id
          @GeneratedValue(strategy = GenerationType.AUTO)
          private int ID;
          private String name;
      
          public Address() {
          }
      
          //Using Hello in parameter here ...
          public Address(Hello h) {
          }
      
          //...
      }
      

       

       

      I get the following error:

       

      18:40:37,464 ERROR [URLDeploymentScanner] Incomplete Deployment listing:

       

      --- MBeans waiting for other MBeans ---

      ObjectName: persistence.units:ear=DemoEAR.ear,jar=DemoEJB.jar,unitName=DemoPU

        State: FAILED

        Reason: java.lang.RuntimeException: java.lang.NoClassDefFoundError: hello/Hello

        I Depend On:

          jboss.jca:service=ManagedConnectionFactory,name=DemoDS

        Depends On Me:

          jboss.j2ee:ear=DemoEAR.ear,jar=DemoEJB.jar,name=DemoDB,service=EJB3

       

      ObjectName: jboss.j2ee:ear=DemoEAR.ear,jar=DemoEJB.jar,name=DemoDB,service=EJB3

        State: NOTYETINSTALLED

        I Depend On:

          persistence.units:ear=DemoEAR.ear,jar=DemoEJB.jar,unitName=DemoPU

        Depends On Me:

          jboss.j2ee:ear=DemoEAR.ear,jar=DemoEJB.jar,name=DemoRemoteImpl,service=EJB3

       

      ObjectName: jboss.j2ee:ear=DemoEAR.ear,jar=DemoEJB.jar,name=DemoRemoteImpl,service=EJB3

        State: NOTYETINSTALLED

        I Depend On:

          jboss.j2ee:ear=DemoEAR.ear,jar=DemoEJB.jar,name=DemoDB,service=EJB3

       

      --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---

      ObjectName: persistence.units:ear=DemoEAR.ear,jar=DemoEJB.jar,unitName=DemoPU

        State: FAILED

        Reason: java.lang.RuntimeException: java.lang.NoClassDefFoundError: hello/Hello

        I Depend On:

          jboss.jca:service=ManagedConnectionFactory,name=DemoDS

        Depends On Me:

          jboss.j2ee:ear=DemoEAR.ear,jar=DemoEJB.jar,name=DemoDB,service=EJB3

       

       

      Thanking you in advance for your help

        • 1. Re: Problem with importing a simple Java project on an Ejb
          Wolf-Dieter Fink Master

          You have to add the 'simple jar' to your EAR file and declare it within the application.xml.

          See JBoss or Sun tutorial or post application.xml and ear structure.

          • 2. Re: Problem with importing a simple Java project on an Ejb
            momsse Newbie

            I solved the problem by adding the library as if it were a client module.

            I don't know if it's the best solution, but at least it works.

            Thank you for your help!

             

            <?xml version="1.0" encoding="UTF-8"?>
            <?xml version="1.0" encoding="UTF-8"?>
            <application version="1.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">
              <display-name>DemoEAR</display-name>
              <module>
                <ejb>DemoEJB.jar</ejb>
              </module>
              <module>
                <web>
                  <web-uri>DemoWeb.war</web-uri>
                  <context-root>/DemoWeb</context-root>
                </web>
              </module>
              <module>
                 <java>lib/HelloLibrary.jar</java>
              </module>
            </application>