Lucee 5 - class sorcerersisle.cfpassphrase.lucee.PassphraseCheck is invalid or doesn't exist
andrew-dixon opened this issue · 13 comments
@boughtonp - Not sure if this is a Lucee 5 issue, an installation issue on my part or an issue with the way it is implemented not being compatible with Lucee 5 but I've just started to test my application with Lucee 5 and I'm getting the error:
java.lang.ClassNotFoundException
class sorcerersisle.cfpassphrase.lucee.PassphraseCheck is invalid or doesn't exist
What attempting to use the PassphraseCheck function (same for other functions as well). I've played around with the location of the cfpassphrase-v0.1.jar
file and if I put it anywhere other than in the same directory as the lucee.jar
I get a null pointer exception with a very unhelpful error message.
The stack trace Lucee gives me is:
lucee.runtime.exp.NativeException: class sorcerersisle.cfpassphrase.lucee.PassphraseCheck is invalid or doesn't exist at
lucee.commons.lang.PhysicalClassLoader.findClass(PhysicalClassLoader.java:112)at
lucee.commons.lang.PhysicalClassLoader.loadClass(PhysicalClassLoader.java:91)at
lucee.commons.lang.PhysicalClassLoader.loadClass(PhysicalClassLoader.java:78)at
functions.members_cfm$cf.udfCall1(/var/www/html/my.site.com/functions/members.cfm:30)at
functions.members_cfm$cf.udfCall(/var/www/html/my.site.com/functions/members.cfm)at
lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:105)at
lucee.runtime.type.UDFImpl._call(UDFImpl.java:337)at
lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:208)at
lucee.runtime.type.scope.UndefinedImpl.callWithNamedValues(UndefinedImpl.java:779)at
lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:792)at
lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1599)at
login_cfm$cf.call(/var/www/html/my.site.com/login.cfm:6)at
lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:908)at
lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:823)at
lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:818)at
lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:809)at
application_cfc$cf.udfCall(/var/www/html/my.site.com/Application.cfc:68)at
lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:105)at
lucee.runtime.type.UDFImpl._call(UDFImpl.java:337)at
lucee.runtime.type.UDFImpl.call(UDFImpl.java:222)at
lucee.runtime.ComponentImpl._call(ComponentImpl.java:697)at
lucee.runtime.ComponentImpl._call(ComponentImpl.java:580)at
lucee.runtime.ComponentImpl.call(ComponentImpl.java:1902)at
lucee.runtime.listener.ModernAppListener.call(ModernAppListener.java:422)at
lucee.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:223)at
lucee.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:42)at
lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2265)at
lucee.runtime.PageContextImpl._execute(PageContextImpl.java:2257)at
lucee.runtime.PageContextImpl.executeCFML(PageContextImpl.java:2225)at
lucee.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:673)at
lucee.loader.engine.CFMLEngineWrapper.serviceCFML(CFMLEngineWrapper.java:103)at
lucee.loader.servlet.CFMLServlet.service(CFMLServlet.java:62)at
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)at
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)at
org.apache.coyote.ajp.AbstractAjpProcessor.process(AbstractAjpProcessor.java:844)at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)at
org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:2400)at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)at
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)at
java.lang.Thread.run(Thread.java:745) Caused by: java.lang.ClassNotFoundException: class sorcerersisle.cfpassphrase.lucee.PassphraseCheck is invalid or doesn't exist ... 52 more
I'm going to also check with Micha as well and see if he knows what might be going on here. I will let me know if I make any progress, but in the mean time I thought I would let you know incase you had any ideas worth trying.
Looks like it was an installation issue on my part to some degree. The file no longer goes in the same directory as the lucee.jar file however it goes into the {lucee-server}/context/lib
folder instead, similar to the cfpassphrase.fld/tld files do. I guess an update to the wiki installation guide to cover Lucee 5 is all that is required in this case.
Not sure why it's not finding it when in the same directory as lucee.jar - I would expect that to be using the servlet container's classloader (and thus be independent of Lucee version).
My intent was to do the auto-deploy module stuff, which would presumably install to the correct directory, but last time I tried there were issues running Lucee 5 on Jetty, so I never got that far.
@boughtonp I think it is something to do with the change to OSGi as all the JARs are now in a separate folder called "bundles" but only OSGi JARs can be found in this directory.
This is very odd, I've started my test server up again this morning to continue testing and the error has come back. I've confirmed everything is in the same places as it was when it worked last night and everything looks fine. I've also tried moving it and adding it explicitly in the Tomcat classloader, as you suggested, which make perfect sense and still the same error.
you are right, it should work when the jar is next to the lucee.jar or anywhere else in the classpath.
what is "covered" by this testcase, https://github.com/lucee/Lucee/blob/master/test/tickets/LDEV0290.cfc#L33
in fact it is not because line 33 to 38 is disabled to execute on travis because we first have to copy that jar in place before we start lucee, but i just did run that test locally and it was working for me. So somehow your tesctase must look different, question is how?
@micstriit Hmm, that test case however is loading the jar file dynamically in the createObject and I tested it like this and it worked ok… but that is not how Peter’s cfpassphrase works as it adds functions to Lucee directly via the .fld file in the context/library
directory (edited)
You say
anywhere else in the classpath
how do I find old what Lucee thinks the classpath
is?
is it output somewhere, e.g. in the admin?
If you just want it working for now and don't have a bunch of function calls you'd need to update, dynamic JAR loading is a valid route - that is how Coldbox plugin works (via JavaLoader).
Obviously still need to figure out what's up here and fix it properly.
@boughtonp For now I'm just trying to test my site with Lucee 5 so I don't really want to have to update the code if I don't have to, it was more a exercise to test out Lucee 5 and find any possible regressions.
@andrew-dixon no line 33-38 (disabled) is loading from classpath.
anyway, i will do a testcase that defines a class from the classpath in the fld, i will let you know about the outcome. it would be great if you could raise a ticket about this at bug.lucee.org.
Best would be to define your lib as OSGi bundle, then it get's hot deployable and you have no troubles on windows to install/uninstall/update.
I'm still working on the documentation for extensions, so sadly i cannot point to that. But i can show you some example how to do it.
https://github.com/lucee/extension-s3
this could be easy adapted for your implementation, i can help you with that if you like
Bit more digging about on this one. Gone back to having the cfpassphrase-v0.1.jar
in the same directory as the lucee.jar
file and then trying a file with the following in:
<cfscript>
testCFP = createObject("java","sorcerersisle.cfpassphrase.lucee.PassphraseCheck");
dump(testCFP);
</cfscript>
This works and dumps the object out without issue, so Lucee can find the class ok and create the object, however from the custom function I'm still getting:
java.lang.ClassNotFoundException
class sorcerersisle.cfpassphrase.lucee.PassphraseCheck is invalid or doesn't exist
However I've notice that on a second attempt to load the same page I get a slightly different error message:
java.lang.NoClassDefFoundError
sorcerersisle/cfpassphrase/lucee/PassphraseCheck
Not sure what this means but I think it points to a regression in Lucee.
@boughtonp I've converted the JAR to an OSGi bundle and it now works so it is an issue with Lucee that Micha is going to fix, so I will close this here.
Forgot to comes back on this one, was just doing a new installed of Lucee 5 and forgot about an extra step that was required:
- Convert JAR to OSGi bundle
- Change cfPassphrase.fld to include
bundle-name="sorcerersisle.cfpassphrase" bundle-version="0.1"
on each of the<class>
declarations, e.g.:
<class bundle-name="sorcerersisle.cfpassphrase" bundle-version="0.1">sorcerersisle.cfpassphrase.lucee.PassphraseHash</class>
Attaching the bundle file for anyone who needs it:
Note: Github only supports certain file type for attachments, so had to zip, you will need to unzip to get the jar before using it.