Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Error creating bean 'beanId' with name defined in class path

 
vinitha simon
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a JUnit test, in which I'm trying to load the applicationContext. But it gives me the following exception :
org.springframework.beans.factory.BeanCreationException: Error creating bean with name defined in class path resource'com.nationwide.corporate.common.util.ContextualPropertyConfigurer' defined in class path resource [configuration/integrationApplicationContext.xml]: Can't resolve reference to bean 'environment' while setting property 'environment'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'environment': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalArgumentException: System property 'environment' not set and default not specified.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'environment': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalArgumentException: System property 'environment' not set and default not specified.

I'm not sure how to proceed...Any help is appreciated !!
Thanks,
vinitha simon
 
Mark Spritzler
ranger
Posts: 17344
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems in your ContextualPropertyConfigurer you want to inject a value for "environment" But whatever class it needs to create, it can't because it isn't declared in the configuration? or maybe it is of the wrong type. But the first place I would look is at the property environment, what is your "ref" and is that bean declared correctly in your xml.

Mark
 
Power corrupts. Absolute power xxxxxxxxxxxxxxxx is kinda neat.
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!