}
点击右键run As——Junit Test,运行结果后:只会输出hello!、welcome1、welcome2
我现在非常急解决这个问题,!请知道者帮帮我,能否尽量详细点说明解决方法,谢谢各位高手了。作者: liuxhsl 时间: 2006-6-3 15:46 标题: 点击run as---junit test运行后提示的问题如下 hello!
welcome1welcome22006-6-3 15:36:58 org.apache.struts.util.PropertyMessageResources <init>
信息: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
2006-6-3 15:36:58 org.apache.struts.util.PropertyMessageResources <init>
信息: Initializing, config='org.apache.struts.action.ActionResources', returnNull=true
2006-6-3 15:36:58 org.apache.struts.action.ActionServlet initServlet
严重: null
java.lang.NullPointerException
at org.apache.crimson.parser.Parser2.parseInternal(Unknown Source)
at org.apache.crimson.parser.Parser2.parse(Unknown Source)
at org.apache.crimson.parser.XMLReaderImpl.parse(Unknown Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1567)
at org.apache.struts.action.ActionServlet.initServlet(ActionServlet.java:1433)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:466)
at javax.servlet.GenericServlet.init(GenericServlet.java:211)
at servletunit.struts.MockStrutsTestCase.getActionServlet(MockStrutsTestCase.java:226)
at servletunit.struts.MockStrutsTestCase.actionPerform(MockStrutsTestCase.java:290)
at com.lxh.struts.action.TestLoginAction.testSuccessfulLogin(TestLoginAction.java:23)
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 junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
2006-6-3 15:36:58 servletunit.struts.MockStrutsTestCase getActionServlet
严重: Error initializing action servlet
javax.servlet.ServletException: java.lang.NullPointerException
at org.apache.struts.action.ActionServlet.initServlet(ActionServlet.java:1441)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:466)
at javax.servlet.GenericServlet.init(GenericServlet.java:211)
at servletunit.struts.MockStrutsTestCase.getActionServlet(MockStrutsTestCase.java:226)
at servletunit.struts.MockStrutsTestCase.actionPerform(MockStrutsTestCase.java:290)
at com.lxh.struts.action.TestLoginAction.testSuccessfulLogin(TestLoginAction.java:23)
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 junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
2006-6-3 15:36:58 org.apache.struts.util.PropertyMessageResources <init>
信息: Initializing, config='org.apache.struts.action.ActionResources', returnNull=true
2006-6-3 15:36:58 org.apache.struts.action.ActionServlet initServlet作者: century 时间: 2006-6-3 17:09 标题: wen 你的服务器,是tomcat? 可能与环境变量有关吧,检查下相关文件,如web.xml等,具体要模拟环境才知道作者: liuxhsl 时间: 2006-6-3 18:46
我的服务器是TOMCAT,我也怀疑是配置问题,或者是stutstestcase包没有引入,但是我真的不知道怎么引入?
下面这句话我不知道怎么实现,我只把jjunit-3.8.1.jar与strutstest-2.1.3.jar放置到WEB-INF/lib下,而没有把test.war下的文件放到WEB-INF/lib,因为我解压不了test.war,同时通过引入外部库也不行?请问我该怎么做呢?我能否加入你的QQ吗?因我做毕业论文需做测试,系统做出来了,但测试还没实现,请你指导.我的QQ是:24287552.
"由官方網站上下載StrutsTestCase後解開,會發現有一個名為test.war的檔案, 將它解開,將裡面的aspectjrt-1.1.1.jar、cactus-13-1.6.1.jar、commons-beanutils.jar、commons-collections.jar、 commons-digester.jar、commons-httpclient-2.0.jar、commons-logging.jar、commons-validator.jar、crimson.jar、httpunit-1.5.4.jar、 jaxp.jar、junit-3.8.1.jar、log4j-1.2.5.jar、strutstest-2.1.3.jar放置到WEB-INF/lib,然後撰寫如下測試碼,撰寫測試碼時"