常见的Eclipse、MySQL及Tomcat中的错误及解决方法

Duplicate entry for key ‘PRIMARY’
主键冲突
解决办法:
1、根据个人具体场景,不重复插入数据
2、插入数据的时候,不设置主键的值
3、插入数据的时候使用insert ignore ,保证已有记录便不再插入

参考:https://blog.csdn.net/m0_37664906/article/details/79612006

applet无法调用本地资源

jquery-1.9.0.min.jsMultiple markers at this line - Missing semicolon - Mis
原因: 我们没有告诉myeclipse去验证这个js文件。
解决方案:
MyEclipse的web项目中的js文件报Multiple markers at this line - Missing semicolon时,是由于还没有告诉myeclipse去验证它。解决方法,选中js文件,右键Myeclipse–ManaValidation–ExcludeResource–(选中全部或者报错的那个js)–点击OK即可,这是Eclipse或者MyEclipse校验失败的错误,不影响程序正常执行。如果以上操作后还出现红叉,那就clean一下工程,然后刷新工程,OK红叉没了。

参考:https://blog.csdn.net/qq_22260641/article/details/60128452

Multiple markers at this line
- The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from
required .class files
- The method contains(CharSequence) from the type String refers to the missing type
CharSequence
原因是JDK版本太高。
解决办法:降低Library中JDK版本。。

但是降低以后又出现新的问题
The type com.opensymphony.xwork2.ActionContext cannot be resolved. It is indirectly referenced from required .class files

原因:可能是因为没有导入xwork.jar包所导致,经导入后,又出现新的问题。

The import org.hibernate cannot be resolved
尝试方法: clean工程,未解决!
但是发现,在配置jre1.6之前也就是 本工作环境的jre版本为1.8时显示正常。
如果将jre版本提升为1.8又会出现上述错误。

原以为改了jre后,某些错误就解决了,但是当我重新打开之前报错的文件时,依旧会显示错误。

换了新的源码后,配置期间遇到的问题。
action cannot be found in the namespace/

解决0方法:

Window–>Preference–>Myeclipse -->Validation -->去掉struts2 Validator后的Build列勾确认

然后,没错误以后,去tomcat运行,发现出现404错误。
应该是没部署进去,暂且搁置,查阅资料发现有网友也遇到了这种情况,但是在Eclipse下可以运行,于是转战Eclipse。

导入项目后:
jsp文件报错
Multiple annotations found at this line:
- String cannot be resolved to a type
- No exception of type ServletException can be thrown; an exception type must be a subclass of
Throwable
- The method getContextPath() from the type HttpServletRequest refers to the missing type String
- java.io.IOException cannot be resolved to a type
- The type java.util.Map cannot be resolved. It is indirectly referenced from required .class files
- No exception of type JspException can be thrown; an exception type must be a subclass of

原因是jre版本错误,进行配置一下,就解决了

果然,在Eclipse可以运行!!

运行Tomcat时若出现Address already in use: JVM_Bind 端口被占用,一般使用下面几个办法可以解决:

假设端口为1099

1.启动cmd, 执行命令netstat -ano|findstr 1099 ,会查询出占用端口号的进程号,这时候执行命令

taskkill -f -pid 进程号   杀死进程,然后重启Tomcat即可解决

原文:https://blog.csdn.net/ydk888888/article/details/81567032

(后续还会继续进行补充…

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值