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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:30:43+00:00 2026-05-29T22:30:43+00:00

Here is a very strange behavior using EJB beans: @Local public interface Provider {

  • 0

Here is a very strange behavior using EJB beans:

@Local
public interface Provider {
    void test();
}

@Local
public interface ExtProvider extends Provider {
   void test2();
}

public abstract class AbstractProvider implements Provider {
   @Override 
   void test(){ System.out.println("Hello strange " + getTech()); }
   protected abstract String getTech();          
}

public abstract class ExtAbstractProvider extends AbstractProvider implements ExtProvider {
   @Override
   void test2() { System.out.println("Hello from " + getName());}
   @Override
   String getTech() { return "extended EJB";}
   protected abstract String getName();
}
@Stateless
public class ProviderBean extends AbstractProvider {
   @Override
   protected String getTech() { return "EJB";}
}

@Stateless
public class ExtProviderBean extends ExtAbstractProvider {
  @Override
  protected String getName() { return "ext provider";}
}

According to the above code, if I write:

@EJB Provider provider; // should inject an instance of ProviderBean
@EJB ExtProvider extProvider; // should inject an instance of ExtProviderBean

but no one of the two works!!! Someone would say that in this example the EJB doesn’t know which instance to create each time since there are two instances that implements Provider. And the strange is: it works only if we declare the two beans as:

public class ExtProviderBean extends ExtAbstractProvider implements ExtProvider
public class ProviderBean extends AbstractProvider implements Provider

In this case the code works. The problem is that we have to explicitly define that an implementation bean implements the interface even it is implicitly defined from the abstract implementation. Am I missing something or this is a limitation?

  • 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-29T22:30:43+00:00Added an answer on May 29, 2026 at 10:30 pm

    I just read through this SO question and I think the provided answer also applies to your case.

    I am just citing a part of the answer and thereby the EE spec:

    @Stateless
    public class A implements Foo { ... }
    
    @Stateless
    public class B extends A implements Bar { ... }
    

    Assuming Foo and Bar are local business interfaces and there is no
    associated deployment descriptor, session bean A exposes local
    business interface Foo and session bean B exposes local business
    interface Bar, but not Foo.
    Session bean B would need to explicitly
    include Foo in its set of exposed views for that interface to apply.

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

Sidebar

Related Questions

I have a very strange behavior with Request.Form . Here are two IIS 7
Very strange situation here: I'm using L2S to populate a DataGridView. Code follows: private
I am having some very strange ListView behavior when using a StateListDrawable as the
I have a very strange behavior in going on KnockoutJS 1.2.1 (Can't switch to
So here's a very strange thing I've seen FCKEditor do: If there's a large
I have faced a very strange situation here. I am accessing database (MDB) through
I have a very strange situation happening and I'm hoping someone here knows why.
A very strange behavior is occuring on the website I'm working on in a
Very strange thing happening here in IE7, IE8: index.php versus index-2.php As you can
I have a very very strange problem here. I have a desktop application written

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.