Web Services Problems with ColdFusion 8 on a Mac
August 16, 2007
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()>
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:
sudo rm CurrentJDK
sudo ln -s 1.6 CurrentJDK
To make sure it's working run the following:
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
Finally just start or restart ColdFusion, and you should be able to invoke web services.
Trackback Address: 652/D4DBD5D8703AA589BCC08DCD71DFF561
WHen I tried this -I got an error when I used
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.
Just to point out that
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).
Ok, I honestly don't get your first paragraph there. DP?
But - I started CF, went to settings, and saw 1.6 there. So I'm assuming I'm good to go.
@Sean - you're right doing the java -version is not a valid test to see if the JDK was changed, I will update my blog entry to use ./CurrentJDK/Home/bin/java -version instead
@Ray - DP stands for developer preview. Did you try running the web service example?
Hmm...haven't been able to duplicate the problem. I am running the following:
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?
Just to point out the obvious: Apple JDK 1.6 is not final and not on our supported system requirements list (Apple JDK 1.5 is).
@Robert Yes, I'm using JRun
@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)
I would bet it is more Jrun related than the JRE. Not to get off topic....but, what are the chances I can convince you other mac users to start using JBoss? No installs needed, just drag and drop! Need it on another machine...drag and drop. Works great!
@Robert, the CF8 install with JBoss is a lot more work than the CF8 install with JRun. JRun / CF8 work together to allow multiple instances / clustering, all auto-managed via the JRun / CF8 admin consoles. JRun allows you to have your webroot outside the JRun install tree (no one has ever been able to show me a way to make that work with JBoss).
For localhost development, I would never recommend the JBoss route - and I've worked with JBoss in production systems quite a bit.
I blogged about this a while back. http://coldfused.blogspot.com/2007/08/coldfusion-and-webservice-file-has.html
If you want to use JDK1.5, you would need to replace lib/tools.jar with 1.5's tools.jar.
Thanks! I am about 1 week away from having this very same problem. My new MacBookPro is on order. You saved me hours in trying to figure this one out. Thanks again!
I'll back up Robert on this one Sean. Jboss is incredibly easy to use for a development environment. Drop jboss somewhere, drop the cfusion.war in the deploy and you're done. If you want your root outside the jboss install tree edit the tomcat server.xml and add a mapping to your context root. I'm not doing this right now but someone else on my team is and it seems to work. You can also use mod_jk to connect to Apache (like Bob is doing) and then point multiple Virtual Apache servers inside the single war deploy so you don't have to run multiple wars.
I was thinking a bit more about why some folks didn't have this problem running on other J2EE servers, and I think it is probably due to the classloaders (which is also why I had to delete tools.jar, and it worked fine). To fix this problem all I probably had to do was remove tools.jar, since I think they are part of the classpath by default on Mac (it's in classes.jar I think).
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.
@Adam, I'm sorry dude but you cannot convince me that all that downloading, unzipping, copying / moving files and manually editing httpd.conf for mod_jk etc is easier than double-clicking the CF8 installer and having it do everything for you.
The multiserver instance management built into CF is great - something you lose with JBoss.
I posted about the same issue on 8/1, on both my blog and macromedia forums - no response. It forced me to go back to 7.
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.
@Mark, I dont understand why this made you go back to 7? Doesn't replacing tools.jar work for you? CF ships with tools.jar that is compatible with the JVM that we ship(1.6). And we clearly document that in case you use any other JVM, you should replace tools.jar with the appropriate version.
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.
Pete, I just downgraded to Java 5 - see my blog post on the class loading issue - and I have no problem running that web service code.
If you don't mind my bringing up a different web service issue, I installed CF8 on a 10.5.5 system, installed Dreamweaver, and am trying to execute the following:
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?
Ok, I know this is about a year later for this post but I cannot get CF8 to register or use webservices. I've tried several different ones that I am able to display using a browser and a SOAP client so I know they are good. Any help would be appreciated. Below is my environment and settings
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
Oops, forgot to subscribe to the thread. Thanks to anyone out there who can help!
on a mac, to get: java -version producing the same as: ./CurrentJDK/Home/bin/java -version or ./Current/Home/bin/java -version
Open /Applications/Utilities/Java/Java Preferences.app
Drag and drop the versions and osx adds/removes some aliases/symlinks.
I just has this problem.My environment such as JDK1.6,Tomcat5.0.28 and Myeclipse6.5. Could somebody help me? And my e-mail is firstname.lastname@example.org.The problem as:[org.apache.jasper.compiler.Compiler]-[ERROR] Javac exception Error starting modern compiler at org.apache.tools.ant.taskdefs.compilers.Javac13.execute(Javac13.java:69) at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:942) at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:764) at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:382) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:472) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:451) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:439) at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at com.thunisoft.summer.web.filter.UserAASFilter.doFilter(UserAASFilter.java:77) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at com.thunisoft.summer.web.filter.CharsetFilter.doFilter(CharsetFilter.java:48) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.tools.ant.taskdefs.compilers.Javac13.execute(Javac13.java:61) ... 41 more Caused by: java.lang.NoClassDefFoundError: javax/tools/StandardJavaFileManager