ClassNotFoundException: javax.annotation.Priority - quarkus

When starting my Quarkus app with
java -jar target/quarkus-app/quarkus-run.jar
or with a packed Uber-jar I get :
ClassNotFoundException: javax.annotation.Priority
But when I start from IntelliJ or with
mvn quarkus:dev
It all start well.
Complete stackTrace:
$ java -jar target/quarkus-app/quarkus-run.jar
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at io.quarkus.bootstrap.runner.QuarkusEntryPoint.doRun(QuarkusEntryPoint.java:53)
at io.quarkus.bootstrap.runner.QuarkusEntryPoint.main(QuarkusEntryPoint.java:28)
Caused by: java.lang.NoClassDefFoundError: javax/annotation/Priority
at io.smallrye.config.SmallRyeConfigBuilder$InterceptorWithPriority$1.getPriority(SmallRyeConfigBuilder.java:461)
at io.smallrye.config.SmallRyeConfigBuilder$InterceptorWithPriority.(SmallRyeConfigBuilder.java:469)
at io.smallrye.config.SmallRyeConfigBuilder$InterceptorWithPriority.(SmallRyeConfigBuilder.java:448)
at io.smallrye.config.SmallRyeConfigBuilder$InterceptorWithPriority.(SmallRyeConfigBuilder.java:441)
at io.smallrye.config.SmallRyeConfigBuilder.getDefaultInterceptors(SmallRyeConfigBuilder.java:213)
at io.smallrye.config.SmallRyeConfig$ConfigSources.buildInterceptors(SmallRyeConfig.java:571)
at io.smallrye.config.SmallRyeConfig$ConfigSources.(SmallRyeConfig.java:516)
at io.smallrye.config.SmallRyeConfig.(SmallRyeConfig.java:66)
at io.smallrye.config.SmallRyeConfigBuilder.build(SmallRyeConfigBuilder.java:419)
at io.quarkus.runtime.generated.Config.(Unknown Source)
at io.quarkus.runner.ApplicationImpl.(Unknown Source)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at java.base/java.lang.Class.newInstance(Class.java:584)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:66)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:41)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:120)
at io.quarkus.runner.GeneratedMain.main(Unknown Source)
... 6 more
Caused by: java.lang.ClassNotFoundException: javax.annotation.Priority
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
at io.quarkus.bootstrap.runner.RunnerClassLoader.loadClass(RunnerClassLoader.java:107)
at io.quarkus.bootstrap.runner.RunnerClassLoader.loadClass(RunnerClassLoader.java:57)
... 26 more

My pom is so big and ugly , witch maybe is part of the problem.
But it helped to do a lot of exclutions on jakarta.annotation-api
<exclusion>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
</exclusion>
And to include version 1.3.5 of jakarta.annotation-api
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>1.3.5</version>
</dependency>

Related

java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory - Related to Appium

java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at io.appium.java_client.service.local.AppiumDriverLocalService.<clinit>(AppiumDriverLocalService.java:57)
at BaseTest.globalSetup(basetest.java:14)
at androidtest.globalSetup(androidtest.java:17)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:133)
at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:62)
at org.testng.internal.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:385)
at org.testng.internal.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:321)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:317)
at org.testng.SuiteRunner.run(SuiteRunner.java:276)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1212)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1134)
at org.testng.TestNG.runSuites(TestNG.java:1063)
at org.testng.TestNG.run(TestNG.java:1031)
at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66)
at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:109)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 21 more
Below is what i have where the code fails at globalSetUp()
Below is also relevant code
and Appium server says
Hello all, trying to get appium working for the first time as a novice, would like to know what i can do over at pom.xml or what can i do to resolve this problem.
Thanks!
Add a SLF4J implementation:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.30</version>
</dependency>

Jacoco integration with Spring boot app giving Error while instrumenting

