J2EE Web application

I have an existing web application writen in JSP/JAVA running under JBOSS server. Since many users access the application, a session is generated after user logs into the application.
I would like to replace this existing web application with a brand new application to be written in JSF/Spring running under JBOSS server. Since the applicatin is large, the application under new tech. stack will be completed over some period of time but I would like the end-users to be able to use the  transactions in new application i.e. use new application for the transactions that have been completed but use the existing application for whatever hasn't been completed. Both applications (existing and the new) require log in and session will be generated after successful login.
I want to know whether it is plausible/feasible? How will the two application be able to share the transactional information? If the user is logged into one application and the transaction being processed needs to go to the other applicatoin, how will this happen or can it happen?
javaCaravan0Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
HegemonConnect With a Mentor Commented:
Yes, unless you have a cluster with full replication.
0
 
Sathish David Kumar NArchitectCommented:
I think
If you use spring means ...
They provide  transactional  API that provide you Can use that and u can done what you need .
 
Both session Id are same else ??
0
 
javaCaravan0Author Commented:
Can you please elaborate? The thing that I don't understand is: how will the two applications interact seamlessly since both applications require a session? Is this even possible.
My existing application is not using SPRING. I can't use web Services because existing application is old and doesn't comply with industry standards.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
HegemonCommented:
Not clear what you mean "transactions" and "transactional information". Database records ?

- How will the two application be able to share the transactional information?
Both applications need to be backed by the same database or you will need a converter that will convert the old database to the format required by the new application. In this case each application will work with its own database.

- I want to know whether it is plausible/feasible?
Yes.

- If the user is logged into one application and the transaction being processed needs to go to the other application, how will this happen or can it happen?

It depends on how you organise it. You may want to construct pages with links coming from both applications. If you do nothing else, then the first time the user clicks on the "other" application's link she will need to authenticate. If you absolutely need a single login to both application, you will need to enable cross -context session propagation: http://stackoverflow.com/questions/661978/what-does-the-crosscontext-attribute-do-in-tomcat-does-it-enable-session-sharing
(also Google for "Tomcat crossContext")

If you want the server-side code of one application to "call" another, you will have to package them in a manner so that one is accessible from another - i.e. pack in the same EAR or call globally available EJBs using JNDI or forward requests from one application's servlet to another or use remoting etc.

The  possible way to go is to keep the old application as it is and add a "legacy interface part" to the new application. It will be emulating the protocol of the old application, for example, set the necessary request and session parameters and forward requests to the old application.

When your new application is complete, you take away the old application and the "legacy interface part".
0
 
Sathish David Kumar NArchitectCommented:
Ok no pblm check both the application have same session id for same user ?
0
 
javaCaravan0Author Commented:
Hegemon: Thanks for the detailed response.
Both applications will be sharing the same DB.
By transactional information I mean the input parameters entered by the end-user and/or the values retrieved from the database that will need to be transaported from Web App1 to Web App2.
following is an abstract from The URL you have provided:
"For example app1 would call:
setAttribute("name", object);
and another app could call
getContext("app1").getAttribute("name");"
It means that we'll have to modify/tweak the existing application, right?
Now coming to your last paragraph:
existing application is just JSP driven from one page to the next using JAVA classes to connect to the database, java classes are instantiated within JSP (really bad design). New application is going to be true MVC using JSF/Spring.
I'll appreciate if you provide your "more" expert comments.
0
 
HegemonCommented:
From what you are saying I understand both application can interact by means of a shared session/context, which should be possible to organise using the crossContext setting.

As per whether the existing application needs to be modified/tweaked.. it depends. Usually you would prefer the old application to be not changed with all the changes going to the new one. This is fine as long as the new application can emulate all the necessary steps completely and the amount of effort needed to implement it is reasonable. It might be much simpler to make a small change in the old app rather than a big change in the new app, designed only to make the [badly designed] old app to work.

A couple of side notes:
- the "old" application is not necessarily bad if it does not follow all "cool" principles - MVC, 3-tier, IoC etc. If the app is small enough, the overhead of having extra libraries, frameworks and extra code can be significant;

- If you are going to use JBoss and JSF, first have a look at Seam and consider using it instead of Spring. JSF + Seam + JBoss is an excellent combination and in my view Seam will play better than Spring in this trio. However, you decide.
0
 
javaCaravan0Author Commented:
Hegemon:
Thanks for the explanation.
The conclusion is (please correct me if I'm wrong)
1. in the server.xml, I'll need to do something like this to have a single sign on for both web apps:
  <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
I'll need to pick one application (either exiting or new I'll pick new) to login. Once logged in, the other app will also be accessible, and the session will be shared between the two apps.
2. To pass the information between two web apps, I'll need to set the crossContext=true.
Can you please tell me where do I need to set the crossContext=true , is it in web.xml, server.xml?
is it something like this <context crossContext=true />?

Thank you

-Essa
0
 
HegemonCommented:
Looks fine to me.

I think it is <Context crossContext="true" .../>  and is set in context.xml, see Chapter 3 here: http://docs.jboss.com/jbossas/guides/webguide/r2/en/html_single/


0
 
javaCaravan0Author Commented:
Hegemon:

Thanks for the reply. It is really a great discussion. Now, I'll need to test what you have explained. I'll be back and keep updating you with the status where I stand. First I will just develop two simple web apps for testing.

Thank you
0
 
HegemonCommented:
Yes, I would be interested to know if you managed to achieve your objectives, please post updates here.
0
 
javaCaravan0Author Commented:
One quick question:

Will the two apps need to be on the same server to be able to use session sharing and crossContext? Please confirm.
0
All Courses

From novice to tech pro — start learning today.