You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by JMill <ap...@googlemail.com> on 2013/09/20 20:24:55 UTC

Cause of NullPointer Exception? (Solr with Spring Data)

I am unsure about the cause of the following NullPointer Exception.  Any
Ideas?

Thanks

Exception in thread "main"
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'aDocumentService': Injection of autowired dependencies
failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Could not autowire
field: com.project.core.solr.repository.DocumentRepository
com.project.core.solr.service.impl.DocumentServiceImpl.DocRepo; nested
exception is org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'DocumentRepository': FactoryBean threw exception
on object creation; nested exception is java.lang.NullPointerException
    at
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:288)
    at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1116)
    at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
    at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
    at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
    at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.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.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:626)
    at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
    at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
    at
org.springframework.context.annotation.AnnotationConfigApplicationContext.<init>(AnnotationConfigApplicationContext.java:73)
    at com.project.core.solr..DocumentTester.main(DocumentTester.java:18)
Caused by: org.springframework.beans.factory.BeanCreationException: Could
not autowire field: com.project.core.solr.repository.DocumentRepository
com.project.core.solr.service.impl.DocumentServiceImpl.DocRepo; nested
exception is org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'DocumentRepository': FactoryBean threw exception
on object creation; nested exception is java.lang.NullPointerException
    at
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:514)
    at
org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
    at
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285)
    ... 12 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'DocumentRepository': FactoryBean threw exception
on object creation; nested exception is java.lang.NullPointerException
    at
org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:149)
    at
org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:102)
    at
org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1454)
    at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:306)
    at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at
org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:910)
    at
org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:853)
    at
org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:768)
    at
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:486)
    ... 14 more
Caused by: java.lang.NullPointerException
    at
org.springframework.data.solr.repository.support.MappingSolrEntityInformation.getIdAttribute(MappingSolrEntityInformation.java:68)
    at
org.springframework.data.solr.repository.support.SimpleSolrRepository.<init>(SimpleSolrRepository.java:73)
    at
org.springframework.data.solr.repository.support.SolrRepositoryFactory.getTargetRepository(SolrRepositoryFactory.java:64)
    at
org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:136)
    at
org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:153)
    at
org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:43)
    at
org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
    ... 22 more

Re: Cause of NullPointer Exception? (Solr with Spring Data)

Posted by JMill <ap...@googlemail.com>.
I am able to reach http://localhost:8983/solr/#/

Here is the Log Content.  It not much.

Time Level Logger Message  12:38:47 WARN SolrCore [collection1] Solr index
directory
'/usr/local/Cellar/solr/4.4.0/libexec/example/solr/collection1/data/index'
doesn't exist. Creating new index..



On Sat, Sep 21, 2013 at 12:57 PM, Furkan KAMACI <fu...@gmail.com>wrote:

> Your solr server may not bet working correctly. You should give us
> information about your solr logs instead of Spring. Can you reach Solr
> admin page?
>
> 20 Eylül 2013 Cuma tarihinde JMill <ap...@googlemail.com> adlı
> kullanıcı şöyle yazdı:
> > I am unsure about the cause of the following NullPointer Exception.  Any
> > Ideas?
> >
> > Thanks
> >
> > Exception in thread "main"
> > org.springframework.beans.factory.BeanCreationException: Error creating
> > bean with name 'aDocumentService': Injection of autowired dependencies
> > failed; nested exception is
> > org.springframework.beans.factory.BeanCreationException: Could not
> autowire
> > field: com.project.core.solr.repository.DocumentRepository
> > com.project.core.solr.service.impl.DocumentServiceImpl.DocRepo; nested
> > exception is org.springframework.beans.factory.BeanCreationException:
> Error
> > creating bean with name 'DocumentRepository': FactoryBean threw exception
> > on object creation; nested exception is java.lang.NullPointerException
> >     at
> >
>
> org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:288)
> >     at
> >
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1116)
> >     at
> >
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
> >     at
> >
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
> >     at
> >
>
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
> >     at
> >
>
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.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.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:626)
> >     at
> >
>
> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
> >     at
> >
>
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
> >     at
> >
>
> org.springframework.context.annotation.AnnotationConfigApplicationContext.<init>(AnnotationConfigApplicationContext.java:73)
> >     at com.project.core.solr..DocumentTester.main(DocumentTester.java:18)
> > Caused by: org.springframework.beans.factory.BeanCreationException: Could
> > not autowire field: com.project.core.solr.repository.DocumentRepository
> > com.project.core.solr.service.impl.DocumentServiceImpl.DocRepo; nested
> > exception is org.springframework.beans.factory.BeanCreationException:
> Error
> > creating bean with name 'DocumentRepository': FactoryBean threw exception
> > on object creation; nested exception is java.lang.NullPointerException
> >     at
> >
>
> org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:514)
> >     at
> >
>
> org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
> >     at
> >
>
> org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285)
> >     ... 12 more
> > Caused by: org.springframework.beans.factory.BeanCreationException: Error
> > creating bean with name 'DocumentRepository': FactoryBean threw exception
> > on object creation; nested exception is java.lang.NullPointerException
> >     at
> >
>
> org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:149)
> >     at
> >
>
> org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:102)
> >     at
> >
>
> org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1454)
> >     at
> >
>
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:306)
> >     at
> >
>
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
> >     at
> >
>
> org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:910)
> >     at
> >
>
> org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:853)
> >     at
> >
>
> org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:768)
> >     at
> >
>
> org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:486)
> >     ... 14 more
> > Caused by: java.lang.NullPointerException
> >     at
> >
>
> org.springframework.data.solr.repository.support.MappingSolrEntityInformation.getIdAttribute(MappingSolrEntityInformation.java:68)
> >     at
> >
>
> org.springframework.data.solr.repository.support.SimpleSolrRepository.<init>(SimpleSolrRepository.java:73)
> >     at
> >
>
> org.springframework.data.solr.repository.support.SolrRepositoryFactory.getTargetRepository(SolrRepositoryFactory.java:64)
> >     at
> >
>
> org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:136)
> >     at
> >
>
> org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:153)
> >     at
> >
>
> org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:43)
> >     at
> >
>
> org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
> >     ... 22 more
> >
>

