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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:16:16+00:00 2026-06-11T07:16:16+00:00

I have a testcase which makes use of OpenEjb ‘s @LocalClient annotation (embedded container)

  • 0

I have a testcase which makes use of OpenEjb‘s @LocalClient annotation (embedded container) and injects EJBs using the @EJB annotation:

@LocalClient
public class MyTestCase {

    @EJB
    private BoxDao boxDao;
    
    ...   
    
}

BoxDao is a remote EJB interface. Now, for testing, I need to access some internal state of BoxDao’s implementation BoxDaoBean, which is a stateful session bean. I created a protected method in BoxDaoBean, which exposes the needed internal state, but I found not yet a way to access it in my test case, since the injected BoxDao is a remote interface proxy (an cannot be cast to BoxDaoBean).

Is there a way to access the stateful session bean behind the remote interface BoxDao in the test case? Would not matter if solution is OpenEjb specific.

Update: We can’t use EJB 3.1 specific solutions unfortunately, as we have several EJB 3.0 projects running. Using Proxy.getInvocationHandler(boxDao), I can get access to the OpenEjb container, via StatefulEjbObjectHandler. Is it possible to access the stateful bean this way?

  • 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-11T07:16:18+00:00Added an answer on June 11, 2026 at 7:16 am

    You could try having BoxDaoBean also expose an @LocalBean interface. A single EJB can expose a near unlimited number of views from @WebService, @Local, @Remote, JAX-RS and more.

    Just update your bean like so:

    @Stateful
    @LocalBean
    public class BoxDaoBean implements BoxDao {
       //...
    }
    

    Then add another field to your test:

    @LocalClient
    public class MyTestCase {
    
        @EJB
        private BoxDao boxDao;
    
        @EJB
        private BoxDaoBean boxDaoBean;
    
        ...   
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program which produces a fatal error with a testcase, and I
I have an IHttpHandler which I believe can benefit from re-use, because it is
I have a number of test suites that make use of the Test::Unit::TestCase package
I have my existing framework built up using Jfunc which provides a facility to
I am creating a traceability matrix for PRD. I have test case _id which
I have a collection testcase like this, Test Builds have many Test Case Logs
I have 2 files: xxxxxTest.java [ refer this ] public class xxxxxTest extends TestCase
I have created mock: GuiExHandler mockGuiEx = EasyMock.createMock(MockedClass.class); And Im getting following exception: Testcase:
I have the following code require 'test_helper' class ApplicationControllerTest < ActionController::TestCase test should display
I have a testdata like this: DROP TABLE SELECT_PASS; CREATE TABLE SELECT_PASS(ID INT(20),TESTCASE VARCHAR(20),RESULT

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.