tracker issue : CF-4203234

select a category, or use search below
(searches all categories and all time range)

ColdFusion application throws Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/cache/CacheLoader

| View in Tracker

Status/Resolution/Reason: To Track//PRNeedInfo

Reporter/Name(from Bugbase): A. Bakia / ()

Created: 08/05/2018

Components: Java Integration

Versions: 13.0

Failure Type: Others

Found In Build/Fixed In Build: 2018,0,01,308605 /

Priority/Frequency: Normal /

Locale/System: / Windows 7 SP1 64-bit

Vote Count: 0

Problem Description: 
I wrote a Java file to read a CFC wriiten in CFML. You can find both the Java file and CFC in the ColdFusion documentation:

The Java file compiled. However, when I run it, without any arguments, I get the exception java.lang.NoClassDefFoundError: com/google/common/cache/CacheLoader

Steps to Reproduce:
1. I navigated on the command line to the location of the Java file (attached). Then I compiled it as follows, using the default JDK 8 installed on my Windows machine (jdk1.8.0_181):

javac -cp C:/ColdFusion2018/cfusion/lib/cfusion.jar;C:/ColdFusion2018/cfusion/runtime/lib/servlet-api.jar;C:/ColdFusion2018/cfusion/runtime/lib/jsp-api.jar;

The file duly compiled, resulting in CFCInvoker.class

2. I ran the class file using the command,

java -cp C:/ColdFusion2018/cfusion/lib/cfusion.jar;C:/ColdFusion2018/cfusion/runtime/lib/servlet-api.jar;C:/ColdFusion2018/cfusion/runtime/lib/jsp-api.jar;. CFCInvoker

Actual Result: 
I get the error, Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/cache/CacheLoader (see stacktrace attached)

Expected Result:
No such error

Any Workarounds:



Hi Bakia, Will you try compilation by adding another jar C:\ColdFusion2018\cfusion\lib\closure-compiler.jar and see if this works for you? Thanks Poonam
Comment by Poonam Jain
29530 | August 17, 2018 10:01:50 AM GMT
Hi Poonam, Thanks for your suggestion. I can indeed see that closure-compiler.jar contains com/google/common/cache/CacheLoader.class. When I run the Java class as before I no longer get the NoClassDefFoundError. Instead I get the following exception, but that is a different issue coldfusion.server.ServiceFactory$ServiceNotAvailableException: The Runtime service is not available. at coldfusion.server.ServiceFactory.getRuntimeService( at coldfusion.cfc.CFCProxy.<init>( at coldfusion.cfc.CFCProxy.<init>( at CFCInvoker.directInvoke( at CFCInvoker.main( Regards, Bakia
Comment by A. Bakia
29544 | August 19, 2018 10:51:51 AM GMT