Re: Cause of NullPointer Exception? (Solr with Spring Data)

Posted by Furkan KAMACI <fu...@gmail.com>.
Your solr server may not bet working correctly. You should give us
information about your solr logs instead of Spring. Can you reach Solr
admin page?

20 Eylül 2013 Cuma tarihinde JMill <ap...@googlemail.com> adlı
kullanıcı şöyle yazdı:
> I am unsure about the cause of the following NullPointer Exception.  Any
> Ideas?
>
> Thanks
>
> Exception in thread "main"
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean with name 'aDocumentService': Injection of autowired dependencies
> failed; nested exception is
> org.springframework.beans.factory.BeanCreationException: Could not
autowire
> field: com.project.core.solr.repository.DocumentRepository
> com.project.core.solr.service.impl.DocumentServiceImpl.DocRepo; nested
> exception is org.springframework.beans.factory.BeanCreationException:
Error
> creating bean with name 'DocumentRepository': FactoryBean threw exception
> on object creation; nested exception is java.lang.NullPointerException
>     at
>
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:288)
>     at
>
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1116)
>     at
>
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
>     at
>
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
>     at
>
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
>     at
>
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.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.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:626)
>     at
>
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
>     at
>
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
>     at
>
org.springframework.context.annotation.AnnotationConfigApplicationContext.<init>(AnnotationConfigApplicationContext.java:73)
>     at com.project.core.solr..DocumentTester.main(DocumentTester.java:18)
> Caused by: org.springframework.beans.factory.BeanCreationException: Could
> not autowire field: com.project.core.solr.repository.DocumentRepository
> com.project.core.solr.service.impl.DocumentServiceImpl.DocRepo; nested
> exception is org.springframework.beans.factory.BeanCreationException:
Error
> creating bean with name 'DocumentRepository': FactoryBean threw exception
> on object creation; nested exception is java.lang.NullPointerException
>     at
>
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:514)
>     at
>
org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
>     at
>
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285)
>     ... 12 more
> Caused by: org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'DocumentRepository': FactoryBean threw exception
> on object creation; nested exception is java.lang.NullPointerException
>     at
>
org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:149)
>     at
>
org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:102)
>     at
>
org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1454)
>     at
>
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:306)
>     at
>
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
>     at
>
org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:910)
>     at
>
org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:853)
>     at
>
org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:768)
>     at
>
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:486)
>     ... 14 more
> Caused by: java.lang.NullPointerException
>     at
>
org.springframework.data.solr.repository.support.MappingSolrEntityInformation.getIdAttribute(MappingSolrEntityInformation.java:68)
>     at
>
org.springframework.data.solr.repository.support.SimpleSolrRepository.<init>(SimpleSolrRepository.java:73)
>     at
>
org.springframework.data.solr.repository.support.SolrRepositoryFactory.getTargetRepository(SolrRepositoryFactory.java:64)
>     at
>
org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:136)
>     at
>
org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:153)
>     at
>
org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:43)
>     at
>
org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
>     ... 22 more
>