I’ve running this sample in Wildfly-26.1.13.Final with Lucee-5.3.10.97 and it errors out by saying Caused by: java.lang.NoClassDefFoundError: com/accela/security/taglib/TestTag.
For a more detailed log which could bring some ideas -
My question is - why Lucee is looking for the Tag Class in lucee\cfclasses folder instead of the lib folder. Is there a way to specify the Tag Classes’ Location? because typically our classes are in lib\jars.
Spark, you don’t say exactly which lib folder you’ve put the jar in. Since one can install or implement lucee many ways, the location(s) which would work can vary.
Further, you say you put it in a jars folder under that. What if you put it in the lib, rather than lib/jars? Restart lucee if you try that.
If that still doesn’t work, in your lucee deployment, find the WEB-INF/lib folder and place the jar there and try that (with a lucee restart).
Finally, as another check (even if was not needed with CF), try changing the cfimport taglib=“/WEB-INF/tld/security.tld” to name the taglib as /WEB-INF/lib/your.jar, naming your jar (and restart lucee). And put the tld in the same folder as the jar. Then restart and test.
I’m not saying these things because I have confirmed jsp custom tags work in Lucee (though I had used and written about using them with CF about 20 years ago…but they never seemed to take off). I’m also not saying you MUST do things this way for them to work in Lucee, let alone that you will “have to change all your references to work this way”.
I’m just trying to help you think through some options to consider…and I’m writing this on a phone, so not testing them first. If we find what works, THEN we can maybe figure why that was needed and whether something could be done to avoid you having to change a lot of code (if you would have to).
Or maybe someone with more specific lucee experience with jsp custom tags will offer something.
Thanks for your reply and sorry I didn’t make myself more clear on the class/lib path.
The lib path I am referring is the WEB-INF/lib.
The current test I am doing is - deploy the lucee-5.3.10.97.war to a Wildfly Server. Also tried with Lucee-Express.
And I am able to use createObject to create that JSP Tag Class, which means in some way the tag class is available in Lucee classpath.
Meanwhile, this works fine with both CodeFusion-7.2.0 and Railo-3.1.8, since I am migrating the project from CF&Railo to Lucee.
Anyone has any other ideas on this? This is not working for me and it appears to me that the <cfimport taglib JSP tags is not working properly with Lucee classpath.
I figured <cfimport is at compile time, which I don’t know how Lucee could work with Java JSP Tag Classes since they are already in the jar and not compiled the same as cfm during Lucee start up.
While you await any ideas from others, had you tried my second one: “try changing the cfimport taglib=“/WEB-INF/tld/security.tld” to name the taglib as /WEB-INF/lib/your.jar, naming your jar (and restart lucee). And put the tld in the same folder as the jar. Then restart and test.”
Hey carehart, I’ve tried every possible way of using taglib with cfimport. Like I said, it is not working with <cfimport taglib, but it is working with createObject.
To be clear, I have tried all your ideas in your last comment and no luck.
And the Lucee is looking for the Tag Class in lucee\cfclasses folder. Also when I manually place the tag class in that lucee\cfclasses folder, it is able to find the class, but it throws Class Cast Exception with the same class name.
I had an java.lang.NoClassDefFoundError once and it was due to a missing dependency in the specific jar that I was trying to load. Are you sure you have uploaded all needed dependencies?
Hi carehart, this issue is blocking me for a while. Could you try using this tag.jar and test on your end? The tag code basically comes from here - Example of JSP Custom Tag - javatpoint tag.jar (1.8 KB)
By using below code, I am having the issue posted -
Thanks for your reply. I tested both Lucee Express and Wildfly with Lucee WAR and I am pretty sure that JSP is working fine in the environment. And also, JSP Tags inside JSP files are working fine as well. It only breaks when using it in CFMX. There could be a dependency that I am lacking, but it’s kind hard for me to find it.
Lucee Express stacktrace -
Caused by: java.lang.NoClassDefFoundError: com/javatpoint/sonoo/MyTagHandler
... 36 more
Caused by: java.lang.ClassNotFoundException: Class [com.javatpoint.sonoo.MyTagHandler] is invalid or doesn't exist
at lucee.commons.lang.PhysicalClassLoader.findClass(PhysicalClassLoader.java:163)
at lucee.commons.lang.PhysicalClassLoader.loadClass(PhysicalClassLoader.java:144)
at lucee.commons.lang.PhysicalClassLoader.loadClass(PhysicalClassLoader.java:127)
at lucee.commons.lang.PhysicalClassLoader.loadClass(PhysicalClassLoader.java:121)
... 36 more
Caused by: java.nio.file.NoSuchFileException: C:\Users\sou\Downloads\lucee-express-5.3.10.97\webapps\ROOT\WEB-INF\lucee\cfclasses\CFC__Users_sou_Downloads_lucee_express_5_3_10_97_webapps_ROOT22590\com\javatpoint\sonoo\MyTagHandler.class
at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:230)
at java.nio.file.Files.newByteChannel(Files.java:361)
at java.nio.file.Files.newByteChannel(Files.java:407)
at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384)
at java.nio.file.Files.newInputStream(Files.java:152)
at lucee.commons.io.res.type.file.FileResource.getInputStream(FileResource.java:243)
at lucee.commons.io.IOUtil.copy(IOUtil.java:190)
at lucee.commons.lang.PhysicalClassLoader.findClass(PhysicalClassLoader.java:159)