I have to get the coverage for my integration tests for spring boot app. Now when I am trying to use javaagent in startup for my spring boot app I am getting an error . Also I have used the below args in JAVA_OPTS
-javaagent:/tmp/jacocoagent.jar=destfile=/mnt/shared/jacoco.exec
at org.jacoco.agent.rt.internal_035b120.CoverageTransformer.transform(CoverageTransformer.java:93)
at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:459)
at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:336)
at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:93)
Caused by: java.io.IOException: Error while instrumenting xxx/xxx/core/config/CoreAutoConfiguration$$FastClassBySpringCGLIB$$e1df4252.
at org.jacoco.agent.rt.internal_035b120.core.instr.Instrumenter.instrumentError(Instrumenter.java:158)
at org.jacoco.agent.rt.internal_035b120.core.instr.Instrumenter.instrument(Instrumenter.java:108)
at org.jacoco.agent.rt.internal_035b120.CoverageTransformer.transform(CoverageTransformer.java:91)
... 52 more
Caused by: java.lang.IllegalStateException: Cannot process instrumented class xxx/xxx/core/config/CoreAutoConfiguration$$FastClassBySpringCGLIB$$e1df4252. Please supply original non-instrumented classes.
at org.jacoco.agent.rt.internal_035b120.core.internal.instr.InstrSupport.assertNotInstrumented(InstrSupport.java:237)
at org.jacoco.agent.rt.internal_035b120.core.internal.instr.ClassInstrumenter.visitField(ClassInstrumenter.java:55)
at org.jacoco.agent.rt.internal_035b120.asm.ClassVisitor.visitField(ClassVisitor.java:287)
at org.jacoco.agent.rt.internal_035b120.asm.ClassReader.readField(ClassReader.java:906)
at org.jacoco.agent.rt.internal_035b120.asm.ClassReader.accept(ClassReader.java:683)
at org.jacoco.agent.rt.internal_035b120.asm.ClassReader.accept(ClassReader.java:400)
at org.jacoco.agent.rt.internal_035b120.core.instr.Instrumenter.instrument(Instrumenter.java:88)
at org.jacoco.agent.rt.internal_035b120.core.instr.Instrumenter.instrument(Instrumenter.java:106)
... 53 more
java.lang.instrument.IllegalClassFormatException: Error while instrumenting xxx/xxx/core/config/CoreAutoConfiguration$$EnhancerBySpringCGLIB$$e954c394$$FastClassBySpringCGLIB$$3d9ac05.
at org.jacoco.agent.rt.internal_035b120.CoverageTransformer.transform(CoverageTransformer.java:93)
at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:459)
at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:336)
at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:93)
Caused by: java.io.IOException: Error while instrumenting xxx/xxx/core/config/CoreAutoConfiguration$$EnhancerBySpringCGLIB$$e954c394$$FastClassBySpringCGLIB$$3d9ac05.
at org.jacoco.agent.rt.internal_035b120.core.instr.Instrumenter.instrumentError(Instrumenter.java:158)
at org.jacoco.agent.rt.internal_035b120.core.instr.Instrumenter.instrument(Instrumenter.java:108)
at org.jacoco.agent.rt.internal_035b120.CoverageTransformer.transform(CoverageTransformer.java:91)
... 52 more
Caused by: java.lang.IllegalStateException: Cannot process instrumented class xxx/xxx/core/config/CoreAutoConfiguration$$EnhancerBySpringCGLIB$$e954c394$$FastClassBySpringCGLIB$$3d9ac05. Please supply original non-instrumented classes.
at org.jacoco.agent.rt.internal_035b120.core.internal.instr.InstrSupport.assertNotInstrumented(InstrSupport.java:237)
at org.jacoco.agent.rt.internal_035b120.core.internal.instr.ClassInstrumenter.visitField(ClassInstrumenter.java:55)
at org.jacoco.agent.rt.internal_035b120.asm.ClassVisitor.visitField(ClassVisitor.java:287)
at org.jacoco.agent.rt.internal_035b120.asm.ClassReader.readField(ClassReader.java:906)
at org.jacoco.agent.rt.internal_035b120.asm.ClassReader.accept(ClassReader.java:683)
at org.jacoco.agent.rt.internal_035b120.asm.ClassReader.accept(ClassReader.java:400)
at org.jacoco.agent.rt.internal_035b120.core.instr.Instrumenter.instrument(Instrumenter.java:88)

How to fix the "Unsatisfied dependency expressed through field 'sessionFactory'" error in spring

I am new to spring Hibernate doing the first project and got stuck with the following error. Why is the following error is coming? Tried to search the error but could not resolve.
Caused by: java.lang.NoClassDefFoundError: net/bytebuddy/NamingStrategy$SuffixingRandom$BaseNameResolver
at org.hibernate.cfg.Environment.buildBytecodeProvider(Environment.java:345)
at org.hibernate.cfg.Environment.buildBytecodeProvider(Environment.java:337)
at org.hibernate.cfg.Environment.<clinit>(Environment.java:230)
at org.hibernate.boot.registry.StandardServiceRegistryBuilder.<init>(StandardServiceRegistryBuilder.java:78)
at org.hibernate.boot.registry.StandardServiceRegistryBuilder.<init>(StandardServiceRegistryBuilder.java:67)
at org.hibernate.cfg.Configuration.reset(Configuration.java:158)
at org.hibernate.cfg.Configuration.<init>(Configuration.java:130)
at org.springframework.orm.hibernate5.LocalSessionFactoryBuilder.<init>(LocalSessionFactoryBuilder.java:158)
at org.springframework.orm.hibernate5.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:495)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1837)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1774)
... 24 more
Caused by: java.lang.ClassNotFoundException: net.bytebuddy.NamingStrategy$SuffixingRandom$BaseNameResolver
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 35 more
As you can see in the Github Bytebuddy repo the BaseNameResolver is an interface in NamingStrategy.
Most probably you do not have this dependency on your classpath:
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy-dep</artifactId>
<version>1.9.12</version>
</dependency>

