|
I am fairly new to both spring & mybatis - while creating a sample
project I encountered a strange error I can't seem to figure out - any help would be appreciated. Using the mybatis generator, I created artifacts (models, mappers & xml) for a just a few of the 800+ total tables of an existing database. I was then able to successfully inject one of the mappers into a service bean, and run a simple unit test to verify actual data was being rerieved from the database. However, when I created artifacts for all of the tables and attempted to run the same unit test, I get: ... lines omitted ... 16:54:36.984 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'userLoginMapper' 16:54:36.984 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating instance of bean 'userLoginMapper' 16:54:36.985 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Eagerly caching bean 'userLoginMapper' to allow for resolving potential circular references 16:54:36.985 [main] DEBUG o.s.b.f.annotation.InjectionMetadata - Processing injected method of bean 'userLoginMapper': AutowiredMethodElement for public final void org.mybatis.spring.support.SqlSessionDaoSupport.setSqlSessionTemplate(org.mybatis.spring.SqlSessionTemplate) 16:54:36.986 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor' 16:54:36.986 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning eagerly cached instance of singleton bean 'userLoginMapper' that is not fully initialized yet - a consequence of a circular reference 16:54:36.987 [main] DEBUG o.s.b.f.annotation.InjectionMetadata - Processing injected method of bean 'userLoginMapper': AutowiredMethodElement for public final void org.mybatis.spring.support.SqlSessionDaoSupport.setSqlSessionFactory(org.apache.ibatis.session.SqlSessionFactory) 16:54:36.988 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'sqlSessionFactory' 16:54:37.135 [main] ERROR o.s.web.context.ContextLoader - Context initialization failed java.lang.NoClassDefFoundError: org.springframework.beans.BeansException at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java: 527) ~[spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java: 456) ~[spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory $1.getObject(AbstractBeanFactory.java:294) ~[spring- beans-3.1.1.RELEASE.jar:3.1.1.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java: 225) ~[spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java: 291) ~[spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java: 193) ~[spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java: 585) ~[spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java: 913) ~[spring-context-3.1.1.RELEASE.jar:3.1.1.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java: 464) ~[spring-context-3.1.1.RELEASE.jar:3.1.1.RELEASE] at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java: 385) ~[spring-web-3.1.1.RELEASE.jar:3.1.1.RELEASE] at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java: 284) ~[spring-web-3.1.1.RELEASE.jar:3.1.1.RELEASE] at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java: 111) [spring-web-3.1.1.RELEASE.jar:3.1.1.RELEASE] At one point I discovered that if I did nothing else but reduce the number of mapper interfaces to some number below 370-375, the problem goes away. Which mappers I choose makes no difference, as long as the number is below 370 - and if I choose to include a number between 370 and 375, it appears to be random whether the problem occurs or not. org.springframework.beans.BeansException is clearly on the classpath... I thought it might be a memory problem, so I tried running with -Xmx512m and -Xmx1024m but neither helped. |
| Powered by Nabble | Edit this page |
