Visit the javapronews Directory
Blogs
Blogger, Blogosphere, Web 2.0...
Design Agencies
Professional, Design, Job...
Education
Communicate, Help, Learn...
Forums
Search, Learn, Communicate...
Java Developers
Skills, Build, Distribute...
Java Tutorials
books, help, Learning...
Javascript Tutorials
Help, Learn, Read...
News
Technology, Business, Web...

Submit your site for FREE

Java Problems With Coldfusion 8 On Mac


Pete Freitag By: Pete Freitag

I just got a brand new Mac Pro and I spent most of the day installing stuff, but the next day I was trying to get a little work done… I ran into a problem when trying to invoke web services on CF8 - it threw the following error:

coldfusion.jsp.JavaCompiler$UnknownCompiler: Unable to run the internal Java compiler: java.lang.NoClassDefFoundError: javax/tools/StandardJavaFileManager.

I setup the following test code using Doug Hughes’ Fortune web service, to make sure it wasn’t just the service I was trying to call:

<cfset ws = CreateObject("webservice", "http://www.doughughes.net/WebServices/fortune/fortune.cfc?wsdl")>
<cfset f = ws.getTopicsList()>
<cfdump var="#f#">

After searching google, all I could find were a few other people with the same problem and no solution. I found that the StandardJavaFileManager class (the one it can’t find) is part of Java 6 - I was running Java 1.5, and I know that on Windows CF8 ships with Java 1.6. I pinged Sean Corfield to see if he had experienced these problems. He said, no but he is already running Java 6 (which helped me confirm that was indeed the problem). He also helped me figure out step 3.


Step 1 - Download & Install Java 6 for Mac

I downloaded the Java SE 6.0 Release 1 Developer Preview 6 from Sept. 2006, as it was the most current release as of this writing. You can download it from the Apple Developers Connection (ADC) which is free but requires a login.

Step 2 - Make Java 1.6 the default JDK for your Mac

To do this run the following:

cd /System/Library/Frameworks/JavaVM.framework/Versions
sudo rm CurrentJDK
sudo ln -s 1.6 CurrentJDK

To make sure it’s working run the following:

./CurrentJDK/Home/bin/java -version

You should get something like this:

java version "1.6.0-dp"
Java(TM) SE Runtime Environment (build 1.6.0-dp-b88-34)

Step 3 - Remove tools.jar

If you restart CF8 at this point your server will infact be running on Java 6, and this is good, but web services still throw an error, this time a different one. To fix you need to remove tools.jar (make a backup of it and put it somewhere else, also you probably want to stop CF first). You can find it in CF8’s WEB-INF/cfusion/lib folder.

Finally just start or restart ColdFusion, and you should be able to invoke web services.

About The Author

Pete Freitag (http://www.petefreitag.com/) is a software engineer, and web developer located in central new york. Pete specializes in the HTTP protocol, web services, xml, java, and coldfusion. In 2003 Pete published the ColdFusion MX Developers Cookbook with SAMs Publishing. Pete owns a Firm called Foundeo (http://foundeo.com/) that specializes in Web Consulting, and Products for Web Developers.

Leave a Reply