Questions Tagged With ivy4x-migrationhttps://answers.axonivy.com/tags/ivy4x-migration/?type=rssquestions tagged <span class="tag">ivy4x-migration</span>enMon, 13 Apr 2015 08:07:15 -0400Lucene versions conflict when migrating from Xpert.ivy v4 to Axon.ivy v5https://answers.axonivy.com/questions/1256/lucene-versions-conflict-when-migrating-from-xpert-ivy-v4-to-axon-ivy-v5<p>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.</p> <p>Our project uses Lucene v3.6.0 and we have the <code>lucene-core-v3.6.0.jar</code> in our <code>buildpath</code>. After migrating into Axon.ivy 5.1.4, the project cannot built anymore since we get strange complilation error:</p> <pre><code>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 </code></pre> <p>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. <strong>The problem is we could not find a way to force the Axon.ivy build the project with <code>lucene-core-v3.6.0.jar</code> instead of the built-in <code>lucene-core-v4.5.1.jar</code></strong></p> <h1>UPDATE</h1> <p>We later tried to upgrade our implementation into Lucene 4.5.1 but got several other problems:</p> <p>(1) Axon.ivy issues warnings about we are trying to access Lucene API.</p> <p>(2) Start the project in Axon.ivy Designer will encounter <code>ClassNotFoundException</code>: </p> <pre><code>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 </code></pre> <p>.. even if all the jars are shipped with Axon.ivy.</p> <p>(3) If we try to include the jars file into our projects (in the classpath), the build will halt with the <code>Bad Return Type</code> error above.</p> <h1>QUESTIONS</h1> <ul> <li>How could we force the Axon.ivy to build our projects using the <code>lucene-core-v3.6.0</code> instead of the <code>lucene-core-v4.5.1</code> shipped with Axon.ivy?</li> <li>Why do we get strange problems when building the projects with built-in Lucene library of Axon.ivy v5.1.4?</li> </ul> <h1>SAMPLE PROJECTS</h1> <p>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:</p> <ul> <li><a href="https://app.box.com/s/ggaz5cuiip9g6wb1bdq2l1js7xxi2emx"><code>use_built_in_lucene.iar</code></a>: This project illustrates the problem which we cannot built the project if it uses Lucene's classes.</li> <li><a href="https://app.box.com/s/j8gkpnxnmr9oydyelxy446ej7urqb6d9"><code>use_external_lucene.iar</code></a>: This project illustrates the problem which we purposely include the Lucene's jar files but the project still fails.</li> </ul> <h1>UPDATE 2 (extend the answer)</h1> <p>The solution from Reguel Wermelinger which suggest to repack all the classes in <code>lucene-core-v3.6.0.jar</code> in different package name works.</p> <p>1- Download <a href="https://code.google.com/p/jarjar/downloads/list">JarJar</a> (hosted on Google Code, if you read this after 25.01.2016, please search it on GitHub).</p> <p>2 - Put the file <code>lucene-core-v3.6.0.jar</code> at the same directory at JarJar.</p> <p>3 - Create a text file, namely <code>rules.txt</code>, contains one line</p> <pre><code>rule org.apache.lucene.** org.apache.lucene.v3_6_0.@1 </code></pre> <p>4 - Execute the command</p> <pre><code>$ java -jar jarjar.jar rules.txt lucene-core-v3.6.0.jar lucene-core-v3.6.0-repacked.jar </code></pre> <p>5 - Done!</p> <p>You can download the already-repackged <a href="https://app.box.com/s/9efw6bxhm8gkws25gd34d44qwu30662r"><code>lucene-core-v3.6.0-repacked.jar</code></a></p> <p>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.</p>Genzer HawkerMon, 13 Apr 2015 08:07:15 -0400https://answers.axonivy.com/questions/1256/lucene-versions-conflict-when-migrating-from-xpert-ivy-v4-to-axon-ivy-v5luceneivy4x-migrationivymigration