I've a list of users used, with a managed bean noted with @ApplicationScoped; The problème is when i check my list i've founded something weird. there is a difference between when i access with the both adresses :: localhost:8080/myAPP and 127.0.0.1:8080/myAPP
Asked
Active
Viewed 260 times
0
-
From which package are you importing the annotation? – unwichtich Mar 16 '14 at 16:04
-
From `import javax.faces.bean.ApplicationScoped;` And i don't went to use a singleton EJB – bilelovitch Mar 17 '14 at 11:30
1 Answers
0
The problem is caused by importing from the wrong package. If you try a refresh on either localhost:8080/myAPP
or 127.0.0.1:8080/myAPP
you should see that the bean instance changes everytime, even on the same hostname.
You have to import javax.enterprise.context.ApplicationScoped
to make it work.
See also:

Community
- 1
- 1

unwichtich
- 13,712
- 4
- 53
- 66
-
the matter is : i dont want to change it every time, but to be the **same** for each refresh on the both instance. – bilelovitch Mar 18 '14 at 09:39
-
I have a managed bean noted with @ApplicationScoped, i want to solve this problem (see the pictures attached); NOW : _https://www.dropbox.com/s/qj9kr7a6u7xpnxa/now.png_ The GOAL : _https://www.dropbox.com/s/fz6ry5jchbq9tu7/goal.png_ – bilelovitch Mar 18 '14 at 16:55
-
-
Yes, i have try it; With your solution, the data (of each page) are refreshed when i load the page on each instance. – bilelovitch Mar 19 '14 at 15:22
-
-
This should be the case....did you remove the old import when you added the new one? – unwichtich Mar 23 '14 at 21:16
-
Absolutely. The question is should me use the both together: `import javax.annotation.ManagedBean; import javax.enterprise.context.SessionScoped;` – bilelovitch Mar 26 '14 at 07:06
-
None of them, you only need `javax.enterprise.context.ApplicationScoped`. – unwichtich Mar 26 '14 at 08:38