Lucee 5 - first impression and problem with custom Java libraries

563 views
Skip to first unread message

Harry Klein

unread,
Apr 8, 2015, 6:01:37 AM4/8/15
to lu...@googlegroups.com

Thanks for the first version of Lucee 5, good job!

 

I played a little bit with Lucee 5 and CONTENS seems to run fine.

Some small issues I found:

                The update documentation could be improved, I will try to find some time in the evening and add some missing steps

                               Most important things I missed:

Clarification about the new Lucee Servlet. Web.xml sample code

                                               I could not use existing lucee directories (load errors) – and had to add lucee-server/bundles

                Lucee shouldn’t throw an error if no searchengine is installed – e.g. this error should be catched

                I am missing the Infinispan Cache Extension

 

Could you please help me with one problem, before I add a new Jenkins job for Lucee 5:

 

How can I add custom JARs to Lucee 5?

I tried these ways:

                Extended catalina.properties and added a custom folder – jars were not found

                Copied the jars to lib/ext - jars were not found

Copied the jars to luceee-server/bundles - jars were not found

 

P.S. I would suggest to change one line in startup.bat (comment with rem)

 

rem if not "%CATALINA_HOME%" == "" goto gotHome

 

Otherwise the express version could use another Tomcat version in the users system

 

--

Harry Klein | Konzeption und Entwicklung

CONTENS Software GmbH

Neumarkter Str. 41 | 81673 München

Fon: +49 (0)89 5199 69-0 | Fax: +49 (0)89 5199 69-78

mailto:kl...@contens.de | http://www.contens.de

 

*************************************

 

Machen Sie CONTENS zu Ihrer Plattform

für effizientes digitales Marketing

 

www.contens.de/dm


***********************************

Sitz der Gesellschaft: München

Geschäftsführer: Jörg Wilcke

Amtsgericht München, HRB 128 273

 

 

 

Michael Offner

unread,
Apr 8, 2015, 6:28:36 AM4/8/15
to lu...@googlegroups.com
Hi Harry 

Please See my comments between the lines 

Thanks for the feedback
Micha


Am Mittwoch, 8. April 2015 schrieb Harry Klein :

Thanks for the first version of Lucee 5, good job!

 

I played a little bit with Lucee 5 and CONTENS seems to run fine.

Some small issues I found:

                The update documentation could be improved, I will try to find some time in the evening and add some missing steps

                               Most important things I missed:

Clarification about the new Lucee Servlet. Web.xml sample code

The LuceeServlet is not carved in stone yet, we had some troubles with tomcat and the welcome file list splitted between 2 servlets, so maybe this will be merged with the cfmlServlet in the next release.  

                                               I could not use existing lucee directories (load errors)


What do you mean with "Lucee directories"? What error exactly?

 – and had to add lucee-server/bundles

                Lucee shouldn’t throw an error if no searchengine is installed – e.g. this error should be catched

I assume you mean in the admin frontend, this will be the case for the next release. But of course not if you use the tags "collection, index,search" in your code.

                I am missing the Infinispan Cache Extension

Will come asap 

 

Could you please help me with one problem, before I add a new Jenkins job for Lucee 5:

 

How can I add custom JARs to Lucee 5?

I tried these ways:

                Extended catalina.properties and added a custom folder – jars were not found

That should work, I will check. How you call them?

                Copied the jars to lib/ext - jars were not found

 See above

Copied the jars to luceee-server/bundles - jars were not found

Please have in mind that Lucee only looks for bundles in that directory.
Every bundle is a jar, but not every jar is a bundle.

What jars we talking about? we can make them available as bundles on the update provider, then a manual installation is not necessary. 

 

P.S. I would suggest to change one line in startup.bat (comment with rem)

 

rem if not "%CATALINA_HOME%" == "" goto gotHome

 

Otherwise the express version could use another Tomcat version in the users system

 

--

Harry Klein | Konzeption und Entwicklung

CONTENS Software GmbH

Neumarkter Str. 41 | 81673 München

Fon: +49 (0)89 5199 69-0 | Fax: +49 (0)89 5199 69-78

mailto:kl...@contens.de | http://www.contens.de

 

*************************************

 

Machen Sie CONTENS zu Ihrer Plattform

für effizientes digitales Marketing

 

www.contens.de/dm


***********************************

Sitz der Gesellschaft: München

Geschäftsführer: Jörg Wilcke

Amtsgericht München, HRB 128 273

 

 

 

--
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/F5A941E045A6FE4288ABB2E3D797146FA7394AEC%40SRV-DC1.contens.local.
For more options, visit https://groups.google.com/d/optout.

Harry Klein

unread,
Apr 8, 2015, 6:44:35 AM4/8/15
to lu...@googlegroups.com

Hi Micha,

 

>> What do you mean with "Lucee directories"? What error exactly?

 

I meant that this part of the upgrade documentation didn’t work for me:

“… If you have defined a "railo-server-directory"/"lucee-server-directory" with your servlet specification copy the jars to "{lucee-server-directory-path}/bundles" …”

https://bitbucket.org/lucee/lucee/wiki/Lucee_5_Upgrading_Railo

Sorry, I should have saved the stacktrace … I guess the bundles were not found.

 

>> I assume you mean in the admin frontend, this will be the case for the next release. But of course not if you use the tags "collection, index,search" in your code.

 

Yes, this is a minor issue – and not important for us because we don’t use the search features in Lucee but custom Lucene and Elasticsearch code.

 

>>Extended catalina.properties and added a custom folder – jars were not found
>>That should work, I will check. How you call them?

