Where to place 3rd party jars?

Where do I have to place 3rd party jars?

Since Lucee 5.2.4.37+ I can’t place them anymore in /opt/lucee/lib . By doing this the WEB-INF folder of new domains isn’t created without failures.

The Lucee 4.5 way isn’t working:

If I place the 3rd party jars in the domain’s WEB-INF/lucee/lib folder, the jar files aren’t found. I get an error message with the hint:

[...]
Caused by: java.io.FileNotFoundException: /opt/lucee/lib/[filename].jar (file or directory not found)

Christoph

To answer my own question: It worked, after a server reboot.

The jars in the domain’s WEB-INF/lucee/lib folder were found.

Christoph

Hi @Christoph_Kindle.

Have you tried using the javaSettings within application.cfc to specify a path from which to load Java libraries.

Some information can be found here on this:
https://rorylaitila.gitbooks.io/lucee/content/calling_java_from_lucee.html

Instantiating third party Java libraries
In order to use third party java libraries, Lucee must be able to find them. Like any Java application, Lucee will load any java libraries on the classpath, but Lucee also supports dynamically loading libraries at runtime.

I have not tried using it, but it may work for you without having to add things into the WEB-INF folder.

1 Like

Hello @martin

I didn’t know this. Thank you for the information, I think I will try this for my application.

Christoph

Did you have to do a full server reboot, or just a Lucee restart?

I’m having the same trouble loading FTP4j-1.7.2.jar. I’ve put it in the /lucee/lib file and tried every combination I can think of in boath javasettings loadpath’s and createObject calls. Total fubar.

Never mind, I was able to finally dial in the right combination.

I was able to load the ftp4j-1.7.2.jar file by placing it in the C:\lucee\tomcat\webapps\ROOT\WEB-INF\lucee\lib\ directory, and in a cfscript I put:

ftpClient = CreateObject(“java”,“it.sauronsoftware.ftp4j.FTPClient”, “C:/lucee/tomcat/webapps/ROOT/WEB-INF/lucee/lib/ftp4j.jar”).init();

Voila! A simple dump(ftpClient); after that gave me access to all the PEM’s.

I did NOT need to load the java classpaths in Application.cfc either, which was good because this is only used by less than one percent of the application and only by certain people, so I didn’t need to add to the memory usage for the rest of the community.

Thanks to this forum I was able to piece together the solution. Gracias!

Great! Glad that you could solve it!

1 Like

Quick q, any reason you’re not using the built in FTP support?

1 Like

Yes – built in does not support TLS and I have a couple customers still using that technology, so I reached back to this 2012 JAR file for the solution. Haven’t finished development yet so not totally sure it will solve the problem, but the docs and stackoverflow responses all say it will.

Thanks, good to know, I’ll add it to my to-do list

So far all other functionality looks good, but I’m getting an odd message when I try to connect to a TLS server:

PKIX path building failed: sun.security.provider.certpath.SunCertPathBulderException: unable to find valid certification path to requested target

so not sure if that’s on the client end or my end.

Which version of Lucee are you using?

You could try

It turns out that if you have access to the Lucee admin, it’s very simple to just use the SSL Cert option from the menu, enter the client url and click install. Quite simple.

This class I’m using, though, wants file names created from java.io.file, but I don’t have access to a java.io class and cannot find where to download one. If it’s in Lucee, it’s not apparent to me.

Oh, I take that back. createObject(“java”,“java.io.File”) works just fine. First time I tried that I left off the “File” at the end and screwed myself up.