概述
1.错误描述:Application Server was not connected before runconfiguration stop, reason:
Unable to ping server at localhost:1090
这种问题一般都是因为JDK与Tomcat版本不一致导致的,像JDK6或7与Tomcat9就会出这样问题,将JDK升级到8可解决;或者将Tomcat版本降低到6或7,可搭配JDK7;
更改JDK时,要注意下以下地方更改:
1) Project Settings中的Project SDK和Projectlanguage
2) Modules中的Source和Dependencies;
3) Platform Settings中的SDKS;
4) FileàSettings—>JavaCompiler中的version;
5) TomcatServer中的JRE要选对JDK,这地方最容易忽视。
6) 更改后就最好重新编译或将原项目删除重新生成
2.错误描述:Caused by:java.lang.NoSuchMethodException: org.apache.catalina.deploy.WebXml addServlet
原因分析:catalina.jar冲突
解决方法:1.删除此包;2.在tomcat的context.xml加上<loaderdelegate=”true”>
教训:tomcat的library尽量不带,以免带业冲突;但去掉之后还是显示些问题,不知道到底在哪有冲突了。
3.错误描述:Tomcat in Idea.war exploded: Server is not connected. Deploy is not available
解决办法:1.删掉 $CATALINA_HOME/bin(tomcat安装目录/bin)下的setenv.sh
/setenv.bat
,或者删除catalina.bat里边set JAVA_OPTS=-XX:MaxPermSize=512m -Xmx1024m这句
参考下面的stackoverflow
http://cache.baiducontent.com/c?m=9d78d513d9d440dc4fece43b5e56c0666803ca21628a864229c39238846528564717a2ec67664744c4c50d3c40b8492db6ad7065377271eac794df1b9becc43f2ef83034070b863044845bf1960d32c151cb1bfeaf68bbe7b62593df81978c0f0d99035b2d97f1fb4d0063de28b04a3eb9e0df0a025e63a7f07123ac082e74db7400e219a4a5256e70d0ab82410f847d91274acaf374ad3e10b617a514182659e611ee59026027e0397ca3533d72c9bd0ab43d793666e508a4b9b7e1a10ad281bc66ceedcbd96ec220a292aaee71342b13ed25c8f7e0f42a643353849682419574ebacfbba3abf43954e01f14a7659308f7c94f4d30ab4755a82b42cad727c75785488&p=8b2a971e86cc42af5cf7f8224e4ecd&newp=882a9645d2990bbe46bfc7710f0c94231610db2151d4d0116b82c825d7331b001c3bbfb423231507d5c17e6400ae425aeff63071340421a3dda5c91d9fb4c57479d26d256e4e&user=baidu&fm=sc&query=%3Awar+exploded%3A+Server+is+not+connected%2E+Deploy+is+not+available%2E&qid=cacfedba000099c3&p1=1
4.java.lang.UnsupportedClassVersionError
原因分析:意味使用高版本的JDK 编译,然后在低版本的JDK 中运行
解决办法:更换jdk
5.Caused by:java.lang.UnsupportedClassVersionError: org/apache/tomcat/websocket/server/WsSci: Unsupported major.minor version 52.0 (unable to load classorg.apache.tomcat.websocket.server.WsSci)
原因分析:可能被更高版本的jdk编译过;同时确保tomcat的jre版本;
解决方法:用更高版本的jdk打开;将项目class删了重新编译,或将在tomcat的文件删了,重新发布;
6.错误描述:Caused by:java.lang.UnsupportedClassVersionError: javax/ejb/EJB : Unsupported major.minorversion 52.0
原因分析:被高版本编译后或者引入了高版本特性(如EJB)
解决办法:换成高版本jdk;如要用低版本的,删除引入的特性,如可以删除tomcat引入的library,ejb等;
7. 错误描述:“JSR 356WebSocket (Java WebSocket 1.1) support is not available when running on Java 6.To suppress this message, run Tomcat on Java 7, remove the WebSocket JARs from$CATALINA_HOME/lib or add the WebSocket JARs to thetomcat.util.scan.DefaultJarScanner.jarsToSkip property in$CATALINA_BASE/conf/catalina.properties. Note that the deprecated Tomcat 7WebSocket API will be available.”
即提示要用jdk 1.7
解决方法:配置成jdk1.8 +tomcat9没问题;
8.错误描述:Causedby: java.lang.IllegalStateException: Context namespace element 'component-scan'and its parser class [org.springframework.context.annotation.ComponentScanBeanDefinitionParser]are only available on JDK 1.5 and higher
原因:spring 2.5.jar不识别jdk1.8
解决方法:要降低jdk版本或换高版本的spring,如spring 4
9.错误描述:Errorrunning Tomcat8: Address localhost:1099 is already in use 的错误
原因:端口被占用,这在有Junit test和tomcat都在运行时容易出现
解决方法:在进程中停止有关java的,然后重启;
10.错误描述:严重: Context [] startup failed due to previous errors
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:681)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'productDao ' of bean class [cn.itcast.shop.product.service.ProductService]: Bean property 'productDao ' is not writable or has an invalid setter method. Did you mean 'productDao'?
原因:只因在spring配property productDao时多加了个空格, 'productDao ',真的很难看出来,结果折腾了一下午
最后
以上就是尊敬往事为你收集整理的MyException的全部内容,希望文章能够帮你解决MyException所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复