程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程綜合問答 >> spring-tomcat啟動報錯 Context initialization failed

spring-tomcat啟動報錯 Context initialization failed

編輯:編程綜合問答
tomcat啟動報錯 Context initialization failed

可以啟動,但是控制台顯示有錯誤,登陸網頁也是404錯誤,控制台信息如下:

信息: Initializing Spring root WebApplicationContext
2015-08-10 18:56:14,282 ERROR [org.springframework.web.context.ContextLoader] - Context initialization failed
java.lang.IllegalStateException: Could not create MetadataReader for class serviceImpl.serviceimpl

at org.springframework.context.annotation.ConfigurationClassPostProcessor.isFeatureConfiguration(ConfigurationClassPostProcessor.java:286)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.retrieveFeatureConfigurationBeans(ConfigurationClassPostProcessor.java:253)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processFeatureConfigurationClasses(ConfigurationClassPostProcessor.java:210)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigurationClasses(ConfigurationClassPostProcessor.java:203)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:176)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:604)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:437)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:294)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:215)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4728)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5166)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: class path resource [serviceImpl/serviceimpl.class] cannot be opened because it does not exist
at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:158)
at org.springframework.core.type.classreading.SimpleMetadataReader.(SimpleMetadataReader.java:45)
at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80)
at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:76)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.isFeatureConfiguration(ConfigurationClassPostProcessor.java:279)
... 18 more

applicationContext.xml如下:

<?xml version="1.0" encoding="UTF-8"?>

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">

<!-- Scans the classpath of this application for @Components to deploy as beans -->
<context:component-scan base-package="cn.com.syis.hisol.hrms" />

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

<tx:advice id="txAdvice" transaction-manager="transactionManager">
    <tx:attributes>
        <tx:method name="regist*" propagation="REQUIRED" isolation="READ_COMMITTED" read-only="false" rollback-for="java.lang.Exception" />
        <tx:method name="insert*" propagation="REQUIRED" isolation="READ_COMMITTED" read-only="false" rollback-for="java.lang.Exception" />
        <tx:method name="update*" propagation="REQUIRED" isolation="READ_COMMITTED" read-only="false" rollback-for="java.lang.Exception" />
        <tx:method name="create*" propagation="REQUIRED" isolation="READ_COMMITTED" read-only="false" rollback-for="java.lang.Exception" />
        <tx:method name="edit*" propagation="REQUIRED" isolation="READ_COMMITTED" read-only="false" rollback-for="java.lang.Exception" />
        <tx:method name="delete*" propagation="REQUIRED" isolation="READ_COMMITTED" read-only="false" rollback-for="java.lang.Exception" />
        <tx:method name="revise*" propagation="REQUIRED" isolation="READ_COMMITTED" read-only="false" rollback-for="java.lang.Exception"/>
        <tx:method name="confirm*" propagation="REQUIRED" isolation="READ_COMMITTED" read-only="false" rollback-for="java.lang.Exception"/>
        <tx:method name="cancel*" propagation="REQUIRED" isolation="READ_COMMITTED" read-only="false" rollback-for="java.lang.Exception"/>
        <tx:method name="refuse*" propagation="REQUIRED" isolation="READ_COMMITTED" read-only="false" rollback-for="java.lang.Exception"/>
        <tx:method name="upload*" propagation="REQUIRED" isolation="READ_COMMITTED" read-only="false" rollback-for="java.lang.Exception"/>
        <tx:method name="*" propagation="REQUIRED" read-only="true"/>
    </tx:attributes>
</tx:advice>

<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    <property name="dataSource" ref="dataSource"/>
</bean>

<aop:config>
    <aop:pointcut id="txPointMethod" expression="execution(* cn.com.syis.hisol.hrms.service.*.*Service*.*(..))" />
    <aop:advisor advice-ref="txAdvice" pointcut-ref="txPointMethod" />
</aop:config>

<!-- ========== RESOURCE DEFINITION ========== -->
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
    <property name="url" value="jdbc:mysql://localhost:3306/hrms?useUnicode=true&amp;characterEncoding=utf-8"/>
    <property name="username" value="root"/>
    <property name="password" value="lk69865970"/>
</bean>


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

<!--  <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
    <property name="basePackage" value="cn.com.syis.hisol.hrms.dao" />
</bean>
-->
<bean id="serviceSvc" name="service" class="serviceImpl.serviceimpl"/>
<bean id="userDaoMaper" class="org.mybatis.spring.mapper.MapperFactoryBean">
 <property name="mapperInterface" value="dao.userDao"/>
 <property name="sqlSessionFactory" ref="sqlSesssionFactory"/>
</bean> 

最佳回答:


Caused by: java.io.FileNotFoundException: class path resource [serviceImpl/serviceimpl.class] cannot be opened because it does not exist
從這個看是找不到你的類文件,你看看有沒有。

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved