Difference between EJB2 and EJB3

Home Forums MyEclipse IDE WebSphere Development Difference between EJB2 and EJB3

This topic contains 21 replies, has 3 voices, and was last updated by Profile photo of hahagal hahagal 3 years, 2 months ago.

Viewing 15 posts - 1 through 15 (of 22 total)
  • Author
    Posts
  • #323447
    Profile photo of hahagal
    hahagal
    Member

    Hi,

    May I know what is the difference between EJB2 and EJB3?

    #323451
    Profile photo of support-swapna
    support-swapna
    Moderator

    hahagal ,

    Please take a look at these links :

    http://javaknowledgestorm.blogspot.in/2009/04/differences-between-ejb20-and-ejb30.html
    http://www.coderanch.com/t/318580/EJB-JEE/java/Difference-between-EJB-EJB

    I suggest you cross post to EJB forums for better support.

    Hope this helps.

    #323617
    Profile photo of hahagal
    hahagal
    Member

    Hi Swapna,

    In RAD, when creating session bean, we have the following created:
    SB_Test
    SB_TestBean
    SB_TestHome
    SB_TestLocal
    SB_TestLocalHome

    How to do this in MyEclipse Blue 10?

    #323620
    Profile photo of hahagal
    hahagal
    Member

    Hi Swapna,

    I found this link:
    http://www.myeclipseide.com/documentation/quickstarts/firstejb/

    I followed the instructions, somehow manage to get the following. But when I click Run XDoclet, it will also make changes to the existing ones and I have around 7000 errors in my workspace now. FYI, I just did migration from RAD to MEB10. What should I do now?

    SB_Test
    SB_TestBean
    SB_TestHome
    SB_TestLocal
    SB_TestLocalHome

    #323677
    Profile photo of hahagal
    hahagal
    Member

    Hi Swapna,

    Is it possible that we only run XDoclet for those newly created session bean? Those old session bean migrated from RAD will be left untouched.

    #323681
    Profile photo of support-swapna
    support-swapna
    Moderator

    hahagal ,

    You can run XDoclet on a project and not on individual session beans.

    Sorry that you are seeing issues when running XDoclet.

    Can you answer some more questions for us ?

    1) Can you clarify if after enhancement of RAD project to MyEclipse, did you see any errors in the workspace ?

    2) Are you working with EJB2 or EJB 3 project ?

    3) Did you configure the XDoclet ? Can you recheck if you have not removed needed subtasks when configuring the XDoclet ?

    4) Please switch to a new workspace, migrate the RAD project, enhance it, configure the XDoclet and attach the .log file which is located at <workspace dir>/.metadata/.log for us to investigate further.

    5) Also please attach a screenshot of the IDE with the error to help us investigate further. Here is an FAQ to attach files to forums : https://www.genuitec.com/forums/topic/troubleshooting-how-to-upload-attachments-on-forum/

    #323723
    Profile photo of hahagal
    hahagal
    Member

    Hi Swapna,

    1) After I enhance RAD project to work with MEB, there are errors.. but I have cleared the errors and application is working fine.

    2) RAD is using EJB2.1. In MEB I used EJB2.0 with XDoclet.

    3) Yes, I have configure the XDoclet (Standard EJB), with these subtasks (deploymentdescriptor, fileset, homeinterface, localhomeinterface, localinterface, packageSubstitution, remoteinterface, websphere)

    4) Please see my replies for other questions. If still needed, I will try to migrate once more and attach the log

    5) The errors should be it couldn’t find the methods in the session bean. I found out that I need to add the following to the every methods in the session bean then the error will be cleared. Is this the correct way?

    
             /**
         * An example business method
         *
         * @ejb.interface-method view-type = "local"
         * 
         * @throws EJBException Thrown if method fails due to system-level error.
         */
    
    Attachments:
    You must be logged in to view attached files.
    #323729
    Profile photo of support-swapna
    support-swapna
    Moderator

    hahagal ,

    Thank you for the details. I have escalated it to a dev team member. They will get back to you.

    Sorry for the inconvenience caused.

    #323757
    Profile photo of hahagal
    hahagal
    Member

    Hi Swapna,

    Lets say I have 2 session beans, SB_WhiteBean, and SB_RedBean. Currently, if I want to call the methods in SB_RedBean from SB_WhiteBean, I have to add in the following codes to SB_WhiteBean. This can’t be automated? Is this the correct way?

    
    //    SB_RedLocal aSB_RedLocal = createSB_RedLocal();
        private final static String STATIC_SB_RedLocalHome_REF_NAME = "ejb/SB_Red";
        private final static Class STATIC_SB_RedLocalHome_CLASS = SB_RedLocalHome.class;
        protected SB_RedLocal createSB_RedLocal() {
            SB_RedLocalHome aSB_RedLocalHome = (SB_RedLocalHome) ServiceLocatorManager
                    .getLocalHome(STATIC_SB_RedLocalHome_REF_NAME,
                            STATIC_SB_RedLocalHome_CLASS);
            try {
                if (aSB_RedLocalHome != null)
                    return aSB_RedLocalHome.create();
            } catch (javax.ejb.CreateException ce) {
                // TODO Auto-generated catch block
                ce.printStackTrace();
            }
            return null;
        }
    
    #323772
    Profile photo of support-swapna
    support-swapna
    Moderator

    hahagal ,

    I do not think there is an automated way.
    I suggest you cross post to EJB development forums for better support on development related queries.

    #323789
    Profile photo of hahagal
    hahagal
    Member

    Hi Swapna,

    As we have never used EJB with XDoclet before, is there any tutorial on how to call methods from other session beans?

    #323799
    Profile photo of hahagal
    hahagal
    Member

    Hi Swapna,

    I have just finish clearing the errors on MEB and when I tried to deploy the EAR project to Websphere, I saw this in the deployment log. When I open ejb-jar.xml, the binding are gone as well.

    
    ADMA0002E: A validation error occurred in task Binding enterprise Bean to JNDI names. The Java Naming and Directory Interface (JNDI) name is not specified for enterprise bean SB_CashProjection in module Generated by XDoclet.
    ADMA0002E: A validation error occurred in task Binding enterprise Bean to JNDI names. The Java Naming and Directory Interface (JNDI) name is not specified for enterprise bean SB_Tradecontrol in module Generated by XDoclet.
    ADMA0002E: A validation error occurred in task Binding enterprise Bean to JNDI names. The Java Naming and Directory Interface (JNDI) name is not specified for enterprise bean SB_Load in module Generated by XDoclet.
    ADMA0002E: A validation error occurred in task Binding enterprise Bean to JNDI names. The Java Naming and Directory Interface (JNDI) name is not specified for enterprise bean SB_Holidays in module Generated by XDoclet.
    ADMA0002E: A validation error occurred in task Binding enterprise Bean to JNDI names. The Java Naming and Directory Interface (JNDI) name is not specified for enterprise bean SB_TradeID in module Generated by XDoclet.
    ADMA0002E: A validation error occurred in task Binding enterprise Bean to JNDI names. The Java Naming and Directory Interface (JNDI) name is not specified for enterprise bean SB_Cashdeal in module Generated by XDoclet."
    
    #323837

    hahagal ,

    Trying to summarize what happened:

    You imported RAD EAR project having EJB 2.1 project as a module, enhanced RAD projects to work with MyEclipse, got some error and fixed them.
    Then you configured standard WebSphere XDoclet for the project, created 2.0 stateless session bean using ME wizard and ran XDoclet for the project.
    That modified both existing 2.1 beans (old ones from RAD), made lots of errors to appear in those RAD beans and also modified ejb-jar.xml in a way that <session id=”YourRADBean”>…</session> tags did disappear.

    Is that correct?

    Quick question: what errors did you face after enhancing RAD projects to work with ME and how did you fix them?

    Best regards,
    Denis.

    #323839
    Profile photo of hahagal
    hahagal
    Member

    Hi denis,

    Yes. Just to add on, my EAR project includes Web project as well.
    I configure Standard EJB and include websphere as subtask, not Standard EJB for Websphere.
    Please refer to the 2 attached screenhshots for the modification before and after I run XDoclet.

    This is what I did. Added some libraries and external jars, set JRE to Websphere 6.1 JDK, compiler 1.5, project facets > java 1.5, disable some validations

    Attachments:
    You must be logged in to view attached files.
    #323927
    Profile photo of hahagal
    hahagal
    Member

    Hi,

    Is there any updates on this?

Viewing 15 posts - 1 through 15 (of 22 total)

You must be logged in to reply to this topic.