SSM框架项目遇到的问题汇总

1. URI is not registered (Settings | Languages & Frameworks | Schemas and DTDs)

表现:xml文件的 <beans xmlns=http://www.springframework.org/schema/beans  报错

解决:关闭IDEA的离线状态

2. 问题:模块下的dubbo依赖报错(红色波浪线)

解决:下载dubbo对应版本依赖,放到本地maven仓库

3. 问题:逆向工具正常运行,但是生成不了文件

原因:逆向工程中的路径问题,windows和mac等的文件系统路径不同

mac和Linux下应该使用./,windows下应该使用.\

4. java.lang.IllegalStateException: Failed to check the status of the service sellergoods.service.BrandService

解决:@Service注解的包是dubbo不是spring

5. java.lang.ClassNotFoundException: com.mysql.cj.jdbc.Driver

解决:去掉cj.

6. dubbo连接数据库时报超时错误

原因:数据库配置错误

解决步骤:

  • 把数据库连接版本从5换成8;

此时报事务配置错误

  • 添加事务配置;

此时报错:Receiver class org.mybatis.spring.transaction.SpringManagedTransaction does not define or inherit an implementation of the resolved method abstract getTimeout()Ljava/lang/Integer; of interface org.apache.ibatis.transaction.Transaction.

  • 修改mybatis-spring版本

7. 注意script不能直接 /> 结束

8. 问题:添加分页插件后,前端页面不显示列表内容

解决:换谷歌浏览器

9. 问题:service层启动报错:java.lang.RuntimeException: java.io.IOException: invalid constant type: 18

解决:javassist依赖版本换成3.18.1+

10. Error: [$injector:unpr]

关键字错误

原因:angularjs的service中注入了$scope

解决:用传值方式传入参数

11. AngularJs、Select2页面报错:

[$compile:nonassign] http://errors.angularjs.org/1.2.9/$compile/nonassign?p0=undefined&p1=select2

不影响程序执行

原因:ng-model内容不是 {id:0,text:xx} 形式

12. 页面错误:Uncaught Error: [$injector:modulerr]…

原因:js页面引用了分页组件,html页面没有引入分页js

13. 500

  • 500: Servlet.init()

原因:manager中调用了goods服务,执行ad页面时,没有开goods服务

  • HTTP Status 500 - {msg=SolrCore 'collection1' is not available due to init failure:

Could not load conf for core collection1: 

Unknown fieldType 'text_ik' specified on field item_title. 

Schema file is …/schema.xml,trace=org.apache.solr.common.SolrException:

SolrCore 'collection1' is not available due to init failure: 

Could not load conf for core collection1: 

Unknown fieldType 'text_ik' specified on field item_title. 

添加:

<fieldType name="text_ik" class="solr.TextField">

     <analyzer class="org.wltea.analyzer.lucene.IKAnalyzer"/>

</fieldType>

  • HTTP Status 500 - Servlet.init() for servlet springmvc threw exception. root cause. java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.exc.InvalidDefinitionException. 

解决:添加依赖:

<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    <version>2.9.4</version>
</dependency>
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-annotations</artifactId>
    <version>2.9.4</version>
</dependency>
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-core</artifactId>
    <version>2.9.4</version>
</dependency>

14. 图片上传错误:org.springframework.security.access.AccessDeniedException: Access is denied

使用了安全框架,没有登录,导致没有访问权限

15. Spring使用redis报错:Caused by: java.net.ConnectException: Connection refused (Connection refused)

没有启动redis服务

16. Solr启动报错:HTTP Status 500 - {msg=SolrCore 'collection1' is not available due to init failure

原因:web.xml中的内容修改后,没有取消注释

17. Unknown fieldType 'text_ik' specified on field item_title

添加text_ik

18. java.lang.ClassNotFoundException: javax.jms.JMSContext

使用的spring版本是5.0.4.RELEASE,activemq-core版本5.7.0。这个版本的Spring需要使用JMS 2.0版本,但spring-jms的依赖没有自动导入JMS 2.0,而activemq-core会导入JMS 1.1的依赖,这就导致出现版本问题

可以添加一下依赖解决,JMS 2.0 依赖如下

<dependency>
    <groupId>javax.jms</groupId>
    <artifactId>javax.jms-api</artifactId>
    <version>2.0.1</version>
</dependency>

为了防止冲突,可以从activemq-core中去除JMS 1.1,pom 如下所示

<dependency>
    <groupId>org.apache.activemq</groupId>
    <artifactId>activemq-core</artifactId>
    <version>5.7.0</version>
    <exclusions>
        <exclusion>
            <artifactId>spring-context</artifactId>
            <groupId>org.springframework</groupId>
        </exclusion>
        <exclusion>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-jms_1.1_spec</artifactId>
        </exclusion>
    </exclusions>
</dependency>

19. Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'htmlListener' available

去掉dubbo之后,注意添加包扫描

20. activemq的topic消费者不响应

配置文件使用ActiveMQTopic

21. 单点登录http登录不上:

You are currently accessing CAS over a non-secure connection. Single Sign On WILL NOT WORK. In order to have single sign on work, you MUST log in over HTTPS.

使用加密密码

数据库连接jar的版本要对应

22. Maven install错误:java.lang.IllegalStateException: Failed to load ApplicationContext

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test (default-test) on project ecommerce_manager_web: There are test failures.

解决:在build中添加(maven跳过test)

<plugin>  
        <groupId>org.apache.maven.plugins</groupId>  
        <artifactId>maven-surefire-plugin</artifactId>  
        <version>2.4.2</version>  
        <configuration>  
          <skipTests>true</skipTests>  
        </configuration>  
</plugin>

23. 单点登录+security错误:

  • org.springframework.security.access.AccessDeniedException: Access is denied

原因:security配置错误:

<beans:property name="loginUrl" value="http://localhost:8080/cas/login"/>
  • 登录成功显示ticket

原因:配置错误

        正确配置:

<beans:property name="service" value="http://localhost:9106/ecommerce_user_web/login/cas"/>

24. java.lang.ClassNotFoundException: org.joda.time.YearMonth

<dependency>
    	<groupId>joda-time</groupId>
    <artifactId>joda-time</artifactId>
    <version>2.9.4</version>
</dependency>

25. 模块在maven中显示灰色

26. securitycontextholder空指针异常

将获取name的方法写进intercept-url

<intercept-url pattern="/user/*.do" access="IS_AUTHENTICATED_ANONYMOUSLY"/>

27. 1093-You can’t specify target table for update in FROM clause

update语句中包含的子查询的表和update的表为同一张表时,报错:1093-You can’t specify target table for update in FROM clause

解决:将子查询外再套一张表

28. 秒杀service启动错误

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'common.IdWorker' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

原因:common包的工具类IdWorker是直接用的,不用加Autowire注解

 

 

发布了97 篇原创文章 · 获赞 52 · 访问量 5万+

猜你喜欢

转载自blog.csdn.net/poppy_rain/article/details/104444046
今日推荐