Click here to Skip to main content
Click here to Skip to main content

ASP.NET TimeTracker Starter Kits Porting from Windows to Linux (Race to Linux)

, 5 Oct 2005
Rate this:
Please Sign up or sign in to vote.
ASP.NET TimeTracker Starter Kits Porting from Windows to Linux using Mainsoft's Grasshopper

ASP.NET TimeTracker Starter Kits Porting from Windows to Linux

Introduction

The scenario is to port one of the ASP.NET starter kits from Windows to Linux using cross-platform of choice (like Grasshopper, Mono, PHP, Macromedia and so on). We can use existing SQL Server (which ASP.NET TimeTracker already works with) or any other database like MySQL, PostgreSQL and so on.

My Choice

Among the 4 choices I decided to go ahead with Grasshopper. Although Mono is a very good too.

TimeTracker starter kit is proven to work with SQL Server, I didn't want to fix it when it is not broken. I simply choose to use Hosted SQL Server instead of migrating to MySQL, PostgreSQL and so on.

The project uses SQL Server 2000 and ASP.NET using C# (can be done using VB.NET too).

The problem

There are situations where a ASP.NET project has to be migrated to Linux. Some companies seem to have this senario. The typical solution is that they take the .NET Project code and then convert it into java code so that they can run on Linux as shown below.
Problem

The Solution (Grasshopper thinks from bottom)

Converting .NET code to Java code for each project is a solution. But Grasshopper guys though about the solution like a Grasshopper (started looking from ground level - grasshopper is at ground level usually). Their solution is very nice. Any .NET code compiles down to .NET Assembly which depends on .NEt Libraries. They wrote libraries for .NET in java. They use this to do the conversion of .NET code to Java bytecode directly, making it easy to run it on Lunix.
Solution

Grasshopper Setup

  1. Download and install Grasshopper from http://dev.mainsoft.com/Default.aspx?tabid=28. Tomcat is installed as part of Grasshopper installation.
  2. Download and install 'Directory Services' and 'Drawing' Beta components files from http://dev.mainsoft.com/Default.aspx?tabid=28. Don't forget to updated the Grasshopper runtime with the System.DirectoryServices modules. Though they are Beta, they worked quite well for me. Doing so will save some time GOOGLING for errors during build. Though Directory Services is not required for this project it might be required for future project, so you might consider downloading it.

TimeTracker Starter Kits Setup

  1. Download and install ASP.NET TimeTracker Starter Kit from http://www.asp.net/Default.aspx?tabindex=8&tabid=47.
  2. Go with default options which installing the TimeTracker Starter Kit

Our Windows to Linux Port

  1. Start Tomcat (Go to Start-->All Programs-->Visual MainWin for the J2EE(TM) platform and click Start Tomcat).
  2. Open TimeTracker Starter Kit Visual Studio Solution (Go to Start-->All Programs-->ASP.NET Starter Kits-->ASP.NET TimeTracker (CSVS) click ASP.NET TimeTracker Starter Kit (CSVS).sln).
  3. Right click the TimeTrackerCSVS project and hit 'Generate J2EE project'. A wizard will be open, follow the below steps...
    • Hit Next button.
    • Check 'Save a copy of the original solution file' and hit Finish button.
    • Grasshopper takes couple of minutes, let it finish.
  4. A New Project (TimeTrackerCSVS.J2EE) will be added to the current solution.
  5. Right Click TimeTrackerCSVS.J2EE Project and hit Build, wait until the Java conversion completes (takes a minute or two).
  6. Now you might have noticed some warnings, there will be some little issues which we will be discussing below. Once we fix them all we will rebuild the solution to get the application working.

Challenges (I like to call issues)

