I am trying to integrate Hibernate Search into my Spring boot application and I keep getting the following error every time I try to use the #Indexed (org.hibernate.search.annotations.Indexed) annotation
Caused by: java.lang.ClassNotFoundException: org.apache.lucene.document.Field$TermVector
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 133 more
I have the following gradle dependencies that are relevant.
compile 'org.hibernate:hibernate-search-orm:5.10.3.Final'
compile 'org.apache.lucene:lucene-core:7.4.0'
I have also tried it without the lucene dependencies. I also have the following hibernate and JPA dependencies.
compile 'javax.persistence:javax.persistence-api:2.2'
compile 'org.hibernate:hibernate-core:5.3.3.Final'
compile 'org.hibernate:hibernate-java8:5.3.3.Final'
compile 'org.hibernate:hibernate-entitymanager:5.3.3.Final'
It's driving me completely insane because I can't find anything on a tutorial or SO post.
Feel free to ask for more context as you see fit.
Edit: Reverting the Lucene version to 5.5.4 gives me the following error
java.lang.ClassNotFoundException: org.apache.lucene.analysis.standard.StandardAnalyzer
Wrong lucene version, use Lucene 5.5.
http://hibernate.org/search/releases/5.10/#compatibility
Related
Due to the recent exposure of log4j vulnerabilities our client has serious concerns about it. They asked us to remove or replace all the log4j ver.1 with ver.2 but unfortunately this is not possible for us to make such a big change.We did a workaround and replaced the log4j ver.1 with reload4j and majority of components are working fine this with change.
Unfortunately we have some binaries in our product like (elastic-search/logstash/zookeeper) which are using either the older version of log4j ver.2 (log4j-core-2.11.x < 2.17.1) or still using the log4j ver.1 (log4j-1.2.16).
For these we made the direct change in /lib/ directory and replaced the old jars with latests, this works fine for elastic-search/logstash. But when we did the same with zookeeper by replacing log4j with reload4j we're now facing the following exception when starting the component.
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/jmx/HierarchyDynamicMBean
at org.apache.zookeeper.jmx.ManagedUtil.registerLog4jMBeans(ManagedUtil.java:50)
at org.apache.zookeeper.server.ZooKeeperServerMain.initializeAndRun(ZooKeeperServerMain.java:74)
at org.apache.zookeeper.server.ZooKeeperServerMain.main(ZooKeeperServerMain.java:52)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:116)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:78)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.jmx.HierarchyDynamicMBean
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 5 mor
zookeeper current version : 2.4.6
latest stable release : 3.7.0
Latest stable release is still using log4j-1.2.17.
Can someone please guide the workaround. Thanks in advance
Asked the same question to the owner of this library. Here is the further detail and answer of this problem. Thanks
Setting the system property zookeeper.jmx.log4j.disable=true will fix the issue. See also the documentation.
My code is calling two different somewhat obscure JDBC connections. These JARS are related to Jethro and Impala, but I do not think it matters for this question. If I add the external JAR for Jethro alone it works. Same for Impala. However, if I add both the Jethro and Impala external jars I seem to get a collision. I want to be able to call either JDBC library in the same program space. The following exception occurs:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/thrift/protocol/TProtocol
at com.cloudera.impala.impala.core.ImpalaJDBCDriver.<clinit>(ImpalaJDBCDriver.java:24)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.cloudera.impala.dsi.core.impl.DSIDriverFactory.createDriver(DSIDriverFactory.java:52)
at com.cloudera.impala.jdbc.common.AbstractDriver.doInitialize(AbstractDriver.java:471)
at com.cloudera.impala.jdbc.common.AbstractDriver.connect(AbstractDriver.java:207)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at TestConnect.main(TestConnect.java:20)
Caused by: java.lang.ClassNotFoundException: org.apache.thrift.protocol.TProtocol
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
This got fixed. Essentially I did not have all the dependent JAR's for Impala. I thought that would not matter as I was calling Jethro. It did matter.
Adding the following jars did make it work. Score one for Maven. If I used Maven this would not have happened. Here are the dependent JARS's for posterity sake:
libfb303
libthrift
log4j
TCLIServiceClient
I am trying to start my webapp to WAS 8 and I am seeing the following error....
Caused by: java.lang.NoSuchMethodError: org/codehaus/jackson/map/ObjectMapper.setPropertyNamingStrategy(Lorg/codehaus/jackson/map/PropertyNamingStrategy;)Lorg/codehaus/jackson/map/ObjectMapper;
at org.springframework.social.facebook.web.SignedRequestDecoder.<init>(SignedRequestDecoder.java:49)
at org.springframework.social.facebook.web.CanvasSignInController.<init>(CanvasSignInController.java:79)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:56)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:39)
at java.lang.reflect.Constructor.newInstance(Constructor.java:527)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)
... 41 more
From what I have read this is a conflict between versions of Jackson, however, all of my versions appear to be 1.9.9 and the javadocs say that method should exist.
Can anyone help? I am using maven so it could be a dependency chaining issue.
UPDATE
Here are the dependencies in my WEB-INF/lib
https://gist.github.com/jrgleason/7932960
The issue with this was a missing XML file in my case. So if anyone gets this weird warning it looks like a missing XML file is causing an initialization error that is not propagated very well.
The file (for me) was...
WEB-INF\classes\META-INF\spring\backbase-portal-business-security.xml
The tutorial code from
http://doc.akka.io/docs/akka/2.0.2/intro/getting-started-first-java.html
Will not run. I have imported the required libraries but get the error:
Exception in thread "main" java.lang.NoClassDefFoundError: com/typesafe/config/ConfigFactory
at akka.actor.ActorSystem$.apply(ActorSystem.scala:93)
at akka.actor.ActorSystem$.create(ActorSystem.scala:56)
at akka.actor.ActorSystem.create(ActorSystem.scala)
at Pi.calculate(Pi.java:152)
at Pi.main(Pi.java:15)
Caused by: java.lang.ClassNotFoundException: com.typesafe.config.ConfigFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
... 5 more
Anyone know how to get this working? I'm trying to run it in Eclipse.
Note: I'm running akka 2.1.2
The problem is that you are not actually using Akka 2.0.2: the Config library only became an external dependency in 2.0.3. Since you are getting started with Akka, may I suggest you look at the latest stable version 2.1.2 instead?
Concerning the problem at hand: you will need to add the artifact "com.typesafe"/"config" to your classpath (the exact version depends on which Akka version you are using, I suggest using a dependency management tool like Maven or SBT).
Here's a link to the documentation (including required Scala versions etc) for each major version of Akka: http://akka.io/docs/
When I changed the sdk orm jar to v2 (default including by sdk),I got some excepion info.It's about the datanucleus-core-3.0.6.jar has ben registed bla bla....
After search,I knew it was a bug in 3.0.6. So, I relpace it by datanucleus-core-3.0.10.jar.
But it not success when compile the pojo Enhancer
java.lang.RuntimeException: Unexpected exception
at com.google.appengine.tools.enhancer.Enhancer.execute(Enhancer.java:76)
at com.google.appengine.tools.enhancer.Enhance.<init>(Enhance.java:71)
at com.google.appengine.tools.enhancer.Enhance.main(Enhance.java:51)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.appengine.tools.enhancer.Enhancer.execute(Enhancer.java:74)
... 2 more
Caused by: java.lang.NoSuchMethodError: org.datanucleus.plugin.PluginManager.<init>(Lorg/datanucleus/PersistenceConfiguration;Lorg/datanucleus/ClassLoaderResolver;)V
at org.datanucleus.OMFContext.<init>(OMFContext.java:159)
at org.datanucleus.enhancer.DataNucleusEnhancer.<init>(DataNucleusEnhancer.java:172)
at org.datanucleus.enhancer.DataNucleusEnhancer.<init>(DataNucleusEnhancer.java:150)
at org.datanucleus.enhancer.DataNucleusEnhancer.main(DataNucleusEnhancer.java:1157)
... 7 more
this is my jar file in the \lib\user\orm
asm-3.3.1.jar
datanucleus-api-jdo-3.0.5.jar
datanucleus-api-jpa-3.0.6.jar
datanucleus-appengine-2.0.0-final.jar
datanucleus-core-3.0.10.jar
geronimo-jpa_2.0_spec-1.0.jar
jdo-api-3.0.jar
transaction-api-1.1.jar
I has been looking for all day. Does any know what problem with it?
You have old versions of datanucleus-core and datanucleus-enhancer in the CLASSPATH somewhere. "OMFContext" from that stack trace hasn't existed in DataNucleus for a very long time.
I think I know, why it does not work to upgrade the appengine with a new datanucleus. It is not a classpath entry! I discovered that in the ant-macro.xml, which triggers the enhancing-step, there is a link to the appengine-tools-api.jar and there is the class EnhancerTask. This is probably a link to the old version since the new datanucleus-enhancer-3.0.1.jar has it's own EnhancerTask class. So the only way to use the new versions of datanucleus with the old appengine sdk (in contrary to http://code.google.com/p/datanucleus-appengine/wiki/HowToUpdateTheSDKWithANewPluginVersion) is to do the enhancement-step by either ant (https://developers.google.com/web-toolkit/doc/1.6/tutorial/appengine) or probably the eclipse-datanucleus-plugin. Unfortunately this plugin does not work properly in my Eclipse. After install/configure the plugin there is still no project-context menu "datanucleus", where I am supposed to add the support. So I'll try the ant version.