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

  • SEARCH
  • Home
  • 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 6045147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:05:34+00:00 2026-05-23T07:05:34+00:00

I have a EAR package that contains a web module and EJB. The EJB

  • 0

I have a EAR package that contains a web module and EJB. The EJB is currently exposed its contains to local app client via Remote interface

@Stateless
public class CoreEJB implements CoreEJBRemote {

    @PersistenceContext(unitName = "CoreWeb-ejbPU")
    private EntityManager em;

    @Override
    public void packageProcess(String configFileName) throws Exception {
        //Process logics
    }

    @Override
    public <T> T create(T t) {
        em.persist(t);
        return t;
    }

    @Override
    public <T> T find(Class<T> type, Object id) {
        return em.find(type, id);
    }

    ...
}

The Remote interface is not in EAR, and look like this

@Remote
public interface CoreEJBRemote {

    public void packageProcess(java.lang.String configFileName) throws java.lang.Exception;

    public <T extends java.lang.Object> T create(T t);

    public <T extends java.lang.Object> T find(java.lang.Class<T> type, java.lang.Object id);

}

The Main of the app client is below

public class Main {
    @EJB
    private static CoreEJBRemote coreEJB;

    public static void main(String[] args) {
        coreEJB.packageProcess("path/to/a/file");
    }
}

Now i want to create an Local interface for the EJB so that in the Managed Bean of my web module, I can access the EJB via local invocation.

Do I just change CoreEJB from public class CoreEJB implements CoreEJBRemote to public class CoreEJB implements CoreEJBRemote, CoreEJBLocal and create @Local interface call CoreEJBLocal inside EJB package? Or will there be something extra? I want my Managed Bean code to be like this

@ManagedBean
@RequestScoped
public void testView{
    @EJB
    private CoreEJBLocal coreEJB;

    public void add(Something something){
        coreEJB.add(something); //Local invocation
    }
}
  • 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-05-23T07:05:34+00:00Added an answer on May 23, 2026 at 7:05 am

    Do I just change CoreEJB from public
    class CoreEJB implements CoreEJBRemote
    to public class CoreEJB implements
    CoreEJBRemote, CoreEJBLocal and create
    @Local interface call CoreEJBLocal
    inside EJB package?

    Yes, this should be sufficient. Did you try? Did it fail? Keep in mind that local interfaces are pass-by-reference and remote interfaces are pass-by-value. If callers (or the bean) mutate state on the return value (or arguments, respectively), then you’re going to get different behavior between the two. You must manage this careful in your API contract.

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

Sidebar

Related Questions

I am adding a WAR module [my-web-app] to an existing EAR application [my-ear-app] that
I have an ear app with two EJB and one WEB (war) projects all
I have a J2EE app deployed as an EAR file, which in turn contains
I have created an EAR with a web project, ejb3 project and the ejb
I have a new web app that is packaged as a WAR as part
I am trying to deploy an ear that contains an EJB jar. The jar
We have 2 web applications. And we are going to move them to EAR
I have a Java EE web application that does not make use of EJBs.
I have a EAR application with following structure: app.ear |-- app.war `-- META-INF `--
I have an ear which currently works fine when deployed in JBoss 4.2.3. I

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.