CFFILE "Upload" action resulting in "NoClassDefFoundError"

I had a form image uploader that was working just fine. (CFFILE action=“upload” …)

Then, I upgraded to 5.3.2.77 (ICO and JAR files)

Now I get this error when I attempt to upload a file:

Type of error :
java.lang.NoClassDefFoundError

Diagnostic message :
Could not initialize class org.apache.tika.mime.MimeTypesReader

Is there a fix for this? Or should I just rollback to 5.2.1.9 (last time it was working) ?

NOTE: Upgrading to 5.3.3.62 does not fix the issue either.

does it happen with the latest snapshot 5.3.5.5?

I’ve checked this with latest lucee 5.3.5.5-SNAPSHOT and your affected version 5.3.277 also. But, can’t able to reproduce the error. CFFILE action=“upload” working fine for me.

I tested a testcase according below testcase.

<form name="myUpload" method="post" enctype="multipart/form-data"> 
   <input type="file" name="fileData">
   <input type="submit" name="submit"> 
</form> 
<cfif structKeyExists(form,"submit")>
	<cffile action="upload" destination="#expandpath('./upload/')#" filefield="form.filedata" result="uploadfile" nameconflict="overwrite">
	<cfdump var="#uploadfile#" />
</cfif>

Could you please test with this example?

To the OP (fs), do you have attributes other than what cfmitrah shows? For instance the accept or strict attributes? If so, what are their values?

I ask because the error refers to mime types, which are checked during the cffile upload process. If his simpler test works (or you remove those other attributes in your code), the question then is what’s wrong about them. Show us your values.

It may also help to offer a file you are uploading that fails, if it’s safe for you to share.

Finally, if none of that helps, try doing a cfabort at the top of the page. Does the error still happen? If so, then it’s not about the cffile upload itself (which moves the uploaded file to the named destination), but instead about the engine processing receipt of the file, which happens before any cfml code runs. That’s a surprise to some folks, that in fact any cfm page that has a file posted to it will have that file saved in a temp dir, until it’s moved (not “received”) by the cffile upload" or it will be deleted automatically at the end of the request.

/charlie

First, I tried with Charlie’s suggestion of putting the at the top of the action page. That resulted in no error.

Next I put the code that “cfmitrah” put in place. Same exact error.

I do not have the latest snapshot in place. I guess I can try that.

NOTE: I did update to 5.3.3.62 (ICO & JAR) and, I got the same results.

I am using PNG and JPG files that I got off Google Images. I have tried 4 different images.

I just installed the 5.3.5.5 Snapshot (ICO and JAR).

NOTE: The 5.3.5.5-SNAPSHOT.ico file is 0 KB.

I still get the same error when attempting to upload a file.

It looks like this same issue was reported back in 2016.

https://luceeserver.atlassian.net/browse/LDEV-939?page=com.atlassian.jira.plugin.system.issuetabpanels%3Aall-tabpanel

I’m not sure if it is a Lucee issue…or do I need to update Apache/TomCat on my server. Or possibly a missing library item?

I also wonder if it could be a missing class definition for mime types inside of the “TIKA” library. I’m not much of an infrastructure guy, so a lot of these solutions are beyond me right now. I could ask another infrastructure management expert to look at it if I knew the right questions to ask.

We are on a Linux server.

@fs8972, Could you please share your test case if possible. It’ll use to reproduce the exact error.

Sure thing.

Form submission page:

<form action="action.cfm" name="myUpload" method="post" enctype="multipart/form-data"> 
   <input type="file" name="fileData">
   <input type="submit" name="submit"> 
</form>

…at top of “action.cfm” page:

<cfif structKeyExists(form,"submit")>
	<cffile action="upload" destination="{ hardcoded path to storage directory }" filefield="form.filedata" result="uploadfile" nameconflict="overwrite">
	<cfdump var="#uploadfile#" />
</cfif>
<cfabort>

I used this image to upload:

Our Server: Linux / Apache / Tomcat
Lucee: 5.3.3.62 (with lucee-5.3.5.5-SNAPSHOT.jar)

cfmitrah,

Were you able to reproduce the issue using my test case?

By the way, I installed the 5.3.5.8 snapshot, and the issue still persists.

Let me know if you think I need to roll back my version of Lucee, or if there is something missing within Apache possibly.

@fs8972,

Yes. I’ve checked with your test case. Sorry, still doesn’t get any error.
What is your JVM version and Apache Tomcat version? Please share with here.
I think, maybe that is the reason for throwing an error.

Here is the information you requested.

Tomcat:

Server version: Apache Tomcat/8.5.14
Server built: Apr 13 2017 12:55:45 UTC
Server number: 8.5.14.0
OS Name: Linux
OS Version: 3.10.0-693.5.2.el7.x86_64
Architecture: amd64
JVM Version: 1.8.0_144-b01
JVM Vendor: Oracle Corporation

Java:

java version “1.8.0_144”
Java™ SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot™ 64-Bit Server VM (build 25.144-b01, mixed mode)

Thanks for your assistance.

wanna try updating your java version? 1.8.0_144-b01 is ancient

1 Like

@fs8972, Did you check with as per Zac’s comment?

Yes, I have put in a request with our infrastructure guy to have java updated on the server. It might be a few days before I hear back from him.