Registering Java CFX tags

Hello guys, Lucee newbie here…

Could you please explain how to register a Java CFX tag?

I would like to register a CFX tag that is supposed to do the same thing as the cfx_helloworld tag just for testing purposes. I downloaded my lucee-5.3.4.80.jar from /opt/lucee/lib, opened it and put my java class in the same folder where the exemplary HelloWorld.class is located (lucee/cfx/example) and made a .jar file again, uploaded it to /opt/lib/lucee and restarted lucee. When I try to register my tag through the Lucee admin I get an error:
cannot load class through its string name, because no definition for the class with the specified name [lucee.cfx.example.MyHelloColdFusion] could be found caused by (java.lang.ClassNotFoundException:lucee.cfx.example.MyHelloColdFusion not found by lucee.core [46];java.lang.ClassNotFoundException:lucee.cfx.example.MyHelloColdFusion;

What am I doing wrong?

Thanks in advance.

Hi @MeteorMonkey!

Please, look at to “javaSettings” for Application.cfc

https://lucee.daemonite.io/t/where-to-add-jar-file-to-express-install/3257

this help you?

Did you also try the lucee lib directory inside the the web-inf folder (of the same web context you are logging in into admin)?

Hi Roberto, thank you for your reply, I read about this.javasettings and learned something new…
However, the javasettings atribute as far as I understand is used for the scope of an application.
What I am interested in is registering a Java CFX tag that can be used in any application on the server just like the <cfx_helloworld> tag under the “Archives and resources” section of Lucee admin.
The HelloWorld.class that is used there and associated with the <cfx_helloworld> tag (lucee.cfx.example.HelloWorld) is located in the a .jar file (/opt/lucee/lib/lucee-5.3.4.80.jar).

I want to register my java cfx tag called <cfx_myhellocoldfusion> so I unpacked the lucee-5.3.4.80.jar,
compiled my java code and made the MyHelloColdfusion.class and then put it in the same folder as the already mentioned HelloWorld.class (lucee\cfx\example) and then made a 5.3.4.80.jar file again, uploaded it to my server at /opt/lucee/lib and restarted the Lucee server. Then, under “Archives and resources” when I try to register and save my <cfx_myhellocoldfusion> tag I get the error mentioned in the original post.

Here is the java code that compiles to MyHelloColdfusion.class:

import com.allaire.cfx.* ;

public class MyHelloColdFusion implements CustomTag {
public void processRequest( Request request, Response response )
throws Exception {
String strName = request.getAttribute( “NAME” ) ;
response.write( "Hello, " + strName ) ;
}
}

Here is the command I used to create the lucee-5.3.4.80.jar file:
“C:\Program Files\Java\jdk-16.0.1\bin\jar.exe” cf lucee-5.3.4.80.jar paket

So why then do I get the error? Do you maybe know of or have some documentation regarding registering java CFX tags in LUcee, I didn’t find anything useful online…

Sorry for the wall of text, I hope I was clear in explaining everything and a big thank you!

Hi Andreas, thank you for replying.

I did try the adding my .jar file in the /web-inf/lucee/lib folder but it didn’t work.
I want to be able to call my java CFX tag from all applications, I don’t want the scope of it to be only one application if that is possible.

Do you maybe know of or have some documentation regarding registering java CFX tags in Lucee, I didn’t find anything useful online…

you don’t need to unpack the lucee jar etc, your java cfx class can be in a standalone jar

We’re you ever able to figure this out? I also have a CFX tag that I need to get set up for all applications on the server.

Hey, I did.

In the Lucee administrator, under Archives & Resources - CFX tags I tried registering the name of the CFX tag like this: “<cfx_example>”. This was wrong, you should just type “example”.

I hope you figured everything out!

Thanks for your response.

I never had any luck, so we changed our code to not use that tag anymore.