A session bean encapsulates business logic that can be invoked programmatically by a client over local, remote, or web service client views. More specifically, a stateless session bean does not maintain a conversational state with the client, so it is mostly used as a service(e.g. rest api, persistence-retrieval) and does specific job without the need of keeping a state.
Questions tagged [stateless-session-bean]
188 questions
89
votes
2 answers
When to use Stateful session bean over Stateless session bean?
A stateful session bean is defined as follows:
Stateful Session Beans The state of an object consists of the values
of its instance variables. In a stateful session bean, the instance
variables represent the state of a unique client-bean…

sheidaei
- 9,842
- 20
- 63
- 86
28
votes
5 answers
Why pool Stateless session beans?
Stateless beans in Java do not keep their state between two calls from the client. So in a nutshell we might consider them as objects with business methods. Each method takes parameters and return results. When the method is invoked some local…

Andrei Андрей Листочкин
- 8,442
- 6
- 43
- 53
19
votes
1 answer
Is it possible to @Inject a @RequestScoped bean into a @Stateless EJB?
Is it possible to inject a request-scoped CDI bean into a Stateless session bean?
I had asked a related question and thought the specific CDI @RequestScoped into @Stateless question merited its own post.
Passing state between EJB methods /…

wrschneider
- 17,913
- 16
- 96
- 176
15
votes
9 answers
Stateless session bean with instance variables
I have a stateless session bean that contains one public method, several private methods, and some instance level variables. Below is a pseudo code example.
private int instanceLevelVar
public void methodA(int x) {
this.instanceLevelVar = x;
…

Preston
- 3,273
- 4
- 26
- 35
13
votes
2 answers
ContextNotActiveException while calling @Asynchronous method of @Stateless bean
I am injecting a @Stateless bean in a Asynchronous Servlet and calling @Asynchronous method from the Serrvlet. In the server logs of the jboss i am not able to see any of the Exception but whhile starting the Java Mission Control ,Flight Recorder i…

Charles Stevens
- 1,568
- 15
- 30
8
votes
3 answers
Java EE 6: How to call Stateful Session Bean from Stateless Session Bean?
I have a Stateful Session Bean (SFSB) which acts as authentication module. In the SFSB I store the current user that is logged in. Moreover I have some facades (which are Stateless Session Beans (SLSB)) that handles the JPA/SQL stuff for my…

salocinx
- 3,715
- 8
- 61
- 110
7
votes
6 answers
Why Stateless session beans?
I was reading about stateless session bean and couldn't understand it's use.
Excerpt from sun tutorial below
"..Because stateless session beans can support multiple clients, they can offer better scalability for applications that require large…

Surez
- 854
- 1
- 8
- 10
7
votes
1 answer
NameNotFoundException when calling a EJB in Weblogic 10.3
I have a EJB defined as this:
package com.foo;
@Stateless (mappedName="HelloWorld")
public class HelloWorldBean implements HelloWorld, HelloWorldLocal
....
When it's deployed to Weblogic (WL), it gets the name myBean. I'm not sure if this is…

Sajee
- 4,317
- 14
- 46
- 54
7
votes
2 answers
What is the point of having global variable in a Stateless Session Bean?
We know Stateless Session Beans do not hold state by any means. Then what is the point of having a global variable in a Stateless Session Bean? Why it is not blocked in the specification (to avoid unnecessary confusion)?
If there are any practical…

siva636
- 16,109
- 23
- 97
- 135
7
votes
2 answers
WELD-001408 Unsatisfied dependencies when injecting EntityManager
I have @Stateless bean which implements two interfaces (remote and local). I have also added @LocalBean anotation for accessing bean with a no-interface view.
@Stateless
@LocalBean
public class WeatherDataBean implements WeatherDataBeanRemote,…

Jernej Jerin
- 3,179
- 9
- 37
- 53
6
votes
2 answers
Can remote stateless session bean references be cached in EJB3?
I am calling a remote stateless session bean from a J2SE application and would like to cache the reference to the session bean in order to reduce the cost of the lookup. Is this ok?
In EJB2 the ServiceLocator pattern was commonly used to cache…

Ken Liu
- 22,503
- 19
- 75
- 98
6
votes
2 answers
EJB3 Business Logic Patterns & Practices
I'm in the process of developing a multi-tiered financial processing application in Java using EJB3 (Hibernate + Glassfish for the app and web services layer, Lift on Glassfish for the web UI) and I'm struggling with the question of where to put my…

Kris Nuttycombe
- 4,560
- 1
- 26
- 29
5
votes
2 answers
Associate async task's completion/progress monitor with session
I want to be able to perform an asynchronous task in java and be able to keep a completion (and if possible progress) monitor associated to the user's session. Is this possible, and if yes what is the way to do it?
Currently the task is implemented…

Marinos An
- 9,481
- 6
- 63
- 96
5
votes
1 answer
J2EE Application/Bean configuration Best Practices?
What is the best way to manage property sets to apply to EJB, and easily be able to vary them between machines/environments (e.g. DEV, TEST, PROD)? For example, is there a way to configure your EJB properties on the App Server (which guarantees you…

Sam Goldberg
- 6,711
- 8
- 52
- 85
4
votes
1 answer
@singleton behaving like @stateless bean
i am working on an application(enterprize application in java) in which i need is single instance to be shared by multiple thread concurrently for which i have used @singleton . when each user login a value is set in telecallers List by invoking…

user3603817
- 41
- 1