Arquillian test won't run when code has java 8 lambda expression

I have an Arquillian test that fails to run if either my test method or the EJB my test is invoking uses lambdas. The test doesn't even get far enough to run, looks like it fails on arquillian initialization. For example, putting this
Stream.of("one", "two", "three").map(String::new);
into my test method results in the following exception when executing as a junit test inside eclipse.
java.lang.RuntimeException: Could not create new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor
at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:165)
at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:102)
at org.jboss.arquillian.test.spi.TestRunnerAdaptorBuilder.build(TestRunnerAdaptorBuilder.java:52)
at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:113)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:161)
... 9 more
Caused by: java.lang.RuntimeException: Could not create new instance of class org.jboss.arquillian.core.impl.ManagerImpl
at org.jboss.arquillian.core.spi.SecurityActions.newInstance(SecurityActions.java:165)
at org.jboss.arquillian.core.spi.SecurityActions.newInstance(SecurityActions.java:102)
at org.jboss.arquillian.core.spi.ManagerBuilder.create(ManagerBuilder.java:77)
at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.<init>(EventTestRunnerAdaptor.java:62)
... 14 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.jboss.arquillian.core.spi.SecurityActions.newInstance(SecurityActions.java:161)
... 17 more
Caused by: java.lang.RuntimeException: Could not create and process manager
at org.jboss.arquillian.core.impl.ManagerImpl.<init>(ManagerImpl.java:105)
... 22 more
Caused by: java.lang.NullPointerException
at org.reflections.Reflections.scan(Reflections.java:220)
at org.reflections.Reflections.scan(Reflections.java:166)
at org.reflections.Reflections.<init>(Reflections.java:94)
at org.reflections.Reflections.<init>(Reflections.java:135)
at org.reflections.Reflections.<init>(Reflections.java:108)
at org.eu.ingwar.tools.arquillian.extension.suite.ArquillianSuiteExtension.getDeploymentClass(ArquillianSuiteExtension.java:78)
at org.eu.ingwar.tools.arquillian.extension.suite.ArquillianSuiteExtension.register(ArquillianSuiteExtension.java:63)
at org.jboss.arquillian.core.impl.loadable.LoadableExtensionLoader.load(LoadableExtensionLoader.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116)
at org.jboss.arquillian.core.impl.ManagerImpl.fireProcessing(ManagerImpl.java:346)
at org.jboss.arquillian.core.impl.ManagerImpl.<init>(ManagerImpl.java:100)
... 22 more
I'm using Arquillian 1.1.8.Final and JBoss shrinkwrap resolver 2.2.0
Removing the arquillian-suite-extension as a dependency fixed the issue, even though I wasn't using it
<dependency>
<groupId>org.eu.ingwar.tools</groupId>
<artifactId>arquillian-suite-extension</artifactId>
<version>1.1.2</version>
<scope>test</scope>
</dependency>
To add to John Ament's comment, because it wasn't immediately obvious to me and this issue still persists:
When using arquillian-suite-extension you need to set the version of org.reflections/reflections to exactly 0.9.9 in your pom.xml. Neither a version higher or lower than that worked for me.
This is the entry required in your pom.xml:
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.9.9</version>
</dependency>

Issues with Neo4j and Elasticsearch in Maven project

