猿问

空指针异常

java.lang.NullPointerException

at com.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance(SpringObjectFactory.java:245)

at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyResultType(XmlConfigurationProvider.java:608)

at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addResultTypes(XmlConfigurationProvider.java:578)

at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:534)

at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:295)

at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:112)

at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:264)

at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)

at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:967)

at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:435)

at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:479)

at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)

at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57)

at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:285)

at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:266)

at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)

at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4590)

at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5233)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)

at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)

at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)

at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1144)

at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1878)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

at java.util.concurrent.FutureTask.run(FutureTask.java:266)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

at java.lang.Thread.run(Thread.java:745)

八月 02, 2017 11:32:02 下午 org.apache.catalina.core.StandardContext filterStart

严重: Exception starting filter [struts2]

Class: com.opensymphony.xwork2.spring.SpringObjectFactory

File: SpringObjectFactory.java

Method: getClassInstance


qq_岁月的名字_0
浏览 1913回答 4
4回答

放羊的贤哥

兄弟,给你个建议,首先你要看报错信息中是否有你自定义的类或者借口,然后找到你的文件检查,空指针或许是传值到后台出现问题,你可以尝试debug运行,检查传值是否有问题

Crazy_Killer

其实空指针异常是最容易避免的。首先你要明白为什么会空指针,空指针是你用null点了,然后会报空指针,比如:a.equals(b),如果a是null则会出现空指针异常,为了避免这种情况,可以先验证a是否为null,也可以将可能出现null放在点号符号前面,可以避免空指针异常,这是个习惯,要是不养成好习惯,这个问题会困扰你的,知道了为什么,下次有意识的去避免就好,久而久之,就不会出现这种意外了。

阳光下的雾

不懂?

霜花似雪

看不出来
随时随地看视频慕课网APP

相关分类

Java
我要回答