Web Services Problems with ColdFusion 8 on a Mac


I just got a brand new Mac Pro yesterday - I spent most of yesterday installing stuff, but today 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.
Tweet
add to del.icio.us
| Tags: coldfusion 8, mac, apple, web services, soap, java, java 6, cf8
Related Entries
- ColdFusion SOAP Web Services and onRequestStart - November 19, 2009
- Working with /etc/hosts on Mac - December 1, 2008
- PostalMethods - Web Service for Snail Mail - July 27, 2008
- CFImage Presentation Outline - September 14, 2007
- Going from SOAP to REST Web Services - August 17, 2007
Trackbacks
Comments
sudo ln -s 1.6 CurrentJDK/
When I tried
sudo ln -s 1.6 CurrentJDK
it worked. But when I did java -version, I still got 1.5.x.
java -version
will show 1.6 after installing the developer preview but before changing the symbolic link. The DP changes the JRE - including the java binary - but doesn't change the JDK. JRun requests a JDK instance and gets the "old" 1.5 JDK (although Eclipse and other console Java apps will use 1.6 JDK).
A good way to check you got it right is to start ColdFusion from the console (e.g., ./jrun start cfusion) and JRun's console output will confirm the JDK version it picked up.
I'll also note that I did not need to remove tools.jar *after* fixing the JDK link (but I would have expected to need to remove it if I was running against Java 5).
But - I started CF, went to settings, and saw 1.6 there. So I'm assuming I'm good to go.
@Ray - DP stands for developer preview. Did you try running the web service example?
OS X 10.4.10 Java 1.5.0_07 Apache 2.2.4 JBoss 4.2.1 ColdFusion 8
I used the same code as above and ran without error. Are you using Jrun?
Damon
@Damon Good Point, but do you have any insight as to why I might have been getting that error (I'm not the only one search the web)
For localhost development, I would never recommend the JBoss route - and I've worked with JBoss in production systems quite a bit.
If you want to use JDK1.5, you would need to replace lib/tools.jar with 1.5's tools.jar.
Anyways thanks for all the comments, I am using JRun in multi-server mode, and I am also connecting to Apache... I will have to give JBoss a try at some point as well.
The multiserver instance management built into CF is great - something you lose with JBoss.
It's odd that it didn't seem to be a problem with the public beta. It appears to have been a known issue since June 22nd!
My question is, why does CF then ship with the tools.jar bundled in cfusion/lib, when it's known that it causes JVM version incompatibilities, at least on some supposedly supported platforms?
Why not detect the JVM on install, use the appropriate tools.jar, and document the thing should someone want to switch JVM's later on? Or at least officially document it with a public technote, so we're not left to search some developers blog.
Regarding your suggestion of installing appropriate version of tools.jar, thats not possible at all. For standalone CF, there is no issue because it is a complete install where we install JVM as well. Issue comes with J2EE installation where installer simply creates an ear or war which needs to be deployed on the J2ee server. We wouldnt know which J2EE server you are going to install it on and what version of JVM that server will run on.
And there hasn't been any change in JVM version or tools.jar or webservices between public beta and final version.
cfobject webservice="http://codex.corp.adobe.com/codex/codex.wsdl" name="wsObj"
(brackets omitted so I could post) and get the error: "java.lang.UnsatisfiedLinkError: no ntvinv in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1753)". I'm running on a MacBook Pro, 2.6 GHz Intel Core 2 Duo.
I'm beginning to suspect that jrun (or some other related software) thinks it's running on a Windows machine, as the only web references I can find mention ntvinv.dll. Any idea what might be going on?
Thanks,
Mark Server Product ColdFusion Version 8,0,1,195765 Edition Developer Serial Number Developer Operating System Mac OS X OS Version 10.5.7 JVM Details Java Version 1.6.0_07 Java Vendor Apple Inc. Java Vendor URL http://www.apple.com/ Java Home /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home Java File Encoding MacRoman Java Default Locale en_US File Separator / Path Separator : Line Separator Chr(10) User Name Mark User Home /Users/Mark User Dir /Applications/ColdFusion8/runtime/bin Java VM Specification Version 1.0 Java VM Specification Vendor Sun Microsystems Inc. Java VM Specification Name Java Virtual Machine Specification Java VM Version 1.6.0_07-b06-57 Java VM Vendor Apple Inc. Java VM Name Java HotSpot(TM) 64-Bit Server VM Java Specification Version 1.6 Java Specification Vendor Sun Microsystems Inc. Java Specification Name Java Platform API Specification Java Class Version 50.0
Mark
Open /Applications/Utilities/Java/Java Preferences.app
Drag and drop the versions and osx adds/removes some aliases/symlinks.
Post a Comment
Recent Entries
- Writing Secure CFML cfObjective 2013 Slides
- Upgrading to Java 7 on Linux
- J2EE Sessions in CF10 Uses Secure Cookies
- Learn about ColdFusion Security at cfObjective 2013
- Session Loss and Session Fixation in ColdFusion
- FuseGuard 2.3 Released
- CKEditor Spell Checker Plugin
- Adobe Says Go Ahead and Upgrade your ColdFusion JVM





