MyEclipse: Difference between EJB2 and EJB3

hahagal - Feb 20, 2012 - 01:24 AM
Post subject: Difference between EJB2 and EJB3
Hi,

May I know what is the difference between EJB2 and EJB3?
support-swapna - Feb 20, 2012 - 04:15 AM
Post subject:
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.
hahagal - Feb 23, 2012 - 06:41 AM
Post subject:
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?
hahagal - Feb 23, 2012 - 08:45 AM
Post subject:
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
hahagal - Feb 24, 2012 - 10:12 AM
Post subject:
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.
support-swapna - Feb 24, 2012 - 12:35 PM
Post subject:
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 : http://www.myeclipseide.com/PNphpBB2-viewtopic-t-27029.html
hahagal - Feb 27, 2012 - 02:01 AM
Post subject:
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?
Code:

         /**
    * An example business method
    *
    * @ejb.interface-method view-type = "local"
    *
    * @throws EJBException Thrown if method fails due to system-level error.
    */

support-swapna - Feb 27, 2012 - 11:34 AM
Post subject:
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.
hahagal - Feb 28, 2012 - 01:46 AM
Post subject:
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?

Code:

//   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;
   }

support-swapna - Feb 28, 2012 - 09:55 AM
Post subject:
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.
hahagal - Feb 29, 2012 - 01:19 AM
Post subject:
Hi Swapna,

As we have never used EJB with XDoclet before, is there any tutorial on how to call methods from other session beans?
hahagal - Feb 29, 2012 - 08:05 AM
Post subject:
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.

Code:

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."

support-denis - Mar 01, 2012 - 12:01 AM
Post subject:
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.
hahagal - Mar 01, 2012 - 03:01 AM
Post subject:
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
hahagal - Mar 05, 2012 - 01:54 AM
Post subject:
Hi,

Is there any updates on this?
support-denis - Mar 06, 2012 - 09:30 PM
Post subject:
hahagal,

Sorry for delay. It does not look like I can reproduce the issue you're facing.
Is there any chance to get a test case?

What I need is a (sample) project that gets ejb-jar.xml corrupted after running XDoclet.
It could be either your real project or just a sample RAD project with a single bean definition, you port to ME, enhance, and configure XDoclet for (please export the project before running XDoclet and make sure that running XDoclet does actually corrupt the ejb-jar.xml afterwards, so when I import the exported project and run XDoclet on my side I have the issue reproduced). You can send it to me via forum PM or mail to support@myeclipseide.com with "ATTN Brian" in a subject.

Note: enhancing RAD project to work with ME should not require you to modify JRE manually. If you haven't got it configured automatically, it would be very useful to get an original RAD project too so I can check if enhancement behavior is somehow incorrect.

Best regards,
Denis.
hahagal - Mar 07, 2012 - 02:00 AM
Post subject:
Hi denis,

Just sent a PM to you.
Regarding modifying the JRE manually, before I enhance the EAR project, I did not add the WebSphere 6.1 JDK to Window > Preferences > Java > Installed JREs and set it to default. Hence I think during the enhancement, it pick up the default JRE in the workspace, which is the Sun JDK.
hahagal - Mar 07, 2012 - 06:18 AM
Post subject:
Hi,

We are using EJB2.1. We are considering to move to EJB3.0. Can EJB2.1 sit together with EJB3.0? How should we go about migrating the EJB to 3.0?
support-denis - Mar 07, 2012 - 11:33 PM
Post subject:
hahagal,

I reproduced the issue you are having.
Consider using one of the following workarounds:

1) You can remove "deploymentdescriptor" subtask from your XDoclet configuration. This will make XDoclet to ingore ejb-jar.xml. The drawback is that you will have to handle ejb-jar.xml yourself.

2) Move your existing beans to XDoclet.

3) Create a separate EJB project for your new beans. This will also grant you an ability to freely use either xdoclet or 3.0 beans.

I'd recommend the 3-rd way.

>>Can EJB2.1 sit together with EJB3.0?
You should not have 2.1 and 3.0 beans in the same EJB project, but you can have 2.1 and 3.0 EJB projects in the same EAR.

Best regards,
Denis.
hahagal - Mar 08, 2012 - 02:02 AM
Post subject:
denis,

As my EAR project is J2EE1.4. When I tried to create new EJB project, there is no EJB3.0 with J2EE1.4. Does that means I can't use EJB3.0 with J2EE1.4? Or do I have to upgrade my EAR to J2EE1.5(JavaEE5.0)?
support-denis - Mar 09, 2012 - 05:32 AM
Post subject:
hahagal,

Yes, you can not use EJB 3.0 with 1.4 EAR, you need to upgrade your EAR to 5.0.
You can use 2.1 beans with EAR 5.0.

Best regards,
Denis.
hahagal - Mar 09, 2012 - 06:28 AM
Post subject:
denis,

How can we go about upgrading the enhanced project to 5.0?
All times are GMT - 6 Hours
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits