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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:03:55+00:00 2026-06-10T12:03:55+00:00

I have a stateful session bean with the following annotations: @Stateful @Name(fooBar) public class

  • 0

I have a stateful session bean with the following annotations:

@Stateful
@Name("fooBar")
public class FooBarAction implements FooBar {

I noticed there are 2 ways to get my FooBar instance:

Seam lookup:

Component.getInstance(FooBarAction.class);

JNDI lookup:

(new InitialContext()).lookup("MYAPP/FooBarAction/local");

When I use the JNDI lookup, each time I execute the lookup, I notice a new instance of FooBar is created. The default constructor gets called, and setter methods are used to bring back the state (attributes) of my SFSB.

When I use the Seam lookup, no default constructor is called and no setter methods are called. I just have the instance. The same instance as the previous lookup.

So what’s the difference? And what is the best way to use?

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

    From the doc: This method returns a singleton for the specified component, so calling it twice in a row with the same component name will return the same instance of the component.

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

Sidebar

Related Questions

I have a servlet code which invokes a stateful session bean code and increment
We have a stateful session bean which is working perfectly. The stateful session bean
I have a Stateful Session Bean (SFSB) which acts as authentication module. In the
I have gone through various books on stateful and stateless session bean and how
I have a servlet code which calls a ejb stateful session bean code as
Seam advises using an Extended persistent context in a Stateful Session Bean, in order
Scenario: I have some @Statefull bean for user session (not an HTTP session, it
I have a model that is stateful. In each state there are a selection
Is it possible to access a stateful session bean inside a stateless bean? My
What would a stateless session bean provide over just a regular class that has

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.