Unresolved constraint in bundle org.apache.commons.validator [76] error

Hi,

I tried to use commons validator jar in Lucee 5.2.7.63

in admin UI it looks like it is loaded

however, when I try

createobject(‘java’, ‘org.apache.commons.validator.routines.UrlValidator’, ‘org.apache.commons.validator’, ‘1.6.0’);

it throws

Unresolved constraint in bundle org.apache.commons.validator [76]: Unable to resolve 76.0: missing requirement [76.0] osgi.wiring.package; (osgi.wiring.package=org.apache.commons.beanutils)

Stacktrace

lucee.runtime.exp.NativeException: Unresolved constraint in bundle org.apache.commons.validator [76]: Unable to resolve 76.0: missing requirement [76.0] osgi.wiring.package; (osgi.wiring.package=org.apache.commons.beanutils) at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4097) at org.apache.felix.framework.Felix.startBundle(Felix.java:2114) at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:977) at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:964) at lucee.loader.osgi.BundleUtil.start(BundleUtil.java:135) at lucee.loader.osgi.BundleUtil.start(BundleUtil.java:133) at lucee.runtime.osgi.OSGiUtil._start(OSGiUtil.java:1093) at lucee.runtime.osgi.OSGiUtil._startIfNecessary(OSGiUtil.java:1053) at lucee.runtime.osgi.OSGiUtil._loadBundle(OSGiUtil.java:458) at lucee.runtime.osgi.OSGiUtil.loadBundle(OSGiUtil.java:436) at lucee.commons.lang.ClassUtil.loadClassByBundle(ClassUtil.java:150) at lucee.commons.lang.ClassUtil.loadClassByBundle(ClassUtil.java:145) at lucee.runtime.functions.other.JavaProxy.loadClass(JavaProxy.java:75) at lucee.runtime.functions.other.JavaProxy.call(JavaProxy.java:59) at lucee.runtime.functions.other.CreateObject.doJava(CreateObject.java:137) at lucee.runtime.functions.other.CreateObject.call(CreateObject.java:59) at

Hi @Allen_Weng,

I download the validator JAR & placed in lucee-server\bundles folder. In my admin seems that JAR is not loaded

.

How did you load the JAR?

Where do you placed your jar file?
For me its working fine. (placed the jar inside tomcat\lucee-server\context\lib )
Example-Code:

<!--- Create Validator Obj --->
<cfset urlValidator = CreateObject("java", "org.apache.commons.validator.routines.UrlValidator")>
<cfdump var="#urlValidator#">
<!--- Test URL --->
<cfset isValidUrl = urlValidator.isValid("http://example.com")>
<cfdump var="#isValidUrl#">

@David_Raschper it is put in bundles folder. I know when it is in classpath folder it is working. Just try to move everything to OSGi env… (see the extra 2 things passed in createobject())

@cfmitrah it is “not loaded” in the beginning, then you just try to run

<cfscript>
foo = createobject('java', 'org.apache.commons.validator.routines.UrlValidator', 'org.apache.commons.validator', '1.6.0');
writedump(foo);
</cfscript>

you will see the error I reported, then please check lucee server admin again, it will show it is loaded.

Im not sure if I understand you correctly…
I removed the jar from the lucee-installation and put in my application folder and add this to my application.cfc

this.javaSettings = {LoadPaths = [".\lib\commons-validator-1.6.jar"], loadColdFusionClassPath = true, reloadOnChange = false};

Its also working as expected. (The Lib will than not shown in the Admin Interface).

Ah ok got it… I also get the same error /result.
Is the Validator-Jar compiled correctly for OSGi?