Questions tagged [stateful-session-bean]

A stateful session bean is an enterprise bean (EJB component) that acts as a server-side extension of the client that uses it. The stateful session bean is created by a client and will work for only that client until the client connection is dropped or the bean is explicitly removed.

A stateful session bean is an enterprise bean (EJB component) that acts as a server-side extension of the client that uses it. The stateful session bean is created by a client and will work for only that client until the client connection is dropped or the bean is explicitly removed.

119 questions
1
vote
3 answers

Stateful Session Bean - Stateloss Issue

I have a servlet code which invokes a stateful session bean code and increment an int value of it. But, when I am invoking the servlet and it's corresponding bean for the next time , the bean losses it's state and again starts from begining of…
alessandro
  • 1,681
  • 10
  • 33
  • 54
1
vote
1 answer

Issue with EJB - Stateful Session Bean and Servlet

I have a servlet code which calls a ejb stateful session bean code as follows, public class UsesBeansSF extends HttpServlet { protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException,…
alessandro
  • 1,681
  • 10
  • 33
  • 54
1
vote
1 answer

EJB - Serialization error while doing a JNDI lookup for a Stateful Session Bean

In my EJB project I have this Session Bean (Stateful): @Stateful public class StatefulShopCart implements StatefulShopCartLocal, Serializable { private static final long serialVersionUID = 1L; private transient HashMap
Emanuel
  • 6,622
  • 20
  • 58
  • 78
1
vote
1 answer

Getting javax.servlet.ServletException: javax.naming.NamingException: Lookup failed for 'java:global/ShoppingCart-1.0-SNAPSHOT/ShoppingCartRemote'

I am new to JAVA EE. I am trying to implement stateful session Bean via IntelliJ IDEA and glassfish server 4.0 while running the code getting below exception. Attaching the code and glassfish configuration as well. Error is coming as the lookup has…
1
vote
1 answer

Why is the container sharing my EJB stateful session bean across various sessions?

I have this simple Stateful session bean (a single op stack calculator): package beans; import java.util.EmptyStackException; import java.util.Stack; import javax.ejb.LocalBean; import javax.ejb.Stateful; @Stateful @LocalBean public class…
1
vote
1 answer

Class cast exception on stateful ejb

For some strange reason I am getting the following exception. 2011-02-08 09:53:30,667 ERROR [STDERR] (QuartzScheduler_Worker-9) java.lang.ClassCastException: org.javassist.tmp.java.lang.Object_$$_javassist_seam_7 cannot be cast to…
Shervin Asgari
  • 23,901
  • 30
  • 103
  • 143
1
vote
2 answers

EJB stateful vs stateless session beans when using a DB

I am a little confused as to the usage of stateful session beans (SFSB) versus stateless session beans (SLSB). I understand that SFSB's maintain state with a client. This helped: When to use Stateful session bean over Stateless session bean? The…
ovg
  • 1,486
  • 1
  • 18
  • 30
1
vote
1 answer

@PostConstruct called on Stateful EJB invocation but not Stateless Why?

This question is an offshoot of another that I posted a couple of weeks ago: log4j2 logging of code in EJB jar on JBoss EAP 7. In that post I posed a problem and eventually a solution for logging initialization on EJBs deployed as EJB jars (not…
1
vote
1 answer

Are stateful beans managed by container or the application in EJB?

Here is a paragraph from an oracle blog that I read recently. This behavior is very different from that of Stateful session beans. A Stateful session bean instance needs to be explicitly removed by the client with the invocation of a method…
brain storm
  • 30,124
  • 69
  • 225
  • 393
1
vote
0 answers

Stateful Session Bean not passivated after Cache Idle Timeout(cache-idle-timeout-in-seconds) elapsed

I am trying to understand Stateful Session bean life cycle.I am particularly interested when activation and passivation life cycle callback invoked.I created a demo to understand this scenario. Here is My code : My Remote interface is : package…
1
vote
1 answer

Stateful session beans unexpected behaviour when packaged in a war and packaged in an ear->jar

I am new to ejbs. I wrote a stateful session bean scoped @SessionScoped. Then I injected the ejb into my servlet. @Local @SessionScoped @Statueful public class CartServiceImpl implements CartService { private int i = 0; public int getI()…
Krishna Chaitanya
  • 2,533
  • 4
  • 40
  • 74
1
vote
1 answer

Why use a ShoppingCart as a Stateful Sesson Bean?

One typical example of using a Stateful Session Bean is through a ShoppingCart example. We create a bean instance of the ShoppingCart class, then store this instance within a HttpSession. However, the same can be achieved easily with the…
echipbk
  • 21
  • 2
1
vote
1 answer

Stateful session bean forgets values

With Java EE I need to use a stateful session Bean. @Stateful @TransactionManagement(TransactionManagementType.BEAN) public class FacadeExercice extends AbstractFacade implements IFacadeExercice { @PersistenceContext(unitName…
Dazul
  • 157
  • 9
1
vote
1 answer

Parallel requests referring to the same stateful session bean

I assume that an EJB container can process multiple interactions with the same client parallel. What does this mean for requests which use the same stateful session bean and influence their state? (this is more a theoretical question) Do multiple…
tsh
  • 303
  • 1
  • 3
  • 12
1
vote
4 answers

How GlassFish maps client requests to sessions

With EJB (3.x) you have a choice of Session Beans: @Stateful and @Stateless. If I understand the basics behind these two options: @Stateful - Each user/client gets their own and is thus typically not pooled; maintains state across multiple…
IAmYourFaja
  • 55,468
  • 181
  • 466
  • 756