0

I've got a large web application (running on weblogic 11g) that uses a combination of spring, spring-security, mybatis and mybatis-spring. It uses mybatis:scan with a marker-interface (DataAccess) to wire the SqlSessionFactory into our DAOs. We have 61 classes (interfaces) that extend the marker interface.

When we add one more interface that extends DataAccess (the marker) the application fails to start. I'd like to know if anyone can help figure out why adding one more DataAccess causes the application to get these errors.

I can provide any information that will help figure this out but I didn't know what to include in my initial question.

Here are the first two errors in the log4j log file:

2014-Jul-14 12:58:22.659 [ACTIVE] ExecuteThread: '40' for queue: 'weblogic.kernel.Default (self-tuning)' DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory Ignoring bean creation exception on FactoryBean type check: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'paymentsDataAccess' defined in file [/opt/..../tmp/_WL_user/..../an9ko4/APP-INF/classes/com/..../payment/app/dao/PaymentsDataAccess.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory': : Error creating bean with name 'sqlSessionFactory' defined in class path resource [ServiceConfig.xml]: Instantiation of bean failed; nested exception is java.lang.StackOverflowError; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [ServiceConfig.xml]: Instantiation of bean failed; nested exception is java.lang.StackOverflowError

2014-Jul-14 12:58:22.666 [ACTIVE] ExecuteThread: '40' for queue: 'weblogic.kernel.Default (self-tuning)' DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory Ignoring bean creation exception on FactoryBean type check: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'adminSessionDataAccess' defined in file [/opt/..../tmp/_WL_user/..../an9ko4/APP-INF/classes/com/..../dao/AdminSessionDataAccess.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory': : Error creating bean with name 'sqlSessionFactory' defined in class path resource [ServiceConfig.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.mybatis.spring.SqlSessionFactoryBean; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [ServiceConfig.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.mybatis.spring.SqlSessionFactoryBean

The first error has the nested exception of a StackOverflowError and when I've looked at a generated stack trace the call stack is over 1000 methods deep. I can provide the stack trace if asked but it's so big I didn't want to include it unless there is interest.

The PaymentsDataAccess class isn't special in any way - it's just like the other data access classes in the application.

When the application doesn't start there also seems to be another error (in server.log) but I'm not sure if it's related:

java.lang.instrument ASSERTION FAILED: "!errorOutstanding" with message transform method call failed at ../../../src/share/instrument/JPLISAgent.c line: 805

khampson
  • 14,700
  • 4
  • 41
  • 43
Kevin HB
  • 13
  • 3
  • java.lang.NoClassDefFoundError: Could not initialize class org.mybatis.spring.SqlSessionFactoryBean – JamesB Jul 15 '14 at 18:01
  • Yes, but the initialization is just fine when there is one fewer DataAccess bean. Also, there isn't any indication why the initialization failed unless it's the instrument failure. – Kevin HB Jul 15 '14 at 19:01

1 Answers1

0

What's your mybatis-spring version.If your version is lower than 1.2.0, it indeed causes stackoverflow error. And try 1.2.3.

philee
  • 113
  • 1
  • 1
  • 5