Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MyBatis 3.2.0 - Disabled lazy loading but CGLIB is still required to be on classpath #7

Closed
davsclaus opened this issue Mar 7, 2013 · 2 comments

Comments

@davsclaus
Copy link

Hi

I am in the process of upgrading camel-mybatis from 3.1.1 to 3.2.0 and hit a problem.

Caused by: org.apache.ibatis.exceptions.PersistenceException:

Error building SqlSession.

The error may exist in SQL Mapper Configuration

Cause: 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.

I do not have CGLIB on my classpath, nor do I want to. I did not have it on my classpath with MyBatis 3.1.1.

So I added an option to my settings to explicit disable lazy loading as follows

<settings>
    <!-- disable lazy loading for testing as we do not want CGLIB on our classpath -->
    <setting name="lazyLoadingEnabled" value="false"/>
    <setting name="useGeneratedKeys" value="false"/>
</settings>

But I still get that failure.

Debugging the code I get to this point

org.apache.ibatis.builder.xml.XMLConfigBuilder#settingsElement

line 198 has:
configuration.setProxyFactory((ProxyFactory) createInstance(props.getProperty("proxyFactory", "CGLIB")));

I wonder if there is some way to run MyBatis without any proxy factory being CGLIB or JAVASSITS?

@emacarron
Copy link
Member

Hi Claus,

First of all sorry for the bug. It is already fixed in the master branch and we are planning a bug fix release inmediately.

Duplicated of #4

@davsclaus
Copy link
Author

Thanks for the speedy response. We will skip the 3.2.0 release and upgrade when the next is out. Thanks for creating this great framework - has been a fan of MyBatis for a long time :)

harawata pushed a commit that referenced this issue Sep 27, 2019
Merge pull request #1660 from Dreamroute/master
pulllock pushed a commit to pulllock/mybatis-3 that referenced this issue Oct 19, 2023
Merge pull request mybatis#1660 from Dreamroute/master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants