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 4346410
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T12:10:10+00:00 2026-05-21T12:10:10+00:00

We currently have a project that consists of multiple applications as well as a

  • 0

We currently have a project that consists of multiple applications as well as a base library.
Both, the applications as well as the base library contain stateless EJBs and each application might introduce an EJB that inherits from a base library EJBand thus implements the same interface.

A short example:

In the base library we have:

@Stateless
@Local( IUserService.class ) 
public UserServiceBean implements IUserService {
  public void login(String user, String password) {...}
}

In the application we need to override login(...) and thus we have:

@Stateless
@Local( { ISpecificUserService.class, IUserService.class } ) 
public SpecificUserServiceBean extends UserServiceBean implements ISpecificUserService {
  public void login(String user, String password) { ... } //override
}

If I now have another EJB in the application that needs to have a reference to SpecificUserServiceBean I’d do @EJB ISpecificUserService userService;.

However, if there is an EJB in the base library, it would contain @EJB IUserService userService; and here’s the problem:

We need to get the specific service in the application be injected in the base library EJB. However, there are two EJBs registered for the same local interface, which means that the container might return the base EJB or the specific EJB.

You could say “Don’t add the base library jar as a module in application.xml” but that’s not possible right now, since it contains other EJBs that need to be deployed. We could move the EJBs to be overridden to a different jar but since almost every EJB might be overridden, depending on the application, we’d end up with a jar per EJB.

Thus, I’d like to exclude or remove the base EJB from the dependency injection container if there exists a specific override. Since I know that at deploy time, I could also use a configuration file to tell the container not to load a specific EJB class.

I might add a service that modifies the container afterwards but that would be my last resort.

Do you have any ideas on what we could do?

Thanks in advance.

Btw, we’re working on JBoss 4.2.3 with EJB 3.0.

  • 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-21T12:10:10+00:00Added an answer on May 21, 2026 at 12:10 pm

    The problem is that you’re wiring your app partially in the base lib which is bad since you can’t override this wiring.

    So the solution is to remove @Stateless @Local( IUserService.class ) from UserServiceBean in your base lib; the base lib just provides default implementations for the beans but it must not wire them.

    In your apps, you need this code:

    @Stateless
    @Local( IUserService.class ) 
    public AppUserServiceBean extends UserServiceBean {}
    

    to create the wiring. Move all those beans into a special package which you can copy into each app so you get the default wiring for everything.

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

Sidebar

Related Questions

I currently have one project that currently contains multiple packages. These packages make up
I currently have an ASP.NET MVC 3 project, plus a class library project, that
We currently have a big project that consists of the following layers: MS SQL
Currently I have a simple maven project that is building a jar file and
I have a project that needs to be done using ASP.NET. Currently, I'm using
On the project that I'm currently working I have a requirement to run a
Hello Ruby/Rails/Merb developers! Im currently working on a web project that will have a
I am currently working on a project where I have code that looks like
I am currently working on a project that consists of an ASP.NET MVC 2.0
I currently work into a big project that consists of lots of classes. Can

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.