| By Laurence Moroney | Article Rating: |
|
| May 2, 2006 10:30 AM EDT | Reads: |
19,089 |
You already know the sheer productivity advantages of developing applications that run on the .NET framework using the Visual Studio.NET IDE, and have likely developed and deployed one or more of these in the years since they became generally available. But did you know that you can double your market reach for .NET Web and server applications by rehosting them, without major modifications, to run on Java-enabled platforms such as WebSphere running on Linux? According to Forrester Research, J2EE is used by 56 percent of financial services and insurance companies, and by 44 percent of the overall market.
Visual MainWin for J2EE from Mainsoft gives you a version of the .NET framework that runs on J2EE applications servers as well as a plug-in to the Visual Studio.NET IDE that takes the MSIL that is compiled from your C# or VB.NET into Java Byte code that will run on this framework.
Composite Application Platform on IBM WebSphere Application Server
In 2005, AboveAll Software (www.aboveallsoftware.com/), a provider of business integration software, made the decision to extend its Above All Composite Application Platform, based end-to-end on the .NET framework, to WebSphere. Up until that point, customers needed hardware, operating systems and software that support the .NET ecosystem. However, Above All wanted to extend the reach of its product line into a customer base which had standardized on J2EE application servers.
The Above All Composite Application Platform, whose architecture is shown in Figure 1, can expose existing applications and systems with an SOA-enabled interface, manage the integration of applications including manag-ing the runtime and the service repository, and provide a visual front end that allows services to be tied together into a business application.
"We didn't think it would be cost effective to rewrite our deployment servers, which consists of 260,000 lines of C# code, in Java," said Deborah Scharfetter, vice president of products for Above All Software. "The development team estimated it would have taken 12-15 months to complete the rewrite, and they would have had to incur significant ongoing costs to support multiple source code bases and deployment types."
Typically, if one rewrote their application to Java, or ported it by hand, then future bug fixes and product enhancements would have to be implemented on two separate code bases - the .NET one and the Java one. This would drastically increase the costs associated with the application, requiring separate teams with separate skill sets, and a project management nightmare in keeping schedules of separate teams synchronized.
Instead, Above All opted to rehost the application on WebSphere using Mainsoft's Visual MainWin for J2EE. "Mainsoft delivered a version of their platform running natively on J2EE in 3 months, saving the company an estimated $1million in development costs," added Scharfetter. Mainsoft also helped Above All establish a single source code development environment.
With a single-source code approach to application development, the software vendor's development team is able to focus on what they do best - growing the capabilities of their platform using the .NET framework and Visual Studio .NET development technologies.
How Does the Enabling Technology Work?
At design time, your code is compiled by the Mainsoft binary compiler from .NET code into Java Byte code. This code will then run on J2EE using the rehosted implementation of the .NET Framework.
This is achieved by using a plug-in for the Visual Studio .NET IDE. This plug-in gives you new project types that will invoke this compiler and recompile your MSIL into Java Byte code. You can see this in Figure 2.
It also implements a 'Generate J2EE Project' wizard that creates a new version of the project file that contains your source code. It does this to give you a single source code solution. Your aspx, asmx, ascx files and their code behind don't get cloned into different versions for your J2EE project. Instead, a separate project which uses the same source files gets created. This project is configured to invoke the J2EE compiler and perform the Byte code level translation.
Another powerful aspect of rehosting your .NET code to run on a JVM is the fact that you can interact directly with assets that you may have hosted on the Java platform. Thus it provides an interoperability solution. So, if for example you have EJB assets on a J2EE server, and an ASP.NET front end that consumes them, you will likely go through a middleware layer whereby the EJBs are wrapped in Web services, or a bridging middleware solution. These would then get consumed by your ASP.NET front end. To get the front end to talk to the EJBs, you thus have to introduce a new transport layer just so that the technologies can talk to each other. If your ASP.NET code is rehosted to run on J2EE, this is no longer necessary, as it can consume the Java assets directly.
The runtime architecture, termed a unified platform architecture looks like Figure 3.
Under this architecture your C# or VB.NET application code which runs on the .NET framework namespaces such as System.Web and System.XML gets implemented using the standard Java packages 'under the hood'. For example, if your application uses System.Data, and by extension ADO.NET, the translator will convert this into Java Byte code that uses the Java-translated System.Data namespace, which in turn uses JDBC to execute on the JVM.
How-to Guide: Moving Towards Multi-Platform Solutions
A good example of how straightforward it is to migrate an application from .NET to J2EE, and open it up for a multi-platform approach is the ASP.NET Commerce Starter Kit. This application, available for download from the www.asp.net website is considered a reference application to show off the features of ASP.NET technology and as such is a great representative test case for porting a real life ASP.NET application to J2EE.
This application implements basic online shopping tasks including: a product catalog, user authentication and personalization, shopping baskets and order checkout.
Designed after traditional distributed Web applications, the Commerce Starter Kit is built across three logical tiers. These are:
- The data tier: Generally a relational database that supports the application and encapsulates functionality such as transactions, record locking and user security. In this case, SQL Server 2000 is used.
- The middle tier: This is where the data is retrieved and enriched with business logic, and where updates to the database are processed and prepared. Typically it is the realm of .NET Framework-based applications, Web services, Java BeansTM or Enterprise Java Beans (EJBs), depending on the application.
- The presentation tier: This is where the data is rendered to the screen, and navigation and workflow are encapsulated. Typically ASP.NET Web Forms or JSP are used here.
If you download the Visual Studio.NET version of this application, you'll get a solution that contains a single project called CommerceCSVS. Next, if you haven't done so already, download the free developer edition of Visual MainWin for J2EE from Mainsoft's developer zone at http://dev.mainsoft.com.
Once you have installed this, open the CommerceCSVS solution. In Solution Explorer, right click on the project, and you'll see a menu option 'Generate J2EE Project'. This will launch a wizard that you can use to step through constructing the J2EE port of your project. The Tomcat application server comes bundled with the developer edition of Visual MainWin for J2EE, so you can safely use that here. The Enterprise edition of the software expands to allow applications to be ported to, or created originally on, WebSphere, BEA WebLogic or JBoss.
To get your application to run on J2EE, you only need to do one change - by default the database connection string is configured to use SSPI security, which isn't supported by JDBC. You simply have to change this to provide a user name and password instead. You'll find the connection string in your web.config file, and details for the user name and password with the Commerce Starter Kit documentation.
When you run it, it will automatically deploy to your local Tomcat, and execute it there. You can see it running in Tomcat in Figure 5.
Not all ports will be as easy as this one, where no code needed to be changed, other than the configuration string for database access. There are scenarios where a direct crossover between .NET and Java does not exist, for example if you are using case insensitive path names. Windows is much more forgiving of this than Unix, and as such Java is case sensitive in this area, so any strings or string resources that you use should be made case sensitive so that the Java version of your application can happily use them.
Conclusion
From the example of the Commerce Starter Kit, and the real-world scenarios of huge .NET based applications developed by major software houses such as AboveAll Software, it is clear that a multi-platform approach to your software using the unified platform approach is feasible and cost effective. The benefits of this provide a best of all worlds approach, where your developers can continue to develop using the excellent .NET framework and Visual Studio.NET IDE, and, with little or no modification can also target the J2EE runtime, thus opening up your product reach to non Microsoft platforms. Effectively, the Visual Studio.NET IDE can become a highly productive tool for developing Linux applications, which can only be a good thing!
Additional benefits of this approach are also made possible - reducing complexity in connecting different systems for one. Expensive bridging or web services layers are no longer necessary to connect your ASP.NET front ends to your Java-based back ends. Also, management, deployment, maintenance of large data centers can be drastically simplified by targeting a single runtime platform instead of diverse ones.
Published May 2, 2006 Reads 19,089
Copyright © 2006 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Laurence Moroney
Laurence Moroney is a senior Technology Evangelist at Microsoft and the author of 'Introducing Microsoft Silverlight' as well as several more books on .NET, J2EE, Web Services and Security. Prior to working for Microsoft, his career spanned many different domains, including interoperability and architecture for financial services systems, airports, casinos and professional sports.
![]() |
Vitaly Shelest 06/27/06 04:26:27 AM EDT | |||
The author substitutes the concept of "interoperability" with "conversion". The main sence of "interoperability" is supporting coexistance of software written and compiled in different platforms: Java, .NET. I solved this issue having developed the regular Java Native Interface API for .NET. And with it I can support "interoperability" in a natural way. |
||||
![]() |
dev$fre 05/02/06 10:41:55 AM EDT | |||
}} Visual Studio.NET IDE can become a highly I am - literally - gobsmacked. How come this has been possible for so long without anyone writing about it before?? |
||||
- Kindle 2 vs Nook
- Wave on Ulitzer: Confessions of a Google Wave Fanboy
- Confessions of a Ulitzer Addict
- Cloud Computing Best Practices
- IBM Hardware Chief, Intel VC Exec Arrested in Insider Trading Scam
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- Ulitzer.com Named Exclusive "New Media" Sponsor of Cloud Computing Conference & Expo
- Infrastructure-as-a-Service Will Mature in 2010: Microsoft's David Chou
- Windows 7 – Microsoft’s First Step to the Cloud
- Cloud Computing & Federal IT - What Does the Future Hold?
- Jill Tummler Singer, Deputy CIO of CIA, Keynotes at GovIT Expo
- Cloud Expo and the End of Tech Recession
- Kindle 2 vs Nook
- The Difference Between Web Hosting and Cloud Computing
- Ajax in RichFaces 3.3, JSF 2 and RichFaces 4
- Wave on Ulitzer: Confessions of a Google Wave Fanboy
- Confessions of a Ulitzer Addict
- Cloud Computing Best Practices
- IBM Hardware Chief, Intel VC Exec Arrested in Insider Trading Scam
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- Ulitzer.com Named Exclusive "New Media" Sponsor of Cloud Computing Conference & Expo
- Eval JavaScript in a Global Context
- Infrastructure-as-a-Service Will Mature in 2010: Microsoft's David Chou
- Windows 7 – Microsoft’s First Step to the Cloud
- Google Maps and ASP.NET
- Crystal Reports XI & How It Has Changed
- Converting VB6 to VB.NET, Part I
- Creating Controls for.NET Compact Framework in Visual Studio 2005
- Where Are RIA Technologies Headed in 2008?
- How to Write High-Performance C# Code
- AJAX World RIA Conference & Expo Kicks Off in New York City
- Implementing Tab Navigation with ASP.NET 2.0
- i-Technology Photo Exclusive: Bill Gates & Steve Jobs In "Nerds"
- .NET Archives: Getting Reacquainted with the Father of C#
- i-Technology Viewpoint: "SOA Sucks"
- Programmatically Posting Data to ASP .NET Web Applications




































