日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

配置struts2出現(xiàn)的奇怪問(wèn)題

系統(tǒng) 2362 0
最近開(kāi)始研究struts2,一開(kāi)始就遇到莫名其妙的問(wèn)題

在配置struts2時(shí),使用的是Tomcat6.0服務(wù)器,按書上說(shuō)的什么都配置好了的時(shí)候,啟動(dòng)服務(wù)器時(shí),總是顯示如下錯(cuò)誤:??????????????

嚴(yán)重: ********** FATAL ERROR STARTING UP STRUTS-SPRING INTEGRATION **********
Looks like the Spring listener was not configured for your web app!
Nothing will work until WebApplicationContextUtils returns a valid ApplicationContext.
You might need to add the following to web.xml:
??? <listener>
??????? <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
??? </listener>

2008-12-14 15:06:26 org.apache.catalina.core.StandardContext filterStart
嚴(yán)重: Exception starting filter struts2
java.lang.NullPointerException
??? at com.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance(SpringObjectFactory.java:189)
??? at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyResultType(XmlConfigurationProvider.java:479)
??? at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addResultTypes(XmlConfigurationProvider.java:450)
??? at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:407)
??? at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:239)
??? at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:111)
??? at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:152)
??? at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52)
??? at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395)
??? at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:452)
??? at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:205)
??? at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:221)
??? at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:302)
??? at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:78)
??? at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3635)
??? at org.apache.catalina.core.StandardContext.start(StandardContext.java:4222)
??? at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
??? at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
??? at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
??? at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
??? at org.apache.catalina.core.StandardService.start(StandardService.java:448)
??? at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
??? at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
??? at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
??? at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
??? at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
??? at java.lang.reflect.Method.invoke(Unknown Source)
??? at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
??? at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)

在網(wǎng)上找了將近一小時(shí),總算給google到解決方案了

有兩種方案

1)嘗試將spring集成到struts2下,所以需要修改web.xml和添加applicationContext.xml

web.xml 部分代碼增加
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
然后在WebRoot>WEB-INF>下加一個(gè)空的applicationContext.xml如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans default-autowire="autodetect">
</beans>

2)WEB-INF中的jar包導(dǎo)入有問(wèn)題,僅僅導(dǎo)入需要的包,如下圖所示,僅僅導(dǎo)入了最最基本的jar包。
配置struts2出現(xiàn)的奇怪問(wèn)題


本文來(lái)自CSDN博客,轉(zhuǎn)載請(qǐng)標(biāo)明出處:http://blog.csdn.net/dongliang_zhu/

配置struts2出現(xiàn)的奇怪問(wèn)題


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號(hào)聯(lián)系: 360901061

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺(jué)我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對(duì)您有幫助就好】

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺(jué)我的文章對(duì)您有幫助,請(qǐng)用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長(zhǎng)會(huì)非常 感謝您的哦?。?!

發(fā)表我的評(píng)論
最新評(píng)論 總共0條評(píng)論
主站蜘蛛池模板: 祁门县| 衡南县| 安达市| 波密县| 太仆寺旗| 紫云| 庆城县| 小金县| 建宁县| 海安县| 丹巴县| 宁安市| 理塘县| 保定市| 博白县| 平山县| 余干县| 乐都县| 铁岭市| 嘉兴市| 浦县| 武安市| 比如县| 三河市| 建昌县| 盘山县| 历史| 石家庄市| 搜索| 侯马市| 蒙城县| 伊金霍洛旗| 明星| 萨迦县| 九龙坡区| 新建县| 密云县| 太仓市| 吐鲁番市| 沙洋县| 长治市|