Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8756053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:58:48+00:00 2026-06-13T13:58:48+00:00

Here Is the code that I have to create an EJB 2.0 How can

  • 0

Here Is the code that I have to create an EJB 2.0
How can I convert this so can be used for EJB 3.0

java.lang.Object ejbHomeStub = initCtx.lookup(ejbJNDIName);
EJBHome ejbHome = (EJBHome) 
    javax.rmi.PortableRemoteObject.narrow(ejbHomeStub, EJBHome.class);
EJBMetaData ejbMetaData = ejbHome.getEJBMetaData();
Class ejbHomeClass = ejbMetaData.getHomeInterfaceClass();
//get ejb object of home interface type
ejbHome = (EJBHome) javax.rmi.PortableRemoteObject.narrow(ejbHome, ejbHomeClass);
//create ejb remote object
Method ejbMethodCreate = ejbHomeClass.getDeclaredMethod(EJB_CREATE, null);
ejbRemoteObj = (EJBObject) ejbMethodCreate.invoke(ejbHome, null);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:58:49+00:00Added an answer on June 13, 2026 at 1:58 pm

    If you mean “how do I add EJB 3.0 interfaces to my EJB 2.0 JARs”, then you don’t need to convert the client or bean since EJB 3.0 is backwards compatible with EJB 2.0. Instead, just update ejb-jar.xml to remove the XSD, add XSD+xmlns, and update the version attribute of <ejb-jar/>.

    If you mean “how do I convert this to annotations”, then use the @RemoteHome annotation on the bean class, and keep your interfaces the same.

    If you mean “how do I convert the EJB to use business interface instead of homes”, then you can’t do that directly, since you have to know the type of the business interface a priori:

    java.lang.Object businessObjectStub = initCtx.lookup(ejbJNDIName);
    BusinessObject businessObject = (BusinessObject)
        javax.rmi.PortableRemoteObject.narrow(businessObjectStub, BusinessObject.class);
    

    (Some application servers do not require a narrow for EJB 3.0, but WebSphere Application Server 7.0 does.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the piece of code that I have used for Java 5.0 TreeSet<Integer>
I have no idea what this means. But here is the code that it
JAVA Code Here is some part of my code that I have written in
Here is the code that I currently have to create underlined header text in
so here's what's going on. I have a table that is created in code-behind
Here is the code that I have for my cell of my UITableView: forKeys:[NSArray
Here's the c# code that I have: private double get806Fees (Loan loan) { Loan.Fee.Items
enter code here I have a ListView that have a different Layout XML for
I have some code here that uses bitsets to store many 1 bit values
I have the following code here that won't run on ARC since it combines

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.