• 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Spring IOC issues in MVC WebApplication with JSF integration

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,

I am getting null pointer exception while using spring's IOC feature in my application.

I have created one Spring + JSF Application in Eclipse ID given instruction at link http://www.javabeat.net/articles/39-integrating-spring-and-jsf-3.html.
This is working fine.

I tried to modify this code and instead of initializing the Map from the default constructor I have added below code in applicationContext.xml like

<util:map id="stockSymbolsAndValuesMap" map-class="java.util.HashMap">
<entry key="AAA" value="100"></entry>
<entry key="BBB" value="200"></entry>
<entry key="CCC" value="300"></entry>
<entry key="DDD" value="400"></entry>
<entry key="EEE" value="500"></entry>
</util:map>

and add this id's ref something like below.

<bean id="stockBean"
class="net.javabeat.articles.springjsf.introduction.StockValueFetcher">
<property name="stockBeanValue" ref="stockBean"></property>
</bean>


and modified the bean some thing like

public class StockValueFetcher {

private Map<String, String> stockSymbolsAndValues;
// with some getters and setters

}

while taking this map to my public String findStockValue() method I am getting null when I do stockSymbolsAndValues.containsKey(symbolName);.

I did this map injection in plain java main spring program and its working fine. So, in this case am I doing anything wrong or missing anything. Please guide me on this.

Thanks And Regards
Jaik






 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic