I'm afraid this question will be a bit vague but here goes...
We're noticing some very strange, occasional behaviour in our JEE7 web application. Sometimes a user's page will suddenly start displaying data from an entirely different user's session! So far I haven't been able to replicate this phenomenon nor find any indication of the problem in the logs, however it seems like one user's page starts displaying data that is stored in a #SessionScoped CDI bean that should belong to a different user's session.
Does this behaviour ring any bells for anyone? Any ideas about where to start looking, logging, or researching?
Our app is using Glassfish 4's SSO system. We're using JSF facelets, CDI backing beans, JPA entities. All reference implementations. All pretty close to latest versions.
We've also recently introduced a couple of simple SOAP based web services. Not closely linked to the areas we're having troubles with but maybe worth mentioning.
Any pointers or ideas greatly appreciated.
I'm afraid not to be able to yield an answer to your problem, but I am not allowed to comment on your question.
We are experiencing the exact behaviour you describe in our JEE7 web application on Glassfish 4 as well. In my SO post I am describing how we tracked down the problem and found a way to bypass it. Did you meanwhile find a trace or maybe even a solution on this matter?
Related
Another programmer told me about a problem, that one user sometimes sees the data of another logged-in user. Probably they are requesting the same context at the same time. I thought, that is impossible to happen? Since Garbage Collection, Container-managed Transactions and JSessionID
Without looking at the code, it is hard to guess. But maybe you have hint.
He is using this structure:
JavaEE 6 coded Web Application, using EJB and Web Container seperatly on a Glassfish v3
JSF + PrimeFaces Framework
Thanks in advance
The good news is that the EJB architecture is absolutely capable of isolating data, so this will be a bug in your code.
One thing to look for is the kind of beans you're using:
If you have stateful beans, the container will make sure each client gets the right instance.
If you use stateless beans, these are shared between clients. If you're storing any client-specific state in these, this could easily get shared across sessions.
If you use singletons, you need to make sure that no session-specific state is stored, and that any shared state uses appropriate locks.
It's also worth checking your application logic - if it appears data is being shared across sessions, is it possible it's just the wrong data?
Finally, the big thing you're going to need is appropriate debug logging. You'll need to get enough information about what's going on from the log to identify where the problem is going wrong. Unfortunately these kind of contention issues can be fiddly and hard to catch, especially with a debugger, but appropriate logging will make your life much better in any case.
Of course, this is all quite vague and generic, but without more detail on the system that's inevitable. I would suggest looking for state stored on stateless beans as a first step though!
Trying to get better performance out of my Xpages applications. Reading Mastering Xpages 2Ed, blogs, installed Xpages Toolbox.
One application in particular is very slow. The user sets some configuration documents that the program then loads into sessionScope variables. I use these heavily for setting up the navigation in the app.
Chapter 19 has many useful tips about performance and I am reviewing them. One guides you to rely too heavily on sessionScope variable, but use viewScope or managed beans.
Why are sessionScope variables a drag on performance and what could I use to increase performance?
Also, I am trying to use the Toolbox to profile my app and find out where the bottlenecks are, but I just don't quite get it. Should I use the CPU Profiler or the BackendP Profiler?
Any help would be greatly appreciated.
I don't believe there's any real "performance" difference in the scopes - meaning the speed of pulling the data from the scope.
I used to use sessionScope all the time but now try to avoid it for other reasons. sessionScope is great for a shopping cart for instance but very bad for "application state or page state". I used to use sessionScope for different stuff and then someone would open the same app in a second tab and that would cause problems.
I've not really used the profiler much - but it's HIGH on my list. Personally I'm much more interested in the backend profiler because that should really tell me what's going on with my code - which is probably the easiest to change.
Howard just did a great performance session at the MWLug conference. You might want to find those slides. (Sorry don't have that handy) but I suspect you can find them through his company site: tlcc.com. Also, a while back there was a webinar on performance that you might find interesting. https://www.youtube.com/watch?v=OXXi6cvBxGw
You have to be careful about using sessionScope beans - they will hang around until sessions time out. I have written a little article about this based on my experience. Have a look and see if it explains well enough why - and what the alternatives are (short session timeout and keepalive functionality).
HTH
/John
I am about developing a web application using jsf 2.0 and netbeans 7.1
so I want to authenticate users before they can access the application
My question know is how can I be sure of that user along his "session"?
I searched and found that I have to use session beans but I didn't get
the "remedy" of my problem
thanks for help
the answer really depends on your requirements. the simplest solution would be to use container managed authentication (via JAAS). all j2ee/servlet containers support this, but some implement it "their own way", so you have to check the docs. i know for tomcat and jboss, it's very simple to turn on and (assuming you configure your web.xml properly) just trust that if they are loading your pages, the session is authorized. you might want to bulk up the question with some of your requirements. that will really spur people to give you a much more concrete answer than i'm providing.
TIA
Having worked with 2 JSF component libraries, or frameworks if you wish, I can't help
but wonder if I'm missing a trick by not evaluating ADF Faces. The big stumbling block
for me is the way ADF is clearly deliberately tied in with jDeveloper studio. I work
with NetBeans on a glassfish a/s, and as open as I am to change, I want to maximise
my existing experience and leverage this stability.
My (tentative) rationale is that perhaps a company with the resources of Oracle could,
perhaps, come up with a better quality product than other alternatives and with superior
functionality, and this is what I wish to evaluate.
So I just wondered if anyone had any experience they could share with respect to working
with ADF Faces outside a jDeveloper environment. Presumably from a technical perspective
it's not much more than extracting the necessary jars from the distribution and taking
it from there. Equally important would be any licensing/legal considerations of course.
I've read that ADF has a business layer however I'd want to continue working with a Java
6 EE stack at this time.
What would be really cool would be to have a maven repository, although presumably the
reason that no such thing exists is to protect the jDeveloper business.
Has anyone got ADF working outside jDeveloper, got it working and can provide a small
amount of direction as to any major considerations.
If so, is it worth it? is ADF Faces a superior and more in depth product than can
otherwise be found (oh no, what have I said...)?
What are the licensing considerations? my present understanding is that fees would be
payable is you're not using weblogic. How about glassfish enterprise?
I have only recently found out, and was very surprised, to realise that ADF has the
third JSF core implementation, alongside Mojarrra and MyFaces. Is this just a case of
taking the RI and making a few necessary changes to support core ADF functionality or
more than that? I see from the JIRA that Ed Burns corresponds closely with the ADF
team, of course they now work for the same company. Clearly the RI has to mirror the
spec, and that takes time, so this in itself could be interesting.
Thanks.
dont know if this will help you , but it seems that you can now freely deploy adf on glassfish server
https://blogs.oracle.com/shay/entry/deploying_oracle_adf_applications_to
http://docs.oracle.com/cd/E35521_01/admin.111230/e16179/ap_glassfish.htm#BABIEADD
ADF is only officially certified to work with WebSphere 7.0.0.13 AS or ND(aside from weblogic of course). Although there are blogs and forum posts that indicate people were able to make it work with Tomcat(with much pain of course).
I know for a fact that there is an eclipse version/plugin/whatever that has ADF Faces features.
AFAIK, you only have to pay when you are using a container/AS that is not weblogic.
ADF Faces is great. It has all the components you would expect plus more. It also has a great Controller framework(see ADF Task Flows). For demos you can check out the Demo.
HI,
We are in the process of evaluating the different technologies to implement our application. Our application is like forums which will get the millions of users every day. For example, this stackoverflow.com handles such a heavy user base without any problem.
My question is whether JSF is suitable framework to develop such a application. We will be using components like RichFaces on top of JSF to design the front end. I have seen few comments about jsf that it is slow compare to other technologies.
I am anticipating your suggestions and ideas for my work. I am Java developer and would prefer to select any of the Java framework. Please advise me.
I would say JSF is indeed a very good choice. If you're building an application that serves "millions of users", then more often than not the back-end architecture is much more important than the frond-end web framework.
As a rule of thumb, only a small percentage of the time that processing a complete requests takes is spent in the web framework. The majority of time is always in the DB and in IO. Get that right and you're basically there.
The advantages of JSF are many. It's very easy to work with and it's very popular. This means there are many books, articles, blogs and fora out there to help you. Additionally, it's relatively easier to find extra employees who already know JSF than it is to find people having experience with one of the less used web frameworks.
The fact that JSF is so popular also means there are lots of component libraries and extensions available for it. This overall makes your life a lot easier. It's always faster to use some existing component than building it from scratch.
If you are looking for a website like SO, then I'd suggest GWT. It is easy to work with, faster (relative to jsf), good ajax support, embeddable and doesn't have a steep learning curve especially when you are coming from an action based framework like struts etc.
Checkout its demo show case and also the real world implementations here.
If you are building a forum-like application, why not use an existing solution such as the software on which stackoverflow.com is built-on?