SSM框架项⽬遇到的问题汇总
1. URI is not registered (Settings | Languages & Frameworks | Schemas and DTDs)
解决:关闭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: sql.cj.jdbc.Driver
解决:去掉cj.
6. dubbo连接数据库时报超时错误
原因:数据库配置错误
解决步骤:
把数据库连接版本从5换成8;
此时报事务配置错误
添加事务配置;
此时报错:Receiver ansaction.SpringManagedTransaction does not define or inherit an implementation of the resolved method abstract getTimeout()Ljava/lang/Integer; of interface
org.ansaction.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页⾯报错:
不影响程序执⾏
原因: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 …/l,trace=org.apache.solrmon.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.InvalidDefinitionException.
解决:添加依赖:
<groupId>com.</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.4</version>
</dependency>
<dependency>
<groupId>com.</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.9.4</version>
</dependency>
<dependency>
<groupId>com.</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.ConnectException: Connection refused (Connection refused)
没有启动redis服务
16. Solr启动报错:HTTP Status 500 - {msg=SolrCore 'collection1' is not available due to init failure
原因:l中的内容修改后,没有取消注释
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 如下所⽰
<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>imo.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>
angular和angularjs<skipTests>true</skipTests>
</configuration>
</plugin>
23. 单点登录+security错误:
org.springframework.security.access.AccessDeniedException: Access is denied
原因:security配置错误:
<beans:property name="loginUrl" value="localhost:8080/cas/login"/>
登录成功显⽰ticket
原因:配置错误
正确配置:
<beans:property name="service" value="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 tab
le 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注解

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。