Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.IllegalAccessError: org.apache.commons.dbcp.DelegatingPreparedStatement.isClosed()Z

i tried to make integration of spring and mybatis.

jdk:1.8

run my test:

    @Test
    public void testFindUserById() throws Exception{
        UserMapper userMapper=(UserMapper)applicationContext.getBean("userMapper");
        User user=userMapper.findUserById(1);
        System.out.println(user);
    }

and error:the full stacktrace

java.lang.IllegalAccessError: org.apache.commons.dbcp.DelegatingPreparedStatement.isClosed()Z

The spring configuration file:

    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
        destroy-method="close">
        <property name="driverClassName" value="com.mysql.jdbc.Driver" />
        <property name="url" value="jdbc:mysql://localhost:3306/custom?useSSL=false" />
        <property name="username" value="root" />
        <property name="password" value="qqwe5631652" />
        <property name="maxIdle" value="5" />
    </bean>

    <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="configLocation" value="classpath:SqlMapConfig.xml" />

    </bean>
    <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
        <property name="basePackage" value="mapper" />
        <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
        </bean>

    <bean id="userDao" class="dao.UserDaoImpl">
        <property name="sqlSessionFactory" ref="sqlSessionFactory" />

    </bean>
</beans>

file's structure all of ‘.jar’

It 's java.lang.IllegalAccessError about authority? i have no idea

like image 457
Peter Avatar asked May 30 '26 05:05

Peter


1 Answers

i change commons-dbcp-1.2.1.jar into commons-dbcp-1.4.jar ,and it 's ok now!

like image 75
Peter Avatar answered May 31 '26 18:05

Peter



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!