搭建maven项目中遇见的问题

搭建maven项目中遇见的问题

问题:“Dynamic Web Module 3.0 requires Java 1.6 or newer.”

问题原因:jdk的版本不对

解决方式:在pom.xml中build标签中加入

<plugins>  
    <plugin>  
        <groupId>org.apache.maven.plugins</groupId>  
        <artifactId>maven-compiler-plugin</artifactId>  
        <version>2.3.2</version>  
        <configuration>  
            <source>1.6</source>  
            <target>1.6</target>  
        </configuration>  
    </plugin>  
</plugins>  

问题:Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener

问题:Tomcat启动报错 Document base ……does not exist or is not a readable directory

原因:tmp0\conf\server.xml 中Context节点配置了很多已经移除的项目
解决方法:
1. 删除无用的 tmp0\conf\server.xml 中的 Context 节点;
2. 删除 tmp0\work\Catalina\localhost 下的所有文件夹;

问题:
Error creating bean with name ‘org.springframework.context.annotation.internalAsyncAnnotationProcessor’。。。。
@EnableAsync annotation metadata was not injected

问题原因:在applicationContext.xml中 配置包扫描器时, 使用了*, 想扫描所有的包; 而这种方式有可能扫描到spring自带的包, 造成错。

<context:component-scan base-package="*"/>

解决办法:改为

<context:component-scan base-package="service.*,dao.*,action.*"/>

问题:新建的maven项目中没有src/main/java等文件夹

解决:在项目上右键选择properties,然后点击java build path,在Librarys下,编辑JRE System Library,选择workspace default jre就可以了。

问题:Unsatisfied dependency expressed through field

解决:可能是因为有多个,autowired不知道该注入那一个

猜你喜欢

转载自blog.csdn.net/u011391773/article/details/68921385