jsf application not supporting data entry from multiple log ins - jsf

This is a very simple question for which i present my apologies but i need expert guidance on it since my knowledge is way too primitive that i don't know what to search on google to solve my problem.
I have developed a simple data entry application in jsf which gives users a form to enter data then generated one pdf report on the basis of data. The application works fine but when more then one user simultaneously tries to enter data, users can't do that, only one user at a time can enter data.
Please give me some idea what should I should study and on what subject I need to do the research.
Thanks in advance.

That can only mean that you're holding some request/session scoped information in static variables or in application scoped variables which would then be shared among all users in the entire application. Apparently you've either awarely or unawarely programmed some static/application wide lock which prevents other users from using the same application.
It's not possible to give a targeted answer as to how to fix this problem as you didn't show any code, but you should start looking at static variables and application scoped variables and investigate if they aren't incorrectly holding request/session scoped data. If they do, then you should make them non-static and/or request/session scoped instead.

Related

Google Assistant - Dynamic entities

We've recently had to pause our in-depth development with Alexa Skills,due to their Dynamic entities not being completey ready for the use case it was intended for (had confirmation direct from an AWS architect).
Documentation of same:
https://developer.amazon.com/docs/custom-skills/use-dynamic-entities-for-customized-interactions.html
https://developer.amazon.com/blogs/alexa/post/db4c0ed5-5a05-4037-a3a7-3fe5c29dcb65/use-dynamic-entities-to-create-personalized-voice-experiences
Regardless, we've since been making a POC for Google Assistant, as have heard of their equivalent (Dialogflow dynamic enity).
The problem we having is that this too doesn't seem to be loading data dynamically.
Our expected result is to; load data (dynamically), into a new slot that would be used during the action.
i.e. load a list of specific names at runtime, that can then be used for lookup while using the app.
Creating a new static lookup slot (within the console) with ±5 set names (unique and not common) work fine and everytime, however, as soon as you load those names dynamically, they are not recognized when spoken.
We've seen similar issues that all seem to be resolved, using POST calls to DialogFlow, however, we are unable to replicate this in a runtime environment.
Dialogflow dynamic enity issue
Has anyone had similar issues with this and managed to get it working as expected?
If so, would you mind please sharing some additional documentation that could help with an example of same? I suspect we are really close but are missing something simple.
PS - I have not pasted example code here deliberately, as I am after documentation and examples of same, I'd rather not confuse the topic - unless required.
Dialogflow refers to these as session entities, since they are Entity Types that contain values that you set during a session, and that only maintain those values for that user during that session.
You can access them using a REST endpoint for the session entity types, or use one of the client libraries that can provide access.
However...
While this has worked fine in the past there seem to be some problems currently with Session Entities. (That SO question does provide some code and examples, so you may want to take a look at it anyway in case it does work for you.) This is opened as a bug in their issue tracker, but there has been no public acknowledgement from Google about it.

Script for Online Tasks

I was wondering if there is a way to write a script that could perform online tasks . There are actions a user does that is so repetitive/planed, that make me wonder if there is a way i could write a script that could do that for me. What i mean is, for example, a script that could go online, lets say facebook, write/read a post. It seems such a straight forward action that it has to be possible to be done by a scrip.
The thing is I have no idea how to do, my question here is some guidance, if possible, all i need to know is a good language for this and a good aproach. I can't seem to find anything for this, probably not searching the right terms.
Thanks for your time. :)
If you're looking to mock user behavior in the browser (such as filling out a form), you could use Python, a web driver, and the module Selenium.
Selenium will open the web driver, then allow you to mock user actions, such as selecting a text box, typing data, and then clicking submit. This allows you automate actions such as a search on a website, verifying a website works the way you expect it to when a user takes certain actions, and filling out input elements on a page and submitting a form.
You need to understand concepts like javascript, ajax, servlets plus advance level concepts like in advance java as these all are event associated for bringing dynamisation to your web page and other than this session level concepts to deal if session is active or expired this all adds to automating based on session attribute.
Finally, at database level you can use triggers to event fire changes when needed.

JavaEE 6 retrieving another user's data

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!

Appropriate use of .recycle in xpage app

I have seen several references to using .recycle to ensure you do not have memory issues with an xPage, however I am not sure how and where it should be used. I have checked the mastering xpages book, and have not found any specific reference to it. I suspect that this may be more obvious to those from a java background.
Should it be used when someone logs into the application, navigates between xpages? And what is this implication of use? Will it clear current sessions, or the sessionScope variables stored by a user? Is it user specific?
A
The recycling is only required for domino java objects and is not a XPage-specific issue.
You should recycle every domino object as soon you are not need it further, that's the golden rule.
Domino Objects are f.e. NotesSession, NotesDatabase, etc. They are accessed internally as C-Objects, and that is why it is important to "destroy" them manually. If you are accessing types of these objects in your code directly, you have to recycle them by yourself. XPages-specific objects like scoped variables are plain Java code and will be killed correctly by the Garbage collector.
For more details please have a look at this technote: Why it is important to use the Recycle() method on every Java object

Update of xPages application removes sessions variables on Domino server ... what to do with this?

During the rather larges xPages application development a realized the fact that Domino deletes alls sessionScope, viewScope, applicationScope variables in application after any change in application design(that causes some internal application reload on server). I understand this for development process, but its realy unacceptable in production because it makes inconsistences for connected users. Even simple typo correction in code or on xpage(on any xpage, not the one the user is working on) and applying changes to production application causes this deletes. Is there a way how to overcome this behaviour? (I know I can update application outside of business hours or something but its problem for new application when you need to deliver changes quickly e.g. typo fixes ...)
This has to be done because any changes in your application could cause the scoped variables ( and its contents) to invalidate. Updating an application ( any not only xpage apps ) should be done in a specified trimeframe at which there are none / limited amount of users.
This answer to a previous question might provide an option for you. In the context of the original question, the suggestion for defining listeners was just to provide an opportunity to do some cleanup prior to the scopes being destroyed. These types of listeners, however, could also be used to save and restore the state of these scopes. I'd urge caution for the reasons JJTB mentions, but certainly in situations where you're making completely unrelated changes (e.g. structural, not logical), this would give you a way to prevent users from being impacted by frequent scope clearing.
jjtbsomhorst explained the reason. I want to add: don't rely on scoped variables and use beans. Beans contain "formula for cooking a fresh one" what is much safer for application. Any scoped variable computed on specific event (on load typically) will be lost forever, if you make update to application as mentioned in your question. But if you used bean - its values will be recreated whenever needed again.

Resources