java 编译异常及其解决办法(持续更新)

java 编译异常及其解决办法(持续更新)

1.解决办法:将jar版本降低适配 低版本的jdk或tomcat

 1 严重: ContainerBase.addChild: start: 
 2 org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/EasyGo]]
 3     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
 4     at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:754)
 5     at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:730)
 6     at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
 7     at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1140)
 8     at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1875)
 9     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
10     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
11     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
12     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
13     at java.lang.Thread.run(Thread.java:745)
14 Caused by: java.lang.UnsupportedClassVersionError: org/springframework/web/SpringServletContainerInitializer : Unsupported major.minor version 52.0 (unable to load class [org.springframework.web.SpringServletContainerInitializer])
15     at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2341)
16     at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:828)
17     at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1277)
18     at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1136)
19     at java.lang.Class.forName0(Native Method)
20     at java.lang.Class.forName(Class.java:278)
21     at org.apache.catalina.startup.WebappServiceLoader.loadServices(WebappServiceLoader.java:188)
22     at org.apache.catalina.startup.WebappServiceLoader.load(WebappServiceLoader.java:159)
23     at org.apache.catalina.startup.ContextConfig.processServletContainerInitializers(ContextConfig.java:1612)
24     at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1125)
25     at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:765)
26     at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:299)
27     at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94)
28     at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5154)
29     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
30     ... 10 more
31 十二月 26, 2018 10:34:42 上午 org.apache.catalina.startup.HostConfig deployDirectory
32 严重: Error deploying web application directory [D:\software\myeclipse\apache-tomcat-8.5.31\webapps\EasyGo]
33 java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/EasyGo]]
34     at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:758)
35     at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:730)
36     at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
37     at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1140)
38     at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1875)
39     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
40     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
41     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
42     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
43     at java.lang.Thread.run(Thread.java:745)
版本太高

 2.解决办法:点击该项目->properties->Deployment Assmebly->Add->Java Build Path Entries(手动将项目所需要的jar添加)

    问题:使用tomcat运行Dynamic Web Project时,在webapps中的项目没有加载jar包

3.空指针:java NullPointerException 可能是包未导入。

4.解决方法:添加jar包javassist

 问题:java.lang.ClassNotFoundException: javassist.ClassPath

5.解决方法:正常情况下springmvc的xml文件应放在WEB-INF下,命名规则为 [name]-servlet.xml “-servlet”这个字段是必不可少的 [name]你可以随便命名 但是为了规范和方便阅读 最好是springmvc-servlet.xml(我这里是测试随便起的) 同时你的xml文件中两个servlet要和你的name相同 不然会报错的,对应此处的HelloWeb,所以需要使用HelloWeb-servlet.xml。

  问题:找不到xml

org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/HelloWeb-servlet.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/HelloWeb-servlet.xml]

 

6.解决方法:把 https 改为 http

  问题:

java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens

 7.解决方法:将attach 类型改为class AttachBean{Map<String,Object> tinfo}

问题:使用Gson自动化将json转化为javaBean的时候,属性String attach无法正确解析。因为收到的attach不是String类型,而是一个嵌套json

"attach": {
  "tinfo": {
  "22": "0"
  }
},

com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 280 path $.attach

 

转载于:https://www.cnblogs.com/carsonwuu/p/10177909.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值