项目“No bean named 'shiroFilter' is defined”错误处理

一个项目在本地运行一直报“No bean named ‘shiroFilter’ is defined”,但从Gitlab上面拉下来的代码却能正常动行,
为了找到原因,下载了Beyond Compare进行文件对比,最后发现.settings隐藏目录下的org.eclipse.wst.common.component文件存在差异。

错误信息

严重: Exception starting filter shiroFilter
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'shiroFilter' is defined
  at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:641)
  at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1159)
  ......

文件对比

GitLab文件内容是:

<project-modules id="moduleCoreId" project-version="1.5.0">
    <wb-module deploy-name="DeviceService">
        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
        <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
        <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
        <wb-resource deploy-path="/WEB-INF/classes" source-path="/libs"/>
        <property name="java-output-path" value="/DeviceService/target/classes"/>
        <property name="context-root" value="DeviceServiceGit"/>
    wb-module>
project-modules>

本地的文件内容:

<project-modules id="moduleCoreId" project-version="1.5.0">
    <wb-module deploy-name="DeviceService">
        <wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/>
        <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
        <wb-resource deploy-path="/" source-path="/src/main/webapp"/>
        <property name="java-output-path" value="/java-wifi-story-device-manager/bin"/>
        <property name="context-root" value="DeviceService"/>
    wb-module>
project-modules>

关于org.eclipse.wst.common.component

org.eclipse.wst.common.component文件规定了项目怎么组装成一个webapp
项目“No bean named 'shiroFilter' is defined”错误处理_第1张图片
典型内容


<project-modules id="moduleCoreId" project-version="1.5.0">
    <wb-module deploy-name="inkfish-web">
        <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
        <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
        <property name="context-root" value="inkfish-web"/>
        <property name="java-output-path" value="/inkfish-web/target/classes"/>
    wb-module>
project-modules>

拷贝攻略
org.eclipse.wst.common.component文件不可直接拷贝,如需拷贝注意修改deploy-name、某些value等一些与项目名称相关的信息。

你可能感兴趣的:(Java)