I've developed an application for a client using Mach-II with CF
handling the View-Controller and Java handling the Model. Works
great, but there were a few issues I had to untangle to get the
pieces working together (note: my notes apply to CFMX Standard only):
- the Java classes must reside in the CF web root, or possibly in
a classpath defined in the CF administrator. That has a couple consequences:
1. you can't run your hybrid apps on a shared host
2. you have to be careful with naming conventions and shared
classes between apps because all the classes will reside under
the same root. Not as neat and tidy as pure Java web apps.
- in addition, to get CF to recognize changes to the Java
classes, you have to add
<reload>true</reload>
<compile>true</compile>
to <jrun-web-app> in webroot/WEB-INF/jrun-web.xml
- CF uses log4j 1.1.3, so your Java code must too. Big bummer,
particularly since log4j 1.3 purportedly will resolve a log
archiving problem on Windows. Also, this suggests the possibility
of big conflicts down the road. If my Java code uses a
third-party library and a future release of CF incorporates a
different version of that library, it seems very possible that my
code will no longer work if the api of CF's version of the
library is different.
- unlike Tomcat, JRun/CF won't automatically locate your log4j
properties file, so you need to manually specifiy its location,
e.g.:
PropertyConfigurator.configure("d:/CFusionMX/wwwroot/WEB-INF/classes/log4j.properties").
(Note: this may be due to CF using its own log4j property file)
- I never could get coldfusion.sql.QueryTable working properly in
Java. If the resultSet contained 10 or more records, it threw a
coldfusion.server.ServiceFactory$ServiceNotAvailableException.
Instead, I wrote a UDF which converts the resultSets into a Query.
- the lack of support of nulls is a pain. My workaround is to
assign the results of a Java method call to a variable, then test
is the variable exists. Seems to work, but I haven't tested it thoroughly.
Good luck. Let me know if you have any questions. It may seem
like a lot of work to get Java and CFMX working together, but
once you get the kinks ironed out it runs smoothly and the
benefits are well worth it.
Dave Jones
NetEffect
At 10:07 AM 5/6/04 -0500, you wrote:
>We're considering implementing an application that uses java on
>the backend side (business logic, etc) and MX as the front end.
>What issues have people come across with respect to MX's
>integration with java? For example, since MX doesn't support
>null values java methods should be written such that null
>parameters aren't allowed (e.g. - if needed create a special
>method setObjectToNull). Personally I think MX should support
>null values, but that's an argument for another thread. On a
>side note - in 6.0 I ran across a bug where MX didn't convert
>null values to the empty string correctly. However, this has been fixed in 6.1.
>
>What other integration issues are out there?
>
>Thanks,
>Bob
>
>----------
>[<http://www.houseoffusion.com/lists.cfm/link=t:4>Todays
>Threads]
>[<http://www.houseoffusion.com/lists.cfm/link=i:4:162422>This
>Message]
>[<http://www.houseoffusion.com/lists.cfm/link=s:4>Subscription]
>[<http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=1210.1130.4>Fast
>Unsubscribe] [<http://www.houseoffusion.com/signin/>User Settings]
>
>----------
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

