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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:21:42+00:00 2026-06-13T21:21:42+00:00

First off, here is my setup: App server: jBoss 4.2.3GA Frameworks used: Struts 2,

  • 0

First off, here is my setup:

  • App server: jBoss 4.2.3GA
  • Frameworks used: Struts 2, EJB3
  • DBMS: PostgreSQL 9.0.3

By default, I always set my beans to @Local for security purpose. I don’t want to open doors to other application within the same container when there is no need for it.

Now, I am focusing on driving my development with tests (test driven development). So, I created a separate project (a kind of test project) for my tests in order to avoid coding my tests and installing tests instruments (EasyMock, jUnit, StrutsTest, etc.) in the same project as the application.

So… that means I set my beans to @Remote to be able to access them from my jUnit test classes.

My question is: Is there any way to switch from @Local to @Remote using a sort of conditional compiling/building? Having to set my beans back to Local everytime is quite cumbersome and boring. Every developer knows that refactoring brings problems so I am trying to find a proper way to manage my bean’s visibility. Another idea would be from a property or XML file so I would only need to turn one thing on or off depending on my needs.

For every bean to test, I need to:
– Set the interface to @Remote
– Add the implements item for the remote interface in the session bean

Any idea?

Thank you very much

Charles

  • 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-13T21:21:43+00:00Added an answer on June 13, 2026 at 9:21 pm

    If I understand well, you connect from your unit tests to the application server to access remote EJBs, right?

    I haven’t been working with EJB since a few years, but there are two ways to unit tests EJBs without remote communication:

    1. Use an embedded container, see Embedding EJB 3.1 Container Into Your Unit Tests
    2. You use your EJB as plain java classes and mock the dependencies yourself, see Unit Testing for Java EE. You can configure mocks to return specific value for specific events.

    Hope it helps.

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

Sidebar

Related Questions

First off, here's my current setup: Django : version 1.3 MySQL : version 4.0.18
First off here is the code! <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>
So, first off here's my code to open the dotx and create a new
first off I'm a noob to PHP but here is my problem. I am
First off, here is the situation. I'm using a guild hosting site that allows
First Question in here :) (AS3) First off, how do I access a variable
First off, I'm using XCode 4.0.2. Okay, here is my issue. I can build
First off, yes, I know that the VS Setup Projects are evil. It's what
First off here is some information, I am using Netbeans 7.0 with the project's
First off, I'm coming (back) to Java from C#, so apologies if my terminology

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.