OSGI extension for Solr

Description

Posted from the forum:
https://dev.lucee.org/t/solr-7-extension/3002
Just to add a bit more info to this.

I've created an extension using the ant build mechanism as described in:
http://docs.lucee.org/guides/lucee-5/extensions.html
I based my extension on the lucene example:
https://github.com/lucee/extension-lucene

Here is a starter repository for the work I've done:
https://github.com/patmoody/extension-solr

When I deploy the generated .lex file it is failing on the 3rd JAR file with the error:
"ERROR","Thread-30","11/14/2017","16:17:49","","Extension;C:\Users\pjmoody\AppData\Local\Temp\httpclient-4.5.3.jar (The system cannot find the file specified);lucee.runtime.exp.NativeException: C:\Users\pjmoody\AppData\Local\Temp\httpclient-4.5.3.jar (The system cannot find the file specified)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:215)
at java.util.zip.ZipFile.<init>(ZipFile.java:145)
at java.util.jar.JarFile.<init>(JarFile.java:154)
at java.util.jar.JarFile.<init>(JarFile.java:118)
at lucee.runtime.osgi.BundleInfo.<init>(BundleInfo.java:91)
at lucee.runtime.osgi.BundleFile.<init>(BundleFile.java:42)
at lucee.runtime.osgi.BundleFile.<init>(BundleFile.java:38)
at lucee.runtime.config.XMLConfigAdmin.updateJar(XMLConfigAdmin.java:1047)
at lucee.runtime.config.XMLConfigAdmin.updateRHExtension(XMLConfigAdmin.java:4842)
at lucee.runtime.config.XMLConfigAdmin.updateRHExtension(XMLConfigAdmin.java:4789)
at lucee.runtime.config.XMLConfigAdmin._updateRHExtension(XMLConfigAdmin.java:4769)
at lucee.runtime.config.DeployHandler.deploy(DeployHandler.java:82)
at lucee.runtime.engine.Controler.control(Controler.java:213)
at lucee.runtime.engine.Controler.access$000(Controler.java:59)
at lucee.runtime.engine.Controler$ControlerThread.run(Controler.java:110)
Caused by: java.io.FileNotFoundException: C:\Users\pjmoody\AppData\Local\Temp\httpclient-4.5.3.jar (The system cannot find the file specified)

This looks similar to a problem reported by @John_Farrar on @21Solutions Web Sockets extension and reportedly fixed by an upgrade to Lucee.

I am running the latest version of Lucee 5.2.4.37

Is anyone able to help? I figure this could be a problem with OSGI and that I need to create a ticket in Jira?

Perhaps there is an easier way of deploying this as in my first post above?

Cheers
Pat

Environment

None

Activity

Show:
Michael Offner
March 19, 2018, 3:34 PM

most likely this issue is limited to windows because windows in some situation locks files exclusively.

Michael Offner
March 19, 2018, 3:40 PM

correction, unrelated to windows, i see the same issue on macos

Michael Offner
March 19, 2018, 3:56 PM
Edited

Ok the reason this fails is very simple. the httpclient-4.5.3.jar bundled is not a OSGi Bundle it is only a regular jar.
But you try to register it as an OSGi bundle as follows

But there is no OSGi bundle with this name (btw all OSGi bundle i have seen so far by apache always start with "org.apache." or similar).

We convert the httpclient library with help of this project to an OSGi bundle
https://github.com/lucee/osgi-bundle-httpcomponents-httpclient

Then use like this

So problem is that you try to use a non OSGi bundle as a OSGi bundle.
Lucee fails while trying to detect if that jar is valid or not.
So not loading itself fails, the validation fails.
We will fix that.

Michael Offner
March 19, 2018, 4:01 PM

we will address the bad handling of trying to use a non OSGi bundle as a OSGi bundle with this ticket LDEV-1749. But the reason this extension fails is based on the extension itself.

Michael Offner
March 19, 2018, 4:41 PM

after fixing we now get the following log output:

Because the extension does not contain OSGi bundles matching the requirements of your bundle "solr.search.extension" (https://github.com/patmoody/extension-solr/blob/master/source/java/src/META-INF/MANIFEST.MF) Lucee tries to download them from the update provider and fails because they don't exists. i will see if i find time to change the extension a little bit so it works.

Fixed

Assignee

Michael Offner

Reporter

Pat Moody

Priority

Critical

Labels

None

Fix versions

None

Affects versions