• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to reload class file for java objects in CF MX7

Explorer ,
Dec 04, 2007 Dec 04, 2007

Copy link to clipboard

Copied

I'm trying to create a simple java object for use in a CFML page. According to the topic "About ColdFusion and Java objects" in the CF developer's guide, I can compile my java module and put the .class file in the CFusionMX7/wwwroot/WEB-INF/classes directory and it'll be dynamically reloaded any time CF sees a new .class file there. But the dynamic reload isn't happening; I have to restart the CF server to get it to pick up a new version.

I don't believe this directory is in the "general JVM classpath"; I don't find "classes" in the Java Class Path in the CF Administrator's System Information page. And I have all the caching options turned off on the "Server Settings > Caching" page, if that has any bearing on it.

Are there any known issues around this dynamic reload capability, or maybe a more definitive way to make sure the WEB-INF/classes directory isn't in the classpath?

Thanks,
James
TOPICS
Advanced techniques

Views

2.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Dec 04, 2007 Dec 04, 2007

Copy link to clipboard

Copied

You might try the suggestion here and add <reload>TRUE</reload> to the jrun.xml file. Create a backup copy first.
calling java object from cf

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 05, 2007 Dec 05, 2007

Copy link to clipboard

Copied

Thanks cf_dev2, I might've seen that one while I was searching around, but didn't try it because the poster said it didn't work. Now I've tried it too, and it doesn't work for me either.

I did find some dtd info for that jrun-web.xml file here: http://livedocs.adobe.com/jrun/4/descriptordocs/jrun-web/jrun-web.htm It seems to apply more to servlets and jsp helper classes than to a plain old java object like I'm trying to work with.

At any rate, the auto-reload is supposed to be the default behavior, according to the documentation. Is this one of those bugs that everyone just works around rather than spending $500 on an Adobe support incident? Maybe there aren't that many people trying to develop with Java and CF together.

James

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Dec 05, 2007 Dec 05, 2007

Copy link to clipboard

Copied

jhilty,

It doesn't work for me either, but I don't know if its a bug or a simple misconfiguration. I think a number of people are using java and CF together but its often a matter of the right person seeing your question at the right time. If you don't get an answer here you might try asking on the list at houseoffusion.com. Someone there might know.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 05, 2007 Dec 05, 2007

Copy link to clipboard

Copied

James,
I know of no way to make that happen. If you think about it, even our 'hotfix' process requires you to restart the appserver for the hotfix/classes/jar to be seen.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Dec 05, 2007 Dec 05, 2007

Copy link to clipboard

Copied

IIRC previous versions did use the <reload>TRUE</reload> setting for dynamic class reloading. It is in one of the release or tech notes. Is this now broken?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Dec 05, 2007 Dec 05, 2007

Copy link to clipboard

Copied

Here is one reference to this setting under "Dynamic class reloading"
http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_18228&sliceId=1

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 05, 2007 Dec 05, 2007

Copy link to clipboard

Copied

This is only for servlet/jsp reloading. It does not pertain to java classes in the jrun & cf classpaths.

Not broken, it just does not apply here. Again, think back to our hotfix procedure. If it were not required, we would not make you restart CF.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Dec 05, 2007 Dec 05, 2007

Copy link to clipboard

Copied

Yes, I understand. But if I'm reading it correctly, what you're saying seems to contradict the documentation

http://livedocs.adobe.com/coldfusion/7/htmldocs/00001561.htm
ColdFusion dynamically loads classes that are either .class files in the web_root/WEB-INF/classes directory or in JAR files in the web_root/WEB-INF/lib directory. ColdFusion checks the time stamp on the file when it creates an object that is defined in either directory, even when the class is already in memory. If the file that contains the class is newer than the class in memory, ColdFusion loads the class from that directory.

http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_18228&sliceId=1
Dynamic class reloading for Java servlets classes and forcfobject (sic) Java classes is disabled by default in ColdFusion MX. To enable dynamic class reloading, do the following: ...

Also, I seem to recall that setting worked in a prior version. Though I would have to test it again on another machine to be certain.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 05, 2007 Dec 05, 2007

Copy link to clipboard

Copied

You learn something every day. cf_dev2 is correct. The CF8 documents also document this.

So, per the documentation is the class also in the JVM classpath or inside coldfusion/lib. Classes here will NOT dynamically reload.

I will test this further when time allows.

Thanks,

Ken

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Dec 05, 2007 Dec 05, 2007

Copy link to clipboard

Copied

Ken,

Thanks for looking into it . Please let us know what you discover.

I wanted to see if my recollection about this setting was correct. So I tried it with MX6.1 and 7. It worked perfectly with 6.1 but didn't work at all with MX7. The test classes were placed in web_root/WEB-INF/classes which should be okay. Here are the results from MX7 for the curious

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 06, 2007 Dec 06, 2007

Copy link to clipboard

Copied

Yes, cf_dev2, that's essentially the same thing I was doing. CF doesn't pick up updates to the .class file. You can also delete the .class file, and it'll happily continue using the class. Yesterday I did a fresh install of CF 7.0.2 on a machine that never had it before, and it does the same thing.

Hope Ken can get it sorted out...

James

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 06, 2007 Dec 06, 2007

Copy link to clipboard

Copied

OK, clearly CFMX7 and CF8 documentation states that this should work and it does not. Clearly there is a bug here.

I know the coldfusion classloader was updated in CFMX7. This led to the coldfusion classpath, the new hot fix procedure and other changes. So, it appears the dynamic classloading also may have changed here. The real issue is whether this is a documentation bug meaning this documentation was just moved forward from CFMX6 without the functionality being moved forward. Or, if this behavior was really expected to move forward, also. In the latter case that would be a technical bug.

I have opened this issue with development and will let you know what I hear. One way or another we will figure out what the bug is.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Dec 06, 2007 Dec 06, 2007

Copy link to clipboard

Copied

Excellent. Thank you.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 18, 2007 Dec 18, 2007

Copy link to clipboard

Copied

OK, the word from development is that this was never expected to work in CFMX7 or CF8. A comment was posted at the bottom of the CFMX7 livedocs page. But, clearly there was a disconnect between documentation and development on this feature in CFMX7 & CF8.

JRun has dynamic classloading from WEB-INF/lib for servlets & JSPs. ColdFusion does not have this behavior in CFMX7 and CF8.

I have opened a documentation bug (71020) to get this updated in our documentation. I have also opened an enhancement request (71021) to see if dynamic classloading in some form can be added back into ColdFusion. The enhancement will not be part of the upcoming CF8.1 update.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jan 07, 2008 Jan 07, 2008

Copy link to clipboard

Copied

LATEST
Thanks for the follow up and entering an enhancement request. If it is possible/feasible to add it back, well .. its definitely got my vote.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation