Click here to Skip to main content
11,802,442 members (70,766 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: Java MongoDB
My Conf.xml file contains

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""
	<bean id="mongoTemplate" class="">
		<constructor-arg ref="mongoDbFactory"/> 	
	<bean id ="mongoDbFactory" class="">
		<constructor-arg ref="mongo"/>
		<constructor-arg name="databaseName" value="mydb" type="String"/>
	<bean id="mongo" class="com.mongodb.Mongo">
		<constructor-arg name="host" value="" type="String"/>
		<constructor-arg name="port" value="27017" type="int"/>

And the Error which is I am getting is as follows

Failed to load application context

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoTemplate' defined in class path resource [mongo-conf.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class []: Constructor threw exception; nested exception is java.lang.IllegalAccessError: tried to access method org.springframework.core.GenericTypeResolver.getTypeVariableMap(Ljava/lang/Class;)Ljava/util/Map; from class
Posted 21-Feb-12 1:21am
Edited 21-Feb-12 2:07am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Quelle Surprise - your config file "mongo-conf.xml" is not ok. But I guess you already figured that.

Do you really provide a DB called "mydb" ?? is it available at localhost? can you address it (ping or so)?
NapsterBack at 22-Feb-12 3:11am
Ya it is on localhost , I ping the port it is working. There is database mydb which is created through mongo. And what is wrong in my conf file I am not getting it
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

i have the same problem. Did you get any resolution to this problem ?

I have posted a similar question on spring forums.[^]
NapsterBack at 16-Apr-12 3:24am
I hard coded in the core java... Works fine

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 445
1 KrunalRohit 366
2 F-ES Sitecore 295
3 Afzaal Ahmad Zeeshan 230
4 CPallini 230
0 OriginalGriff 2,950
1 Maciej Los 1,910
2 KrunalRohit 1,862
3 CPallini 1,645
4 Richard MacCutchan 1,157

Advertise | Privacy | Mobile
Web03 | 2.8.151002.1 | Last Updated 9 Mar 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100