Entries Tagged as 'Railo'

Railo on IIS 7 - Object reference not set to an instance of an object

Railo 1 Comment »

I have recently discovered some issues when running Railo on IIS 7 along with ASP.net and/or custom modules. In certain situations you will get a "Object reference not set to an instance of an object" error on your CFM pages even though they were working fine previously.

image

In particular my issue was being caused when using custom modules were installed for password protected folder, such as the WebsitePanel module or Helicon APE, which then broke CFM pages.

The solution is actually really simple, you just need to convert your "jakarta" virtual directory into an application. Obviously this only applies if you are using the Tomcat or similar distro which requires such a virtual directory. If you are using the Helicon Zoo module then you will have no such issue.

image

I am not absolute sure why this occurs, but my guess would be because the request is first handed off of the connector to be processed by Tomcat, which process in the process being returned to IIS with the wrong identity, and thus fails to execute the module in-process.
By setting the jarkarta vDir to an application it then then runs the connector using the application pool identity instead.

So if you switch to a different application pool or identity or even .net version/mode then you may need to also change the jakarta vDir to be the same.

Per application servlet mappings for Railo

Railo , Windows 2008 Server No Comments »

Another of the big annoyances with Railo is that it won't handle SEO friendly URL's out of the box, you need to get into the application servers servlet mappings to add url filters for each of your SEO URL formats.

e.g. each of these would require a separate servlet mappings url-filter.

mysite.com/index.cfm/something
mysite.com/sub1/index.cfm/something
mysite.com/muraCMS/index.cfm/something

If you are on a shared server then this can be a big problem as you do not have the ability to do this, plus making changes may also break other sites.

Thankfully there is a solution that allows you to apply these url filters on a per site basis, at least for Jetty anyway, I have not tested on any of the other servlet containers such as Tomcat, but the same solution is likely possible.

in your web root you will have a "web-inf" folder which is created automatically and contains your Railo context, inside this folder create a web.xml file and paste in the below contents. 
This will allow the most common SEO URL  "index.cfm/something" to work, I have also included the required filters for MangoBlog. Now you just need to modify this file within each of your sites and add any required url-filters.
The only caveat is that you need to restart your app server in order for the settings to take affect, if you are using the Helicon Zoo module that I blogged about previously then you simply need to recycle your application pool. This can be achieved by editing your web.config as any change to this file forces IIS to recycle the application pool.

 



<?xml version="1.0" encoding="ISO-8859-1"?>


 


<web-app


xmlns="http://java.sun.com/xml/ns/javaee"


xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"


xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"


metadata-complete="true"


version="2.5"


>


<servlet-mapping>


<servlet-name>CFMLServlet</servlet-name>


<url-pattern>index.cfm/*</url-pattern>


<url-pattern>/post.cfm/*</url-pattern>


<url-pattern>/archives.cfm/*</url-pattern>


<url-pattern>/page.cfm/*</url-pattern>


<url-pattern>/author.cfm/*</url-pattern>


<url-pattern>/feeds.cfm/*</url-pattern>


</servlet-mapping>


</web-app>


 

 

New Railo and Mura installer for the Microsoft Web Platform

Railo 8 Comments »

 

Some weeks back I was talking with HeliconTech after they kindly donated a license for their Helicon APE product for use on cfmldeveloper.com my free CFML developer hosting community. And the topic of Railo came up as they noticed I also support Railo on cfmldeveloper, and they were telling me how they like to support niche technologies like this on Windows/IIS and were looking to add some new Java solutions, so we started discussing the requirements of a new Helicon ZOO module for Railo and what it lacked on the IIS platform. 
I explained to them how ColdFusion worked out of the box and the disadvantage of Railo requiring all the extra manual config of a Jakarta vDir, isapi Plugins, handler mappings and virtual hosts in the Servlet engine in order to make it work, and how a simpler ColdFusion like solution was needed, ideally using the Microsoft Web Platform Installer
They also asked for a popular open source app that they could also build an installer for and bundle with Railo, so I suggested Mura CMS.

After only 1 month and a few more email exchanges, I am excited to announce that HeliconTech have already completed the new Installer module for both Railo and MuraCMS and added them to the Web Platform Installer, now that is fast work I must say, I was impressed..... cont...


 

Read more...

Mangoblog on Railo

Railo 10 Comments »

I have just migrated this blog from Coldfusion to Railo today and thought I would share the process for anyone else who needs to get MangoBlog workign with railo.

Initially I thought it had all worked without a hitch, but then I found a couple of things broke. None of the links worked anymore as Railo (or rather Tomcat) does not support search engine friendly urls out of the box.
In order to get the SEO urls to work you need to make some changes to the c:\railo\tomcat\conf\web.xml and insert the following in the servlet mappings section.

<servlet-mapping>
    <servlet-name>GlobalCFMLServlet</servlet-name>
    <url-pattern>/page.cfm/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>GlobalCFMLServlet</servlet-name>
    <url-pattern>/post.cfm/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>GlobalCFMLServlet</servlet-name>
    <url-pattern>/archives.cfm/*</url-pattern>
</servlet-mapping>

Then restart tomcat and all should be good. If you have any app that has something.cfm/other stuff then you will need to do the above with any other filenames as well.
I did try using the following

<servlet-mapping>
    <servlet-name>GlobalCFMLServlet</servlet-name>
    <url-pattern>/*.cfm/*</url-pattern>
</servlet-mapping>

but sadly it doesn't work.

This is one of things that sucks with Railo, there is a lot of tweaking and manual config to get it to do all the things that ColdFusion just does out of the box.

One other thing that I found during this migration is that the caller scope does not work properly in Railo, if you are trying to use caller scope to set variables in other scopes it simply does not work.

For example, say you have the following code in a custom tag called mytag.cfm

<cfset Caller[Attributes.returnVar] = foo>
and you called the tag as follows
<cf_mytag returnvar="request.foo">
or
<cf_mytag returnvar="local.foo">
or
<cf_mytag returnvar="someStruct.foo">

it simply doesn't create the variable, this however works fine with Coldfusion.

In or order to fix this I had to use a simple variable

<cf_mytag returnvar="foo">

This was the only format that worked,

Railo default document management

Railo 2 Comments »

By default your installation of Railo on Tomcat may not handle default documents as expected, by this I mean when you go www.yourdomain.com it should load index.cfm by default but doesn't even though you have this set as a default document on the web server.  You may also find that you are having issues mixing CFML and PHP or ASP together on the same site.

To solve this you need to edit your uriworkermap.properties file and add the following line

/=ajp13

This will process all requests through Tomcat so will handle the default documents.

But what if you have a site that has CFML and say PHP or ASP pages and the default document is not CFML ? This is the situation I found myself with and the non CFML pages would not load the solution is in the tomcat documentation.

Add the following to the above file

!/*.yourdomain.com/=ajp13

This will do the complete opposite of the previous statement, it tells tomcat not to process ALL FILES for the specified domain, so only files with a .cfm extension will be processed

You will also need to exclude other non cfm extensions from being processed like this

!/*.asp=ajp13
!/*.aspx=ajp13
!/*.php=ajp13
!/*.shtml=ajp13

Which tells tomcat not to process these file extensions.

So here is what my entire uriworkermap.properties file looks like, which allows me to run CFML, ASP, PHP and SHTML pages on the same site, but bluethunder.co (which is mostly SHTML and PHP) will not process the default document through Tomcat but will still run CFM pages.

!/*.asp=ajp13
!/*.aspx=ajp13
!/*.php=ajp13
!/*.shtml=ajp13
/*.cfm=ajp13
/*.cfc=ajp13
/*.cfml=ajp13
/*.cfchart=ajp13
/*.cfm/*=ajp13
/*.cfml/*=ajp13
/*.cfc/*=ajp13
/*.jsp=ajp13
/*.do=ajp13
/flex2gateway/*=ajp13
/flashservices/gateway/*=ajp13
/messagebroker/*=ajp13
/=ajp13
!/*.bluethunder.co/=ajp13

Powered by Mango Blog. Design and Icons by N.Design Studio
RSS Feeds