First, the error phenomenon
[HTML]View PlainCopy
- Severity: Context initialization failed
- org.springframework.beans.factory.beancreationexception: error creating bean with name ' org.mybatis.spring.mapper.mapperscannerconfigurer#0 ' defined in url [file:/f:/ workspaces/.metadata/.me_tcat7/webapps/jade_admin/web-inf/classes/config/spring/ applicationcontext-resources.xml]: cannot resolve reference to bean ' Sqlsessionfactory ' while setting bean property ' sqlsessionfactory '; nested exception is org.springframework.beans.factory.beancreationexception: error creating bean with name ' Sqlsessionfactory ' defined in url [file:/f:/workspaces/. metadata/.me_tcat7/webapps/jade_admin/web-inf/classes/config/spring/applicationcontext-resources.xml]: invocation of init method failed; nested exception is Org.springframework.core.nestedioexception: failed to parse config resource: class path resource [config/mybatis/configuration.xml]; nested exception is org.apache.ibatis.builder.builderexception: error parsing Sql mapper configuration. cause: org.apache.ibatis.builder.builderexception: error creating instance. Cause: java.lang.IllegalStateException: Cannot enable lazy loading because cglib is not available. add cglib to your classpath.
- At Org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference ( beandefinitionvalueresolver.java:334)
- At Org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary ( beandefinitionvalueresolver.java:108)
- At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues ( abstractautowirecapablebeanfactory.java:1417)
- At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean ( abstractautowirecapablebeanfactory.java:1158)
- At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean ( abstractautowirecapablebeanfactory.java:519)
- At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean ( abstractautowirecapablebeanfactory.java:458)
- At Org.springframework.beans.factory.support.abstractbeanfactory$1.getobject (abstractbeanfactory.java:296)
Second, the solution
1 Add reflectasm package to Pom.xml, this package can provide mapping mechanism.
[HTML]View PlainCopy
- <dependency>
- <groupId>com.esotericsoftware.reflectasm</groupId>
- <artifactid>reflectasm</artifactid>
- <version>1.09</version>
- </Dependency>
2 adding Cglib-3.1.jar to/src/main/webapp/web-inf/lib/
Maven Web project configuration MyBatis solution with sqlsessionfactory error