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;
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:
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!
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…
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”.
This is a little late but I recently ran into this same issue and this post is one of the top results from google when searching for problems with Lucee and cfx.
I finally got our cfx tag to work in both Lucee 5 and 6. They both have the same solution.
I was placing our .jar files in various /lib folders people were saying to and also kept getting the ClassNotFoundException but discovered that placing them in the {lucee-root}\lucee-server\context\lib solved the error but then kept getting a new error. The message “com\allaire\cfx\CustomTag” error.
Through lots trial and error I finally discovered by placing our CFX jar file in {lucee-root}\lib\ext folder (the same as lucee.jar is located) I was finally able to register the cfx tag in the Lucee Admin CFX tags. But then doing a verify got a class not found error based on another jar library dependency. So I had to place this 3rd party library in the same {lucee-root}\lib\ext folder. It was not enough to have in a different class path directory.
When naming the cfx tag you can use <cfx_{name}> if you want too or not and just use the basic name. Lucee Admin has code the removes ‘<cfx_’ and ‘>’ from the name when it registers the cfx tag.