0

i'm getting exception after getting into httpInvoker, it looks like this:

    INFO: Initializing Spring FrameworkServlet 'httpInvoker' pro 23, 2015
 4:34:04 PM org.apache.catalina.core.ApplicationContext log SEVERE:
 StandardWrapper.Throwable java.lang.NoClassDefFoundError:
 org.springframework.beans.FatalBeanException  at
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
   at
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
   at
 org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
   at
 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
   at
 org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
   at
 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
   at
 org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
   at
 org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
   at
 org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
   at
 org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:631)
   at
 org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:588)
   at
 org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:645)
   at
 org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:508)
   at
 org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:449)
   at
 org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:133)
   at javax.servlet.GenericServlet.init(GenericServlet.java:158)   at
 org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1231)
   at
 org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1144)
   at
 org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1031)
   at
 org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4997)
   at
 org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5289)
   at
 org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
   at
 org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
   at
 org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
   at java.util.concurrent.FutureTask.run(FutureTask.java:266)     at
 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
   at
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
   at java.lang.Thread.run(Thread.java:745)

 pro 23, 2015 4:34:04 PM org.apache.catalina.core.StandardContext
 loadOnStartup SEVERE: Servlet [httpInvoker] in web application
 [/services] threw load() exception java.lang.NoClassDefFoundError:
 org.springframework.beans.FatalBeanException  at
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
   at
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
   at
 org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
   at
 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
   at
 org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
   at
 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
   at
 org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
   at
 org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
   at
 org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
   at
 org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:631)
   at
 org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:588)
   at
 org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:645)
   at
 org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:508)
   at
 org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:449)
   at
 org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:133)
   at javax.servlet.GenericServlet.init(GenericServlet.java:158)   at
 org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1231)
   at
 org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1144)
   at
 org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1031)
   at
 org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4997)
   at
 org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5289)
   at
 org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
   at
 org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
   at
 org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
   at java.util.concurrent.FutureTask.run(FutureTask.java:266)     at
 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
   at
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
   at java.lang.Thread.run(Thread.java:745)

After hours of research, I found that spring-db.xml is where the problem occurs. In there there are definitions to connecting for example to com.mchange.v2.c3p0.ComboPooledDataSource, or enviromentProperties. I tried step by step, line by line commenting/uncommeting something from there, and in there is part defined like this:

   <!-- <tx:annotation-driven /> -->
    <tx:annotation-driven transaction-manager="transactionManager" /> 

    <!-- define the SqlSessionFactory -->
    <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="typeAliasesPackage" value="hr.test.model" />
    </bean>


    <!-- scan for mappers and let them be autowired -->
    <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
        <property name="basePackage" value="hr.test.dao.api.mappers" />
    </bean>

When I comment last bean which is calling configurer, everything passes well (without exception).

What to do to stop getting that exception? Maybe I must write that bean in some other way? (sorry for not giving whole code, I'm restricted for giving it..)

I'm using: Eclipse Mars Java 1.8 Spring 3.1 MyBatis 32 bit Windows

Avis
  • 2,197
  • 18
  • 28
DarioBB
  • 663
  • 2
  • 8
  • 29

1 Answers1

0

Above exception didn't show if you comment following line

<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
        <property name="basePackage" value="hr.test.dao.api.mappers" />
    </bean>

then i believe you must be missing the mybatis-spring.jar in your project. Pls try including following in your project :-

<dependency>
    <groupId>org.mybatis</groupId>
    <artifactId>mybatis-spring</artifactId>
    <version>1.2.3</version>
</dependency>
Avis
  • 2,197
  • 18
  • 28