We will address the issues that occur during the Windows to Linux porting process. Practically we discover and solve all the issues during build and testing time. For this project the easiest issues are build time errors or warning.

  1. Fortunately, there are no build time errors, but we have 3 warnings here.
    warning JC8000: Not Implemented Element 'customErrors'
    warning JC8000: Not Implemented Element 'sessionState'
    warning JC8000: Not Implemented Element 'pages'
    
    All these warnings are from web.config file and are due to the fact customErrors, sessionState and pages are unsupported elements. The solution is to comment them out in web.config.
  2. Now it all seems to have compiled successfully and when I run the application I see the error 'JDBC' error. My connection string was like below...
    <add key="ConnectionString" value="server=localhost;Trusted_Connection=true;database=TimeTracker" />
    
    The problem seems to be that my starter kit installation was using 'localhost' for server in web.config's ConnectionString's property. I had to change it to 'HOME' (my home PC). Then I discovered that it had troubles connecting using 'Trusted connection', as my SQL Server didn't give any permission. I changed the connection string to use username/password instead of Trusted connection as below...
    <add key="ConnectionString" value="server=HOME;Trusted_Connection=true;database=TimeTracker;user id=sa;password=" />
    
    Issues #2 fixed. Note: It looks like we have to rebuild whenever we change the connectionString in web.config, otherwise the application is not picking it up.
  3. There was a warning at line 54 in Global.asax.cs file. It is just a warning and warning does not cause damages, but it is better to fix it. The code was…
    catch (Exception ex)
    {
    	Thread.CurrentThread.CurrentCulture = new CultureInfo("en-us");
    }
    
    Remove or comment out the (Exception ex) to remove the warning. The resultant code should look like below...
    catch // (Exception ex)
    {
    	Thread.CurrentThread.CurrentCulture = new CultureInfo("en-us");
    }
    
  4. Error: It complains about System.DirectoryServices not found. Right click the TTWebCSVS.J2EE project, click Add Java Reference, double click System.DirectoryServices.jar and click Ok button.

Package and Deploy

  1. Right click the TTWebCSVS.J2EE project and click 'Deployment Packager', grasshopper will create a WAR file (J2EE deployment file). Due to size limitations i didn't include the deployment package (you can generate it yourself). Choose the options as shown in the image below...
    Creating the WAR file in Visual Studio .NET.
    My project has two WAR files (ASPNET.StarterKit.Reports.war and TTWebCSVS.J2EE.war) and a TTWebCSVS.J2EE.deployWar file, in the bin_Java folder.
  2. Tomcat management console can be used to upload & deploy the WAR file to install the application. Based on Application Server your project is associated with Grasshopper can deploy the application itself.
I can view my application in IIS at http://localhost/TTWebCSVS/Default.aspx and in Tomcat at http://localhost:8080/TTWebCSVS/Default.aspx.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Abi Bellamkonda
Architect
Australia Australia
"Impossible" + "'" + " " = "I'm Possible"
 
Started programming when i was a kid with 286 computers and Spectrum using BASIC from 1986. There was series of languages like pascal, c, c++, ada, algol, prolog, assembly, java, C#, VB.NET and so on. Then shifted my intrest in Architecture during past 5 years with Rational Suite and UML. Wrote some articles, i was member of month on some sites, top poster(i only answer) of week (actually weeks), won some books as prizes, rated 2nd in ASP.NET and ADO.NET in Australia.
 
There is simplicity in complexity

Comments and Discussions

 
GeneralASP.NET TimeTracker link changed PinmemberHampti7-Nov-05 9:46 
GeneralWrong culture PinmemberHampti7-Nov-05 9:34 
GeneralRe: Wrong culture PinmemberHampti8-Nov-05 6:29 
GeneralEmpty ZIP file PinmemberHampti6-Nov-05 10:50 
GeneralRe: Empty ZIP file PinmemberAbishek Bellamkonda6-Nov-05 13:41 
GeneralRe: Empty ZIP file PinmemberHampti6-Nov-05 23:33 
NewsAdded more description PinmemberAbishek Bellamkonda5-Oct-05 18:48 
QuestionMore description? PinmemberHACKERGY24-Sep-05 5:30 
AnswerRe: More description? PinmemberAbishek Bellamkonda24-Sep-05 11:23 
GeneralOh boy... Pinmembermav.northwind23-Sep-05 20:29 
GeneralRe: Oh boy... PinmemberAbishek Bellamkonda23-Sep-05 22:04 
GeneralRe: Oh boy... Pinmembermav.northwind24-Sep-05 3:00 
JokeRe: Oh boy... PinmemberAbishek Bellamkonda24-Sep-05 11:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web03 | 2.8.140827.1 | Last Updated 6 Oct 2005
Article Copyright 2005 by Abi Bellamkonda
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid