• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

NoSuchField: logger from AnnotationConfigApplicationContext

Posts: 2419
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I am running an example in ch 9 of Getting started with Springframework 4th edition:


NFO  org.springframework.context.annotation.AnnotationConfigApplicationContext - Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@3ecd23d9: startup date [Sat Jul 14 18:58:26 EDT 2018]; root of context hierarchy
Exception in thread "main" java.lang.NoSuchFieldError: logger
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:212)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:87)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:693)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531)
at sample.spring.chapter09.bankapp.BankApp.main(BankApp.java:24)

The exception is thrown from the context.refresh. Please help.
[Thumbnail for fileStructure.JPG]
file structure
Himai Minh
Posts: 2419
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let me answer my own question.
I first created the QBankAccountDetails.java and QFixedDepositDetails.java and their classes by adding the dependencies below and changed the plugins:
In pom.xml:


Download Apache Maven. Set the path variables as instructed by MKyong (https://www.mkyong.com/maven/how-to-install-maven-in-windows/).
In a command prompt, navigate to the ch09-spring-mongo-data project folder. Type mvn compile. This can generate the Q-classes and java code in the target/generated-sources/java.
Copy the Q-classes , in this case, QBankAccountDetail.java  and QFixedDepositDetails.java to the corresponding package.

Close and delete the ch09-spring-mongo-data project from the Eclipse workspace. Open the original project with the original pom.xml file. Copy the Q classes to the corresponding package in the original project.
Now, the original project can compile with the Q classes.
Install MongoDB community instruction and follow their instruction to run it.
Run the BankApp.java from the original project. It should work.
    Bookmark Topic Watch Topic
  • New Topic