0

httpInvokerに入った後に例外が発生しました。次のようになります。

    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)

何時間もの調査の結果、spring-db.xml で問題が発生していることがわかりました。そこには、com.mchange.v2.c3p0.ComboPooledDataSource や environmentProperties などに接続するための定義があります。そこから何かをコメント/コメント解除して、段階的に、行ごとに試してみましたが、次のように定義された部分があります。

   <!-- <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>

コンフィギュアラーを呼び出している最後の Bean にコメントすると、すべてが (例外なく) うまくいきます。

その例外の取得を停止するにはどうすればよいですか? 多分私はそのBeanを他の方法で書かなければなりませんか?(コード全体を提供できなくて申し訳ありません。私はそれを提供するために制限されています..)

使用しています: Eclipse Mars Java 1.8 Spring 3.1 MyBatis 32 ビット Windows

4

1 に答える 1

0

次の行にコメントすると、上記の例外は表示されませんでした

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

それなら、プロジェクトに mybatis-spring.jar が欠けているに違いないと思います。プロジェクトに以下を含めてみてください:-

<dependency>
    <groupId>org.mybatis</groupId>
    <artifactId>mybatis-spring</artifactId>
    <version>1.2.3</version>
</dependency>
于 2015-12-24T08:46:13.770 に答える