Lucee jar problem (NoClassDefFoundError)

Hey everyone,

We have been developing with Lucee for a year now and in general it works very nice. I’ve to say that sometimes it’s difficult to find some documentation related to software in Lucee. But now for the problem we are having.

We try to convert Docx to PDF. We didn’t find any tags inside coldfusion/lucee that could do this. So the next solution is to have a JAR file that can be called inside Lucee. In the past we have used Docx4j within Coldfusion. This worked good, but also a lot of trouble to get it working. And newer versions didn’t work.

Now we use Lucee and I get problem after problem. For now I will talk about the first thing I tried and really want to get working inside Lucee.

I’ve found a library here:

This is a simple library that combines other librarys to get a good conversion to PDF. It can also work as a standalone version through windows console. THIS WORKS. I can fire a windows console command and it automatically converts a Docx to PDF.

So the next step is to get it to work inside Lucee. I’ve add the jar file inside: “WEB-INF\lucee\lib”. If I go to the Lucee admin I can see that the jar file is “Active” (green). So it all looks OK. But when I try to call the function with the following code inside a cfscript tag:

    temp_File = createObject("java","");
	temp_FileInputStream = createObject("java","");
	temp_FileOutputStream = createObject("java","");
	temp_Converter = createObject("java","com.yeokhengmeng.docstopdfconverter.DocxToPDFConverter");

	input_stream = javacast("", temp_FileInputStream.init(temp_File.init("C:\conversie_diva_part2.docx")));
	output_stream = javacast("", temp_FileOutputStream.init(temp_File.init("C:\conversie_diva_part2.pdf")));


The last line gives an error. A “NoClassDefFoundError” error. I think this comes from a import inside a indirect class. But I’ve tried so many libraries / codes and everytime it gives an error like this. I’ve add so many dependencies (different versions etc) but always this error. Also something I find weird is that the jar file works on itself (all dependencies are inside) but not through Lucee.

So I think something is wrong with our Lucee / Java environment. But how can I know this? I would be very grateful if somebody can take a look at this and send me in a direction to do some tests. I’ve also tried jars/code from a working coldfusion page, but that doesn’t work either. And with the errors I get I cannot do much. I want to know what is failing because we want to continue working with Lucee.

I’ve upgrade Lucee to latest version. Test many jar versions. Read a lot of posts of other users. But nothing works for us. Please help if you have any idea.

Thank you in advance,


This is btw the full stack trace of the error we got

