Wednesday, July 9, 2008

Be careful when developing on Windows but hosting on Linux

I know this is kind of old and obvious but any way I had the problem with paths that are not case sensitive on Windows but case sensitive on Linux. I hit this problem while I used grails controller with the name LearningCenterController and had my gsp pages in folder named learningcenter.

Simple code from controller like this one:

def index = {
render (view:'about')
}

worked fine on Windows. Then I deployed changes to my VPS hosting provider and there I had a problem with error reported: file not exists. And of course, this happened because folder names are case sensitive on Linux.

So nothing special but only good well known story: be careful when developing on Windows but deploying on Linux.

And by the way did you already visited grails tutorials? ;)

11 comments:

Markus Jais said...

I think one solution to avoid this is to give developers a Linux machine to develop on.
All Java and Groovy tools (Eclipse, Netbeans, etc) also run on Linux.
Often Windows is used only to give people access to Outlook.
If possible, developers should develop on the same OS as the production system runs on.

lifewithryan said...

Shouldn't the grails command:

grails generate-views LearningCenter have taken care of that for you. (Assuming you have a domain model called LearningCenter)...

Sean said...

I think that most developers realise these problems and if they get one of these, they can usually fix them really quickly, so I think it really is a moot point. I doubt that you will be having the same problem again now that you realise that it happens.

BenC said...

I agree completely with Markus, developers need to use the deployment OS as their dev OS. Regarding Outlook/Exchange access, that's what makes the Mac a very compelling development platform. All of Linux's command-line goodness, a great GUI, and access to Exchange via MS Entourage. This is all moot of course if you're deployment platform is Windows.

chris said...

Another solution if you use Windows to develop on is to run Linux in a virtual machine e.g. VMWare player, VirtualBox etc. Then you run the webserver and database in Linux and access the files over a samba share.

jan said...

I believe that the best solution would be to develop on the same system as deployment system. But this is not possible in all cases.

If you are developing on different system then you at least should run (during development) application on the same system as deployment is.
This way those (system related) bugs are discovered much sooner.

Didn't Java promised write once run everywhere? ;)

Michael Sharman said...

Agreed that developing on the same OS as your production environment helps, but a lot of this can be avoided by having simple naming conventions which any developer worth their salt has.

So you have conventions for variables, files (classes vs display templates etc) etc

Julien said...

I have encountered this problem by a software developed by another company.
Does anybody know if it is possible to "suspend" the case sensitive mode under Linux in order to run this software?
I have no possibility to modify the original software....
Thanks,

jan said...

@julien
I think you cannot turn off case sensitive mode on Linux but I would say that you should be able to change at least file names or folder names deployed as war file.

PJ said...

Other issue you should know is that in linux class loading order is different than in windows. Windows uses file dates and linux alphabetical order (or was it the other way). This causes sometimes problems when you have implementation classes for xml parsers and such in different packages. More problem of application servers than grails really.

kulveer singh said...

I am baffled by the comments of various people on this blog who say that developer should use the same environment as they want to deploy - i want to ask if some application has to be deployed on multiple platforms, what developer is going to do .This is totally unacceptable suggestion for solving case-sensitivity issue. There should be some mechanism or can be designed to get rid of this problem by using filter or any other approach.