Is it possible to use Neo4j and Elasticsearch(both use Lucene internaly) on the same classpath in Maven project ?
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>1.4.4</version>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j</artifactId>
<version>2.1.7</version>
</dependency>
and I have following exception:
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.neo4j.graphdb.GraphDatabaseService]: Circular reference involving containing bean 'neo4jTestConfig' - consider declaring the factory method as static for independence from its containing instance. Factory method 'graphDatabaseService' threw exception; nested exception is java.lang.RuntimeException: Error starting org.neo4j.kernel.EmbeddedGraphDatabase, domain\target\test-neo4j-db
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE]
... 54 common frames omitted
Caused by: java.lang.RuntimeException: Error starting org.neo4j.kernel.EmbeddedGraphDatabase, domain\target\test-neo4j-db
at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:366) ~[neo4j-kernel-2.1.7.jar:2.1.7]
at org.neo4j.kernel.EmbeddedGraphDatabase.<init>(EmbeddedGraphDatabase.java:59) ~[neo4j-kernel-2.1.7.jar:2.1.7]
at org.neo4j.graphdb.factory.GraphDatabaseFactory$1.newDatabase(GraphDatabaseFactory.java:91) ~[neo4j-kernel-2.1.7.jar:2.1.7]
at org.neo4j.graphdb.factory.GraphDatabaseBuilder.newGraphDatabase(GraphDatabaseBuilder.java:181) ~[neo4j-kernel-2.1.7.jar:2.1.7]
at org.neo4j.graphdb.factory.GraphDatabaseFactory.newEmbeddedDatabase(GraphDatabaseFactory.java:71) ~[neo4j-kernel-2.1.7.jar:2.1.7]
at com.example.domain.configuration.Neo4jTestConfig.graphDatabaseService(Neo4jTestConfig.java:36) ~[test-classes/:na]
at com.example.domain.configuration.Neo4jTestConfig$$EnhancerBySpringCGLIB$$333d76d.CGLIB$graphDatabaseService$0(<generated>) ~[spring-core-4.1.5.RELEASE.jar:na]
at com.example.domain.configuration.Neo4jTestConfig$$EnhancerBySpringCGLIB$$333d76d$$FastClassBySpringCGLIB$$aa2eee7d.invoke(<generated>) ~[spring-core-4.1.5.RELEASE.jar:na]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:309) ~[spring-context-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at com.example.domain.configuration.Neo4jTestConfig$$EnhancerBySpringCGLIB$$333d76d.graphDatabaseService(<generated>) ~[spring-core-4.1.5.RELEASE.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_25]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_25]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_25]
at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_25]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE]
... 55 common frames omitted
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.extension.KernelExtensions#222eb8aa' failed to initialize. Please see attached cause exception.
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:489) ~[neo4j-kernel-2.1.7.jar:2.1.7]
at org.neo4j.kernel.lifecycle.LifeSupport.init(LifeSupport.java:72) ~[neo4j-kernel-2.1.7.jar:2.1.7]
at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:106) ~[neo4j-kernel-2.1.7.jar:2.1.7]
at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:343) ~[neo4j-kernel-2.1.7.jar:2.1.7]
... 70 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/apache/lucene/document/Fieldable
at org.neo4j.kernel.api.impl.index.NodeRangeDocumentLabelScanStorageStrategy.<init>(NodeRangeDocumentLabelScanStorageStrategy.java:70) ~[neo4j-lucene-index-2.1.7.jar:2.1.7]
at org.neo4j.kernel.api.impl.index.LuceneLabelScanStoreExtension.newKernelExtension(LuceneLabelScanStoreExtension.java:73) ~[neo4j-lucene-index-2.1.7.jar:2.1.7]
at org.neo4j.kernel.api.impl.index.LuceneLabelScanStoreExtension.newKernelExtension(LuceneLabelScanStoreExtension.java:39) ~[neo4j-lucene-index-2.1.7.jar:2.1.7]
at org.neo4j.kernel.extension.KernelExtensions.init(KernelExtensions.java:104) ~[neo4j-kernel-2.1.7.jar:2.1.7]
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:483) ~[neo4j-kernel-2.1.7.jar:2.1.7]
... 73 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.apache.lucene.document.Fieldable
at java.net.URLClassLoader$1.run(Unknown Source) ~[na:1.8.0_25]
at java.net.URLClassLoader$1.run(Unknown Source) ~[na:1.8.0_25]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_25]
at java.net.URLClassLoader.findClass(Unknown Source) ~[na:1.8.0_25]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_25]
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) ~[na:1.8.0_25]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_25]
... 78 common frames omitted
When I trying to exclude neo4j-lucene-index
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j</artifactId>
<version>2.1.7</version>
<exclusions>
<exclusion>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-lucene-index</artifactId>
</exclusion>
</exclusions>
</dependency>
I get an exception:
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.impl.nioneo.xa.NeoStoreXaDataSource#4ae33a11' was successfully initialized, but failed to start. Please see attached cause exception.
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:513) ~[neo4j-kernel-2.1.7.jar:2.1.7]
at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:115) ~[neo4j-kernel-2.1.7.jar:2.1.7]
at org.neo4j.kernel.impl.transaction.XaDataSourceManager.start(XaDataSourceManager.java:164) ~[neo4j-kernel-2.1.7.jar:2.1.7]
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:507) ~[neo4j-kernel-2.1.7.jar:2.1.7]
... 72 common frames omitted
Caused by: java.lang.IllegalArgumentException: No schema index provider org.neo4j.kernel.api.index.SchemaIndexProvider found. Kernel extensions available on classpath:
I don't want to use Neo4j Legacy Indexing and would like to implement fuzzy-search in my application based on Elasticsearch engine. Is it possible to use both of these systems together on the same classpath ?
As lucene didn't change their package names from 3.x to 4.x the classes of the 2 versions will clash.
If you are adventourous you might try to build this Lucene 4.x branch for Neo4j.
You might be better off though integrating external ES with Neo4j.

Resources