錯誤1:
log4j:warn please initialize the log4j system properly.
2013-1-15 20:22:28 org.apache.catalina.core.standardcontext filterstart
嚴重: exception starting filter struts2
class: com.opensymphony.xwork2.spring.springobjectfactory
file: springobjectfactory.java
method: getclassinstance
line: 220 - com/opensymphony/xwork2/spring/springobjectfactory.java:220:-1
at org.apache.struts2.dispatcher.dispatcher.init(dispatcher.java:428)
at org.apache.struts2.dispatcher.ng.initoperations.initdispatcher(initoperations.java:69)
at org.apache.struts2.dispatcher.ng.filter.strutsprepareandexecutefilter.init(strutsprepareandexecutefilter.java:51)
at org.apache.catalina.core.applicationfilterconfig.initfilter(applicationfilterconfig.java:273)
at org.apache.catalina.core.applicationfilterconfig.getfilter(applicationfilterconfig.java:254)
at org.apache.catalina.core.applicationfilterconfig.setfilterdef(applicationfilterconfig.java:372)
at org.apache.catalina.core.applicationfilterconfig.<init>(applicationfilterconfig.java:98)
at org.apache.catalina.core.standardcontext.filterstart(standardcontext.java:4584)
at org.apache.catalina.core.standardcontext$2.call(standardcontext.java:5262)
at org.apache.catalina.core.standardcontext$2.call(standardcontext.java:5257)
at java.util.concurrent.futuretask$sync.innerrun(futuretask.java:303)
at java.util.concurrent.futuretask.run(futuretask.java:138)
at java.util.concurrent.threadpoolexecutor$worker.runtask(threadpoolexecutor.java:886)
at java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:908)
at java.lang.thread.run(thread.java:619)
caused by: java.lang.nullpointerexception
at com.opensymphony.xwork2.spring.springobjectfactory.getclassinstance(springobjectfactory.java:220)
at com.opensymphony.xwork2.config.providers.xmlconfigurationprovider.verifyresulttype(xmlconfigurationprovider.java:530)
at com.opensymphony.xwork2.config.providers.xmlconfigurationprovider.addresulttypes(xmlconfigurationprovider.java:501)
at com.opensymphony.xwork2.config.providers.xmlconfigurationprovider.addpackage(xmlconfigurationprovider.java:457)
at com.opensymphony.xwork2.config.providers.xmlconfigurationprovider.loadpackages(xmlconfigurationprovider.java:275)
at org.apache.struts2.config.strutsxmlconfigurationprovider.loadpackages(strutsxmlconfigurationprovider.java:111)
at com.opensymphony.xwork2.config.impl.defaultconfiguration.reloadcontainer(defaultconfiguration.java:204)
at com.opensymphony.xwork2.config.configurationmanager.getconfiguration(configurationmanager.java:66)
at org.apache.struts2.dispatcher.dispatcher.init_preloadconfiguration(dispatcher.java:371)
at org.apache.struts2.dispatcher.dispatcher.init(dispatcher.java:415)
... 14 more
2013-1-15 20:22:28 org.apache.catalina.core.standardcontext startinternal
嚴重: error filterstart
解決方案:
1).在項目的web.xml中配置:
<!-- 指定spring配置檔案的路徑 -->
<context-param>
<param-name>contextconfiglocation</param-name>
<param-value>/web-inf/classes/applicationcontext.xml</param-value>
</context-param>
<!-- 執行個體化spring容器 -->
<listener>
<listener-class>org.springframework.web.context.contextloaderlistener</listener-class>
</listener>
2).在struts.xml中配置:
<struts>
<!-- 與spring內建的常量,讓spring接管struts去建立action對象 -->
<constant name="struts.objectfactory" value="spring" />
</struts>
錯誤2:
2013-1-15 20:30:26 org.apache.catalina.core.applicationcontext log
資訊: initializing spring root webapplicationcontext
2013-1-15 20:30:31 java.util.prefs.windowspreferences <init>
警告: could not open/create prefs root node software\javasoft\prefs at root 0x80000002. windows regcreatekeyex(...) returned error code 5.
2013-1-15 20:30:31 java.util.prefs.windowspreferences windowsregopenkey1
警告: trying to recreate windows registry node software\javasoft\prefs at root 0x80000002.
2013-1-15 20:30:31 java.util.prefs.windowspreferences openkey
警告: could not open windows registry node software\javasoft\prefs at root 0x80000002. windows regopenkey(...) returned error code 2.
借鑒自百度方法,嚴重:standardserver.await:create[8005]: java.net.bindexception:addressalreadyinuse:jvm_bind 端口被占用了,8005出現這個問題可能有幾種情況:
1.其它應用程式占用了該端口,dos指令檢視端口:netstat -an|findstr "8080" 檢視端口号8080和程序号,和 tasklist|findstr "6168" 占用端口占用程序号6168的占用者
2.tomcat自己占用了,而tomcat占用又可以分為兩種,
1):系統中還有tomcat,并啟動了;
2):你的ide(內建開發環境)突然死掉了,但是tomcat其實并沒有關,打開“windows任務管理器”檢視“程序”中,是不是有兩個javaw.exe,占用資源小的就是tomcat啟動的,大的是由eclipse或myeclipse啟動的。
關閉兩個javaw程序,重新啟動tomcat就…………,這個問題其實可以不解決,項目可以跑起來了!
端口号檢視:
netstat
顯示協定統計和目前的 tcp/ip 網絡連接配接。該指令隻有在安裝了 tcp/ip 協定後才可以使用。
netstat [-a] [-e] [-n] [-s] [-p protocol] [-r] [interval]
參數
-a :顯示所有連接配接和偵聽端口。伺服器連接配接通常不顯示。
-e :顯示以太網統計。該參數可以與 -s 選項結合使用。
-n :以數字格式顯示位址和端口号(而不是嘗試查找名稱)。
-s :顯示每個協定的統計。預設情況下,顯示 tcp、udp、icmp 和 ip 的統計。-p 選項可以用來指定預設的子集。
-p protocol :顯示由 protocol 指定的協定的連接配接;protocol 可以是 tcp 或 udp。如果與 -s 選項一同使用顯示每個協定的統計,protocol 可以是 tcp、udp、icmp 或 ip。
-r 顯示路由表的内容。
interval :重新顯示所選的統計,在每次顯示之間暫停 interval 秒。按 ctrl+b 停止重新顯示統計。如果省略該參數,netstat 将列印一次目前的配置資訊。