4 Replies Latest reply on Dec 23, 2003 4:47 AM by l_lan

    build Entity Bean from Session Bean

    l_lan Newbie

      Hi,

      I want to use both Entity Bean and Session Bean in a projekt, can I write my the two in the src/ejb package and jboss create remote and home interface for the both?

      how can I build a entity Bean from a Session Bean? Has Entity Bean and Session Bean the same remote and home interface? Or need I only one remote interface and home interface for the both Beans?

      thanks lot

      Lan

        • 1. Re: build Entity Bean from Session Bean
          micke Novice

          You can package your source the way you want, in seperate packages or all files in a big chunk. JBoss wont generate the files for you. You can use xdoclet for some assistance.

          You should not use the same class for remote interfaces for different EJBs. Its not just poor design, some app servers also use the remote interface to identify the EJB which might get you into trouble.

          • 2. Re: build Entity Bean from Session Bean
            l_lan Newbie

            but how should I name my Entity CMP Bean? like *Bean or *CMP, because I have got the problem :

            Warning: ThThe Bean Provider must specify the fully-qualified name of the Java class that implements the enterprise bean's business methods in the <ejb-class> element.
            Info : Class not found: mid.ejb.MIDSampleServicesEntityCMP

            14:37:57,701 ERROR [MainDeployer] could not create deployment: file:/C:/lan/jboss-3.2.1_tomcat-4.1.24/server/default/tmp/deploy/server/default/deploy/MIDSampleServicesApp.ear/56.MIDSampleServicesApp.ear-contents/MIDSampleServicesEJB.jar
            org.jboss.deployment.DeploymentException: Verification of Enterprise Beans failed, see above for error messages.
            at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:487)
            at org.jboss.deployment.MainDeployer.create(MainDeployer.java:784)
            at org.jboss.deployment.MainDeployer.create(MainDeployer.java:776)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:639)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:613)
            at sun.reflect.GeneratedMethodAccessor34.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
            at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
            at $Proxy7.deploy(Unknown Source)
            at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:302)
            at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:476)
            at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:200)
            at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:211)
            at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:190)

            • 3. Re: build Entity Bean from Session Bean
              micke Novice

              Make sure your jar MIDSampleServicesEJB.jar contains the class :

              mid/ejb/MIDSampleServicesEntityCMP.class

              if your <ejb-class> is set to mid.ejb.MIDSampleServicesEntityCMP

              • 4. Re: build Entity Bean from Session Bean
                l_lan Newbie

                thanks,
                I have checked, that I have include all class, that generated, including
                mid/ejb/MIDSampleServicesEntityCMP.class

                and I have also checke it in my ejb-jar.xml and in the entity part ist:

                <![CDATA[MIDSample CMP]]>
                <display-name>MIDSampleServices02 EJB</display-name>

                <ejb-name>MIDSampleServices02</ejb-name>

                mid.interfaces.MIDSampleServices02Home
                mid.interfaces.MIDSampleServices02

                <ejb-class>mid.ejb.MIDSampleServicesEntityCMP</ejb-class>
                ----------------------------------------------------------------------

                <persistence-type>Container</persistence-type>
                <prim-key-class>mid.ejb.MIDSampleKey</prim-key-class>
                False
                <cmp-version>2.x</cmp-version>
                <abstract-schema-name>MIDSampleServices02</abstract-schema-name>

                <!-- Write a file named ejb-finders-MIDSampleServices02Bean.xml if you want to define extra finders. -->



                so I have the class .

                is it possibel that I should use the correct name for a CMP entity bean, such like: **CMP.java for the CMP bean implementation?