}
点击右键run As——Junit Test,运行结果后:只会输出hello!、welcome1、welcome2
我现在非常急解决这个问题,!请知道者帮帮我,能否尽量详细点说明解决方法,谢谢各位高手了。作者: liuxhsl 时间: 2006-6-3 15:45 标题: 点击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 16:59 标题: 你的action没执行 你的action好象没执行,错误显示初始化sevelet,对象没找到,一种是你的字符没传过去,一种是,环境对象没找到,你先检查看看你的lib库是不是所有都在运行的path h 环境中了。
你的actionPerform();执行的是哪个action,具体的要模拟环境来看了。作者: liuxhsl 时间: 2006-6-4 11:02 标题: 谢楼上,再请教! 你所说的"lib库是不是所有都在运行的path h 环境中了"的这句话,是不是要在系统的高级环境变量中设置于呢,还是只要在MYeclipse集成环境中添加外部库文件.请问能否具体指点如何设?????!!!
actionPerform()是模型loginAction啊,因为setRequestPathInfo("/login");这条语句也就是说模拟LoginAction的.作者: century 时间: 2006-6-5 09:48 标题: ba 把你需要的.jar类包都加到 myeclipse的path中。看看你是直接用myeclipse运行的吧