lucee.runtime.exp.NativeException: org/apache/poi/xwpf/converter/core/Options at
 java.lang.Class.getDeclaredConstructors0(Native Method) at
 java.lang.Class.privateGetDeclaredConstructors( at
 java.lang.Class.getConstructors( at at at lucee.runtime.reflection.Reflector.getConstructorInstance( at lucee.runtime.reflection.Reflector.getConstructorInstance( at lucee.runtime.reflection.Reflector.callConstructor( at at at at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues( at lucee.runtime.PageContextImpl.getFunction( at views.instellingen.default_cfm$ at lucee.runtime.PageContextImpl._doInclude( at lucee.runtime.PageContextImpl._doInclude( at lucee.runtime.PageContextImpl.doInclude( at framework.one_cfc$cf.udfCallb(/framework/one.cfc:1877) at framework.one_cfc$cf.udfCall(/framework/one.cfc) at lucee.runtime.type.UDFImpl.implementation( at lucee.runtime.type.UDFImpl._call( at at at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues( at lucee.runtime.PageContextImpl.getFunction( at framework.one_cfc$cf.udfCall5(/framework/one.cfc:870) at framework.one_cfc$cf.udfCall(/framework/one.cfc) at lucee.runtime.type.UDFImpl.implementation( at lucee.runtime.type.UDFImpl._call( at at lucee.runtime.ComponentImpl._call( at lucee.runtime.ComponentImpl._call( at at at lucee.runtime.listener.ModernAppListener._onRequest( at lucee.runtime.listener.MixedAppListener.onRequest( at lucee.runtime.PageContextImpl.execute( at lucee.runtime.PageContextImpl._execute( at lucee.runtime.PageContextImpl.executeCFML( at lucee.runtime.engine.Request.exe( at lucee.runtime.engine.CFMLEngineImpl._service( at lucee.runtime.engine.CFMLEngineImpl.serviceCFML( at lucee.loader.engine.CFMLEngineWrapper.serviceCFML( at lucee.loader.servlet.CFMLServlet.service( at javax.servlet.http.HttpServlet.service( at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter( at org.apache.catalina.core.ApplicationFilterChain.doFilter( at org.apache.tomcat.websocket.server.WsFilter.doFilter( at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter( at org.apache.catalina.core.ApplicationFilterChain.doFilter( at org.apache.catalina.core.StandardWrapperValve.invoke( at org.apache.catalina.core.StandardContextValve.invoke( at org.apache.catalina.authenticator.AuthenticatorBase.invoke( at org.apache.catalina.core.StandardHostValve.invoke( at org.apache.catalina.valves.ErrorReportValve.invoke( at org.apache.catalina.core.StandardEngineValve.invoke( at org.apache.catalina.connector.CoyoteAdapter.service( at org.apache.coyote.ajp.AbstractAjpProcessor.process( at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process( at$SocketProcessor.doRun( at$ at java.util.concurrent.ThreadPoolExecutor.runWorker( at java.util.concurrent.ThreadPoolExecutor$ at org.apache.tomcat.util.threads.TaskThread$ at Caused by: java.lang.NoClassDefFoundError: org/apache/poi/xwpf/converter/core/Options ... 65 more Caused by: java.lang.ClassNotFoundException: org.apache.poi.xwpf.converter.core.Options not found by [79] at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation( at org.apache.felix.framework.BundleWiringImpl.access$200( at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass( at java.lang.ClassLoader.loadClass( ... 65 more

did you try passing in an array of paths to the jars required as the third argument?


[’.\libs\jar1.jar’, ‘.\libs\jar2.jar’]);


Thanks for the quick reply! I will try this immediately.

But for you information. Isn’t it enough that the libraries are imported inside the class file?

Like: import org.apache.poi.xwpf.usermodel.XWPFDocument;


it’s depends, usually if you look at a java examples, it will often import a range of classes

for example with that class, here is a example

see all the imports required for this example? you need them too

you may have a poi jar bundle which has them all, but if not… you’ll get the error

If I understand you correctly then you explain that you need to have all the jar files which are used as import. That I understand, those are all the dependencies. The library I’m using is 1 jar file. It contains a lot of jar files inside. See following image:

(Note that not all jar files could fit inside the image)

I even tried to remove all the jar files inside and add them separately. Still get the same error then.

What I think the problem is, is that indirect import of libraries doesn’t work with Lucee.

But how can I confirm what the problem is, this is so difficult to grasp.

BTW I tried to add the third parameter but still gives me the same error. Perhaps because now all the jar files are inside again. So perhaps if I remove them from the jar file and then add al the 30 or so jar files as a parameter, maybe then it works. But still inside the classes a import is used. So if this gives an error then this wont go away.

But I can’t be the only one trying to get a jar file with imports to work.

So hope you can shine some light on this, thanks!

can you post a link to the actual library? I’m sure somebody can point you in the right direction

Yes I already did in my first post, but here it is again:


Hi @DrunkenMoose,
i tested the library and it worked fine for me.

How did you compile the project? (i had to add some build-properties to the pom.xml)
After compiling i received a jar with about ~ 50MB.
I placed it in tomcat\lucee-server\context\lib, to test it fast.

Here is also the code which i used to test:

	testFile = ExpandPath("test.docx");
	testOutFile = ExpandPath("test.pdf");
	temp_File = createObject("java","");
	temp_FileInputStream = createObject("java","");
	temp_FileOutputStream = createObject("java","");
	temp_Converter = createObject("java","com.yeokhengmeng.docstopdfconverter.DocxToPDFConverter");
	input_stream = javacast("", temp_FileInputStream.init(temp_File.init(testFile)));
	output_stream = javacast("", temp_FileOutputStream.init(temp_File.init(testOutFile)));
	temp_Converter.init(input_stream, output_stream, true, true);

I guess you have a compiling problem. Your jar dont seem to contain all Classes/Librarys.
If you want i can upload my compiled version of the library.

1 Like

Wow David many thanks for taking a look at it. I’m currently not at home so I cannot take a look at it now. But when I get home I will immidiatly take a look. If you could upload your compiled library somewhere then that would be very helpfull. I have to say your code looks exactly like a test I did so it must be the library.

Many thanks again! If it works I will update this post for everybody to see!

I dont know how you builded the jar, but i used Idea and added build-nodes to the pom.
I compiled with Java 1.8, i dont know if you will face some issues here, because the ReadMe says its not tested. (But my testcase worked fine)
Anyway, here is the Link to the compiled version:

Yes i took your code(its not wrong) and just looked at the Java-Class and adjusted to get it running.


You are correct.

When you try to load a class that is not in the classpath yourself, you get a ClassNotFoundException.

When you get the NoClassDefFoundError, it means that the class that you are trying to load yourself is found, but it has a dependency on a class that is not found.

1 Like

could that error message message be improved to reflect(sic) that? that’s quite a good explanation

It’s a Java thing, not a Lucee thing:

See also

Hey everybody,

Thanks for all the info on the subject. Indeed this error gave me an idea that something is not going right with the dependencies, but the weird thing is that I could find the class related to the error inside the jar file. I even included the jar file on it own, but still gave me the same error.

But then I did the following step and a miracle happend:

  • Removed all jar files from lib folder
  • Downloaded and placed the given jar file from David inside lib folder
  • Restarted the Lucee service through windows
  • Restarted Lucee inside admin page
  • Made page with given code by David.
  • Placed test.docx inside root folder of website (because of expandpath)
  • Called the page and tada a beautiful PDF came out. Also damn fast.

So thanks to David for your work .If I could give some bucks worth a coffee then give me link (Paypal please)! Just little thanks for the trouble. Now I know the library worked and Lucee also works so that’s a relieve. I can also inspect this Jar file for more clues on how it works correctly and what went wrong.



And an other thing: If I compare my old jar file and yours then I see a lot of files missing. I do have class files with the folder names: “com”, “META-INF”, “org”, “src”, and other than that a lot of jar files. But nothing else.

You where talking about it not being compiled. This may sound as a stupid question: but I should have compiled the jar file through eclipse (or maybe even windows console?) before trying to use it inside Lucee? It’s just the way how I downloaded it from github. Thought it should work as is, because the windows console version of this jar file did work for me. Just not calling it through cfscript. Still sorta searching my way through all of this. Is there maybe a Lucee page explaining Jar files that I have missed? Or is it more of a Java thing, separate from Lucee? Still many thanks!

maybe the documentation could be improved as @DrunkenMoose noted he struggled to find
documentation which helped him with this process?

Nice that i could help and its working now for you :slight_smile:

I dont know how they compiled their jar (which you find under github -> releases), but i think thats not a standard way to package/compile a jar. I guess Lucee cant handle jar in jar-files. In my compiled jar, you find all dependencies compiled as classes and not as a jar.
Maybe thats the problem, but i dont know exactly.

1 Like