Our project have encountered an urgent situation in which we have to migrate all modules into Axon.ivy v5.1.4. The migration have some serious trouble with Lucene.

Our project uses Lucene v3.6.0 and we have the lucene-core-v3.6.0.jar in our buildpath. After migrating into Axon.ivy 5.1.4, the project cannot built anymore since we get strange complilation error:

Errors occurred during the build.
Errors running builder 'Ivy Web Service Process Class Builder' on project 'test'.
Bad return type
Exception Details:
  Location:
 ch/test/lucene/LuceneManager.analyzer()Lorg/apache/lucene/analysis/Analyzer; @10: areturn
  Reason:
    Type 'org/apache/lucene/analysis/standard/StandardAnalyzer' (current frame, stack[0]) is not assignable to 'org/apache/lucene/analysis/Analyzer' (from method signature)
  Current Frame:
    bci: @10
    flags: { }
    locals: { }
    stack: { 'org/apache/lucene/analysis/standard/StandardAnalyzer' }
  Bytecode:
    0000000: bb00 f459 b200 28b7 00f6 b0

We found out that the Axon.ivy has upgraded Lucene to v4.5.1 which contains a lots of incompatible changes compared to Lucene v3.6.0. The problem is we could not find a way to force the Axon.ivy build the project with lucene-core-v3.6.0.jar instead of the built-in lucene-core-v4.5.1.jar

UPDATE

We later tried to upgrade our implementation into Lucene 4.5.1 but got several other problems:

(1) Axon.ivy issues warnings about we are trying to access Lucene API.

(2) Start the project in Axon.ivy Designer will encounter ClassNotFoundException:

Caused by: java.lang.NoClassDefFoundError: org/apache/lucene/analysis/Analyzer
     at ch.soreco.alag.ria.service.taskindex.LucenceHandler.startLuceneInstance(LucenceHandler.java:6)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
     at java.lang.reflect.Method.invoke(Unknown Source)
     at ch.ivyteam.ivy.scripting.internal.types.IvyJavaMethod.invokeImpl(IvyJavaMethod.java:73)
     ... 35 more
    Caused by: java.lang.ClassNotFoundException: org.apache.lucene.analysis.Analyzer
     at ch.ivyteam.ivy.java.internal.IvyProjectClassLoader.loadClass(IvyProjectClassLoader.java:243)
     at java.lang.ClassLoader.loadClass(Unknown Source)
     ... 41 more

.. even if all the jars are shipped with Axon.ivy.

(3) If we try to include the jars file into our projects (in the classpath), the build will halt with the Bad Return Type error above.

QUESTIONS

  • How could we force the Axon.ivy to build our projects using the lucene-core-v3.6.0 instead of the lucene-core-v4.5.1 shipped with Axon.ivy?
  • Why do we get strange problems when building the projects with built-in Lucene library of Axon.ivy v5.1.4?

SAMPLE PROJECTS

I attach in this email the two sample projects which illustrate the problems we are facing. We tested the two with AxonIvyDesigner5.1.4.48243_Windows_x64:

  • use_built_in_lucene.iar: This project illustrates the problem which we cannot built the project if it uses Lucene's classes.
  • use_external_lucene.iar: This project illustrates the problem which we purposely include the Lucene's jar files but the project still fails.

UPDATE 2 (extend the answer)

The solution from Reguel Wermelinger which suggest to repack all the classes in lucene-core-v3.6.0.jar in different package name works.

1- Download JarJar (hosted on Google Code, if you read this after 25.01.2016, please search it on GitHub).

2 - Put the file lucene-core-v3.6.0.jar at the same directory at JarJar.

3 - Create a text file, namely rules.txt, contains one line

rule org.apache.lucene.** org.apache.lucene.v3_6_0.@1

4 - Execute the command

$ java -jar jarjar.jar rules.txt lucene-core-v3.6.0.jar lucene-core-v3.6.0-repacked.jar

5 - Done!

You can download the already-repackged lucene-core-v3.6.0-repacked.jar

Please note that this is only a work-around. The Axon.ivy still has problem if you use the Lucene v4.5.1 shipped with it.

asked 13.04.2015 at 08:07

Genzer%20Hawker's gravatar image

Genzer Hawker
(suspended)
accept rate: 66%

edited 13.04.2015 at 13:28

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
9.4k31958


I guess that the build problems come from a not 100% matching lucene-jar. So to be sure that you use the same version as in the engine: try to get the correct lucene jar from ivyEngine.zip in /lib/shared directory and reference it in your project classpath.

UPDATE: since ivy 5.0 our osgi plugin hides the lucene jars explicitly from the classpath. so that other projects will not have these ivy-core dependcy problems in the future.

If you want to be 200% save that your project classes and ivy core classes are independet i recommend that you try re-packaging the lucene version you want to use. It means that you change the namespace of every class in the lucene JAR to not land in the JAR hell of conflicting versions. An example can be found here: where I repacked hsqldb of another version as in the ivy core. More infos about repackaging can be founde here on repackage.org

link

answered 13.04.2015 at 08:47

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
9.4k31958
accept rate: 70%

edited 13.04.2015 at 09:57

1

The solution which repack the Lucene package works, I already extended my question describing the steps. I'll accept this as an correct answer.

(13.04.2015 at 13:00) Genzer Hawker Genzer%20Hawker's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×147
×12
×2
×1

Asked: 13.04.2015 at 08:07

Seen: 3,577 times

Last updated: 13.04.2015 at 13:28