Solved

J2EE Web application

Posted on 2010-08-24
12
402 Views
Last Modified: 2013-11-24
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?
0
Comment
Question by:javaCaravan0
  • 5
  • 5
  • 2
12 Comments
 
LVL 20

Expert Comment

by:Sathish David Kumar N
Comment Utility
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
 

Author Comment

by:javaCaravan0
Comment Utility
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
 
LVL 10

Expert Comment

by:Hegemon
Comment Utility
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
 
LVL 20

Expert Comment

by:Sathish David Kumar N
Comment Utility
Ok no pblm check both the application have same session id for same user ?
0
 

Author Comment

by:javaCaravan0
Comment Utility
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
 
LVL 10

Expert Comment

by:Hegemon
Comment Utility
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Author Comment

by:javaCaravan0
Comment Utility
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
 
LVL 10

Expert Comment

by:Hegemon
Comment Utility
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
 

Author Comment

by:javaCaravan0
Comment Utility
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
 
LVL 10

Expert Comment

by:Hegemon
Comment Utility
Yes, I would be interested to know if you managed to achieve your objectives, please post updates here.
0
 

Author Comment

by:javaCaravan0
Comment Utility
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
 
LVL 10

Accepted Solution

by:
Hegemon earned 500 total points
Comment Utility
Yes, unless you have a cluster with full replication.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now