>> What jars we talking about? we can make them available as bundles on the update provider, then a manual installation is not necessary. 

 

Well, we are using some libraries like Lucene, POI, PDFBox, YUI, …

My common.loader:

common.loader="${catalina.base}/lib","${catalina.base}/lib/*.jar","${catalina.home}/lib","${catalina.home}/lib/*.jar","${catalina.home}/contenslib","${catalina.home}/contenslib/*.jar","${catalina.home}/luceelib","${catalina.home}/luceelib/*.jar"

 

And a simple way to test if the library was loaded:

 

<th>Lucene Facet</th>

<td>org.apache.lucene.facet</td>

<td>#getClassLocation("org.apache.lucene.facet.taxonomy.CategoryPath")#<br>(Version: #getPackageVersion("org.apache.lucene.facet.taxonomy")#)</td>

<td>#isInClassPath('org.apache.lucene.search.MultiCollector')#</td>

<td>Used for Lucene searching</td>

 

<cffunction name="isInClassPath">

                <cfargument name="class">

                <cftry>

                               <cfset CreateObject("java", "#arguments.class#")>

                               <cfreturn "ok">

                               <cfcatch>

                                               <cfreturn cfcatch.detail>

                               </cfcatch>

                </cftry>

</cffunction>

 

<cffunction name="getClassLocation">

                <cfargument name="class">

                <cfset var oTest = "">

                <cfset var sLocation = "">

                <cftry>

                               <cfset oTest = CreateObject("java", "#arguments.class#")>

                               <cfset sLocation = oTest.getClass().getProtectionDomain().getCodeSource().getLocation().toString()>

                               <cfreturn ReReplaceNoCase(sLocation, "file:[/]*", "")>

                               <cfcatch>

                                               <cfreturn cfcatch.detail>

                               </cfcatch>

                </cftry>

</cffunction>

 

<cffunction name="getPackageVersion">

                <cfargument name="package">

                <cfset var oObj = createObject("java", "java.lang.Package")>

                <cftry>

                               <cfreturn oObj.getPackage("#arguments.package#").getImplementationVersion()>

                               <cfcatch>

                                               <cfreturn "">

                               </cfcatch>

                </cftry>

</cffunction>

 

-Harry

Michael Offner

unread,
Apr 17, 2015, 4:31:20 AM4/17/15
to lucee
FYi

i have raised a ticket for this

it seems like OSGi supress this based on the  "org.osgi.framework.bundle.parent" setting

Micha

--

Harry Klein

unread,
Apr 17, 2015, 5:10:50 AM4/17/15
to lucee

Hi Micha,

 

i just briefly read some articles covering the topic “Non-osgi library usage in an osgi application”.

Maybe they are helpful for you too:

http://moi.vonos.net/java/osgi-classloaders/

http://www.javacodegeeks.com/2012/11/making-plain-old-java-osgi-compatible.html

http://wso2.com/library/knowledgebase/add-external-jar-libraries-wso2-carbon-based-products/

http://stackoverflow.com/questions/4931292/non-osgi-library-usage-in-an-osgi-application

http://www.eggs.de/content/dam/eggs%20unimedia/papers/Third-Party%20Libraries%20and%20OSGi%20-%20a%20complicated%20relationship.pdf

 

The last PDF from our Munich colleagues (Eggs) is very good and describes the problem and two possible solutions in detail.

 

One idea from the wso2.com link could also be the way to go for Lucee:

“…The jar files you drop into this folder will be converted to OSGi bundles during the next server startup. …

 

Would it be possible for Lucee to convert custom JARs to OSGi bundles by dropping them to a special folder?

 

-Harry

 

Von: lu...@googlegroups.com [mailto:lu...@googlegroups.com] Im Auftrag von Michael Offner
Gesendet: Freitag, 17. April 2015 10:31
An: lucee
Betreff: Re: [Lucee] Lucee 5 - first impression and problem with custom Java libraries

 

FYi

Michael Offner

unread,
Apr 17, 2015, 5:22:03 AM4/17/15
to lucee
"Would it be possible for Lucee to convert custom JARs to OSGi bundles by dropping them to a special folder?"
Lucee already does this with jars bundled in extensions. Lucee anaylses all relations of all classes and add the necessary relations to external resources to the Manifest file. So there is no folder for this, but a cfadmin action to do so.

But there is something else, when i add a jar with a extension i can define if Lucee should load this bundles at startup or not.
If you simply put a bundle to the bundles folder Lucee will not load it and if you only "ask" for a class Lucee will not look for that class in unloaded bundles.
Lucee only checks unloaded bundle if it has at least a bundle name. checking for classes in unloaded bundles mean to load the bundle.
so
JavaProxy("my.ClassName","my-bundle"); also checks the unloaded bundles
but this does not
JavaProxy("my.ClassName");

Micha






 

Harry Klein

unread,
Apr 17, 2015, 5:51:48 AM4/17/15
to lucee

Hi Micha,

 

it’s fine that “conversion” code already exists.

Could one (not very good) solution for our CMS be?

                Build one “CONTENS” bundle with all custom libraries

                Change all  createObject("java",…) calls to JavaProxy(..) or JavaNew(…) (or whatever name the new method will get)

 

Of course I (and I think all Railo or Lucce 4.5 users) would prefer a solution where:

                They shouldn’t have (too much) work to convert custom libraries

                They should’t have to change existing code

 

I hope that such a solution is possible?

Reply all
Reply to author
Forward
0 new messages