[ 
https://issues.apache.org/jira/browse/SOLR-5363?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13808356#comment-13808356
 ] 

Alan Woodward commented on SOLR-5363:
-------------------------------------

Hi Petar, this missed the 4.5.1 cutoff, I'm afraid.  It will be in 4.6.

> NoClassDefFoundError when using Apache Log4J2
> ---------------------------------------------
>
>                 Key: SOLR-5363
>                 URL: https://issues.apache.org/jira/browse/SOLR-5363
>             Project: Solr
>          Issue Type: Bug
>    Affects Versions: 4.5
>            Reporter: Petar Tahchiev
>            Assignee: Alan Woodward
>              Labels: log4j2
>         Attachments: SOLR-5363.patch
>
>
> Hey guys,
> I'm using Log4J2 + SLF4J in my project. Unfortunately my embedded solr server 
> throws this error when starting:
> {code}
> Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: 
> Factory method [public org.springframework.da
> ta.solr.core.SolrOperations 
> com.xxxxx.platform.core.config.SolrsearchConfig.defaultSolrTemplate() throws 
> javax.xml.par
> sers.ParserConfigurationException,java.io.IOException,org.xml.sax.SAXException]
>  threw exception; nested exception is org
> .springframework.beans.factory.BeanCreationException: Error creating bean 
> with name 'defaultSolrServer' defined in class
>  path resource [com/xxxxx/platform/core/config/SolrsearchConfig.class]: 
> Instantiation of bean failed; nested exception
>  is org.springframework.beans.factory.BeanDefinitionStoreException: Factory 
> method [public org.apache.solr.client.solrj.
> SolrServer 
> com.xxxxxx.platform.core.config.SolrsearchConfig.defaultSolrServer() throws 
> javax.xml.parsers.ParserConfigur
> ationException,java.io.IOException,org.xml.sax.SAXException] threw exception; 
> nested exception is java.lang.NoClassDefFo
> undError: org/apache/log4j/Priority
>         at 
> org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy
> .java:181)
>         at 
> org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolv
> er.java:570)
>         ... 105 more
> Caused by: org.springframework.beans.factory.BeanCreationException: Error 
> creating bean with name 'defaultSolrServer' de
> fined in class path resource 
> [com/xxxxxx/platform/core/config/SolrsearchConfig.class]: Instantiation of 
> bean failed; ne
> sted exception is 
> org.springframework.beans.factory.BeanDefinitionStoreException: Factory 
> method [public org.apache.solr
> .client.solrj.SolrServer 
> com.xxxxxxx.platform.core.config.SolrsearchConfig.defaultSolrServer() throws 
> javax.xml.parsers.
> ParserConfigurationException,java.io.IOException,org.xml.sax.SAXException] 
> threw exception; nested exception is java.lan
> g.NoClassDefFoundError: org/apache/log4j/Priority
>         at 
> org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolv
> er.java:581)
>         at 
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(Ab
> stractAutowireCapableBeanFactory.java:1025)
>         at 
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutow
> ireCapableBeanFactory.java:921)
>         at 
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCap
> ableBeanFactory.java:487)
>         at 
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapab
> leBeanFactory.java:458)
>         at 
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
>         at 
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegis
> try.java:223)
>         at 
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
>         at 
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
>         at 
> org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(Configurati
> onClassEnhancer.java:298)
>         at 
> com.xxxxxx.platform.core.config.SolrsearchConfig$$EnhancerByCGLIB$$c571c5a6.defaultSolrServer(<generated>)
>         at 
> com.xxxxx.platform.core.config.SolrsearchConfig.defaultSolrTemplate(SolrsearchConfig.java:37)
>         at 
> com.xxxxxx.platform.core.config.SolrsearchConfig$$EnhancerByCGLIB$$c571c5a6.CGLIB$defaultSolrTemplate$2(<gen
> erated>)
>         at 
> com.xxxxx.platform.core.config.SolrsearchConfig$$EnhancerByCGLIB$$c571c5a6$$FastClassByCGLIB$$f67069c2.invo
> ke(<generated>)
>         at 
> org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
>         at 
> org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(Configurati
> onClassEnhancer.java:286)
>         at 
> com.xxxxxx.platform.core.config.SolrsearchConfig$$EnhancerByCGLIB$$c571c5a6.defaultSolrTemplate(<generated>)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:606)
>         at 
> org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy
> .java:160)
>         ... 106 more
> Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: 
> Factory method [public org.apache.solr.client
> .solrj.SolrServer 
> com.xxxxxxx.platform.core.config.SolrsearchConfig.defaultSolrServer() throws 
> javax.xml.parsers.ParserC
> onfigurationException,java.io.IOException,org.xml.sax.SAXException] threw 
> exception; nested exception is java.lang.NoCla
> ssDefFoundError: org/apache/log4j/Priority
>         at 
> org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy
> .java:181)
>         at 
> org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolv
> er.java:570)
>         ... 127 more
> Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Priority
>         at org.apache.solr.core.CoreContainer.load(CoreContainer.java:433)
>         at org.apache.solr.core.CoreContainer.load(CoreContainer.java:358)
>         at org.apache.solr.core.CoreContainer.<init>(CoreContainer.java:160)
>         at 
> org.springframework.data.solr.server.support.EmbeddedSolrServerFactory.createPathConfiguredSolrServer(Embedde
> dSolrServerFactory.java:101)
>         at 
> org.springframework.data.solr.server.support.EmbeddedSolrServerFactory.initSolrServer(EmbeddedSolrServerFacto
> ry.java:77)
>         at 
> org.springframework.data.solr.server.support.EmbeddedSolrServerFactory.getSolrServer(EmbeddedSolrServerFactor
> y.java:70)
>         at 
> com.xxxxxxx.platform.core.config.SolrsearchConfig.defaultSolrServer(SolrsearchConfig.java:32)
>         at 
> com.xxxxxx.platform.core.config.SolrsearchConfig$$EnhancerByCGLIB$$c571c5a6.CGLIB$defaultSolrServer$1(<gener
> ated>)
>         at 
> com.xxxxxx.platform.core.config.SolrsearchConfig$$EnhancerByCGLIB$$c571c5a6$$FastClassByCGLIB$$f67069c2.invo
> ke(<generated>)
>         at 
> org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
>         at 
> org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(Configurati
> onClassEnhancer.java:286)
>         at 
> com.xxxxxx.platform.core.config.SolrsearchConfig$$EnhancerByCGLIB$$c571c5a6.defaultSolrServer(<generated>)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:606)
>         at 
> org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy
> .java:160)
>         ... 128 more
> Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Priority
>         at 
> org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
>         at 
> org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
>         at 
> org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
>         at 
> org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:430)
>         at 
> org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:383)
>         ... 145 more
> {code}
> Seems like Solr relies on Log4J version 1.x. 



--
This message was sent by Atlassian JIRA
(v6.1#6144)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to