2013年9月25日星期三
Female programmers sad ah : the same server , deploying two web project session is lost, anxious ! ! !
server ip is : 192.168.0.1
a project : http://192.168.0.1:9080/a
b Project : http://192.168.0.1:9081/b
now b nested in a medium
If the remote server to access http://192.168.0.1:9080/a no problem,
But if my own local access http://192.168.0.1:9080/a have a problem , session lost.
but the two systems are deployed to different machines , also visited their local normal
middleware websphere trouble you
------ Solution ----------------------- ---------------------
you because I think it should be the same ip address, but different WebSphere servers. This resulted in the Cookie JSESSION conflict
You should modify the WebSphere console , locate the two server session settings , in the Cookie name to distinguish the two names on the line ( for example, JSESSIONID modify JSESSION_A, JSESSIONID_B)
------ solution --------------------------------------------
solutions :
1. way to write client-side Cookie
When the user login victory Currently, the site domain name, user name, password , token, session valid time -out cookie approach local customers really a cookie is written to the outside , if the user from one to another Web doing things beyond Taiwan doing things after midnight, our program automatically detects the customer really a cookie to the message , stop the judgment , and then provide the corresponding service of course, if the cookie out of date, or effective , natural does not allow users to continue to serve it. Of course, the drawbacks of this approach is not self-evident , and for example, the client disables cookie or captured by hackers do ?
2. doing things the way data synchronization between the Session
assume that the Web service of device A is doing things all user login , then when the user research landing look , session data is written to A in doing things , then I will be able to write scripts or protection process to automatically synchronize the session data to other Web doing things , then when the user jumps to serve other 's midnight, then the session data is divided , natural can indirectly serve without stopping once again landed. Defects can be slow, does not fluctuate , if it is one-way sync , then landing serve renders title , then the other device can not serve serve , of course, can also be thinking about the subject of two-way synchronization .
3. applications the way the NFS share Session Data
really the plan and at the Mysql plan similar, but storage is not the opposite. There generally is a public service of devices for NFS (Network File Server) do share doing things , doing things all the Web log data is written to the session time-division serve on this , then all session data are kept in it NFS serve on this , regardless of the user to visit that Web doing things too , must come to doing things for this session data , then you can complete the data sharing session . Defects is to rely on too strong , if the NFS doing things down the enemy, then his task can not , of course , be able to think about doing things multiple NFS synchronous manner .
4. Application Sharing Session Mysql database the way data
this way and NFS manner similar to that also uses a shared Mysql doing things doing things to do , put all the session data storage to serve on Mysql , Web doing things have come all this serve to capture what Mysql Session data . Defects also rely on too strong , Mysql not affect the task of all Web doing things , of course , be able to think too much Mysql database to share session, using synchronous Mysql data.
5. use of hardware equipment
this be compared to a naive treatment plan , using the BIG-IP load similar equipment to accomplish the sharing of resources , it can be another volatile and fair sharing of the Session . Portal currently much more this way . Defects is very clear , that is to free up the hardware purchase capital equipment must demand , but the use of professional or large , this is a reasonable and comparable worth .
Reference:
http://blog.sina.com.cn/s/blog_4f9fc6e10100r2aj.html
------ Solution ------------------- -------------------------
Http tracking tool you use , such as Charles and the like to see, is not there a conflict of class Cookie
------ Solution ---------------------------------------- ----
Cookie example, two servers were JSESSIONID_A, JSESSIONID_B
A visit after application then you should increase the value of JSESSIONID_A = ... , after the application should also visit B has two values
This time you should still visit A bar with two values ? JSESSIONID_A value does not change , right ? Are you in the application of the JSP A print session.getId () to see whether JSESSIONID_A match ( not identical , cookie there will be things like prefixes and suffixes ) , look twice visited session.getId are the same.
If it is impossible to lose the same session information
------ Solution ---------------------------- ----------------
session refers to a user , session is stored on the server side !
session and the user is associated , may I ask how to share it ?
------ Solution ---------------------------------------- ----
that is your cluster server setup problem !
For example, in A, the user login information , then, they jump in B , and B and wood has caused a session log so it does not exist !
------ For reference only -------------------------------------- -
I would not
------ For reference only ------------------------------ ---------
SESSION how does one lose fat ?
So, a loom to visit two projects , even if deployed on different servers , is not losing it ?
------ For reference only -------------------------------------- -
projects can also be nested deployment ? . . Good magic ~
------ For reference only ----------------------------------- ----
top female programmer, seeking contacts .
In addition, the description of the problem it is very unclear .
------ For reference only -------------------------------------- -
is under multiple applications in websphere shared session if the issue ..
------ For reference only ------------------ ---------------------
If two projects deployed on different machines , which is a different IP, it will not be such a problem ..
------ For reference only -------- -------------------------------
session will not be lost , b nested in a , you actually visit which items are present on the session ? session is associated with a user ! Two projects is best not to appear the same session name !
------ For reference only -------------------------------------- -
now b nested in a medium mean ?
------ For reference only ---------------------------------- -----
That next session in websphere not share ..
------ For reference only ----------------------- ----------------
items from a log , jump to b project, to achieve b Item fake login , and then return to a project . Similar to the single sign-on .
------ For reference only -------------------------------- -------
as 7L said, when developing SESSION object with the same name ,
led SESSION behind the front cover ,
However Logically this is not lost, but was covered up by now
------ For reference only ----------------- ----------------------
top female female
------ For reference only ---------- -----------------------------
should be a, b of the session mixed
- ---- For reference only ---------------------------------------
< br /> and b is a like and nested in the ah ? learned
------ For reference only --------------------- ------------------
If you are a, b of the session mixed , and that the landlord would not be such a problem , and now she wanted to mix , but not mixed . .
she wants to achieve single sign-on effect, with opensso server
------ For reference only ---------------------- -----------------
the problem lie ? To find out what 's stored in a Session :
Reference : http://topic.csdn.net/u/20070827/17/9c351ac2-359f-4448-8649-b99bb32395e7.html
session is stored in memory on the server , then the two servers can share memory do ? Two servers shared memory can not, then the session can share it ?
two servers so that the session can not be shared !
landlord or another to think of other solutions to solve the problem now !
------ For reference only ---------------------------------- -----
looks like the same with our project , A access B and then back to A, I have not seen that code , but it seems to go through a proxy to access it.
------ For reference only -------------------------------------- -
onlookers ing ..
------ For reference only ------------------------------ ---------
their cookie name changed to distinguish or useless . Anything else settings?
------ For reference only -------------------------------------- -
That cookie path , cookie domain to set it ?
------ For reference only -------------------------------------- -
I use the Firefox browser, tracked , websphere to restart after revision will be effective , but even apart , or it looks like the session before the problem
------ For reference only ---- -----------------------------------
I think you visit a landing, jump to b ; you can re-set the next session; so there is no question you said it
------ For reference only ------------------ ---------------------
top of you .
------ For reference only -------------------------------------- -
Why should emphasize "female programmers sorrow " ~ ~ ~
------ For reference only --------------------- ------------------
Dude, you are very straightforward ah , but very few female programmers indeed , expressed admiration
---- - For reference only ---------------------------------------
I am also head once aware of this problem.
订阅:
博文评论 (Atom)
没有评论:
发表评论