AdobeStock_455007340

Java CFX Tags Are Always Loaded

If you are developing CFXs using the Java CFXAPI this one will get on your nerves (it’s bugging me big time, and based on Christian Cantrell’s recent messages to me it is bugging him endlessly too). C/C++ CFX tags have a “Keep DLL Loaded” checkbox, but Java CFXs do not. Java CFXs are Java classes located in the Java classpath (specified in the Java settings page in the ColdFusion Administrator), and ColdFusion loads classes located on the Java classpath once per server lifetime. What does this mean? During active development you’ll likely find yourself recompiling your Java source repeatedly as you make changes, and wanting to test those changes via a ColdFusion tag invocation. And you are going to have to restart ColdFusion each and every time you generate a new .class file or else ColdFusion will not “see” your changes. It’s painful, but that’s the way it is for now (I keep the Windows Services Control Panel open during development so as to be able to hit the restart button as needed – ouch!).

5 responses to “Java CFX Tags Are Always Loaded”

  1. Sam Avatar
    Sam

    CF should include a unit test tool for CFX tags for development.
    There must be a way to reload classes in Java–CF recompiles and reloads classes generated from CFM at runtime. CFMX should have some type of development mode for CFX or way to reload them programmatically or through cfadmin.
    This seems like a fixable problem and hopefully since it’s affecting the Evangelist, it will get fixed. 🙂

  2. Jade Avatar
    Jade

    I thought using reload="Always" when calling the tag solved that problem.
    Documentation says: Use reload="Always" during the development process, when you must ensure that you always have the latest class files, even when only a dependent class changed.
    Isn’t this what you are looking for?
    Jade

  3. Ben Forta Avatar
    Ben Forta

    The RELOAD attribute applies only to class files located in the classes directory. The ColdFusion server loads classes located on the Java classpath once per server lifetime. You must stop and restart the ColdFusion server to reload these classes.
    Plus, it does not quite work even where it is supposed to, it’s a known bug.

  4. James Ang Avatar
    James Ang

    As for restarting CF, I prefer to have CMD handy. 😛 Here’s what I have in my CMD whenever I feel like restarting CFMX:
    net stop "ColdFusion MX Application Server"
    net stop "ColdFusion MX ODBC Agent"
    net stop "ColdFusion MX ODBC Server"
    pause
    net start "ColdFusion MX ODBC Server"
    net start "ColdFusion MX ODBC Agent"
    net start "ColdFusion MX Application Server"
    I added the pause just in case I want to do something else before CFMX starts up.

  5. Ben Ptacek Avatar
    Ben Ptacek

    Maybe I am missing something here…
    I have Linux with ColdFusion MX 6.1 using apache webserver. I have my classes in the classes directory, and my libs in my lib directory. However, even after changing the jrun-web.xml to have <reload>TRUE</reload> tag, I still have to restart to the CF Server. I thought, if the classes were in the classes directory and you set that tag, than you DO NOT have to restart the server, however I still have to??? I took a look at the TechNotes and cannot find this "bug" anywhere either?

Leave a Reply