按照http://blog.163.com/xs_fantasy/blog/static/101560871200911294035667/这个实例走到最后
从菜单中选择“Run->Run as->JUnit Test 进行测试
测试并不成功……
出现下面情况,求高手解答!
java.lang.ExceptionInInitializerError
at org.apache.axis2.description.AxisDescription.<init>(AxisDescription.java:72)
at org.apache.axis2.description.AxisService.<init>(AxisService.java:323)
at org.apache.axis2.description.AxisService.<init>(AxisService.java:394)
at org.example.www.sayhello.SayHelloStub.populateAxisService(SayHelloStub.java:47)
at org.example.www.sayhello.SayHelloStub.<init>(SayHelloStub.java:94)
at org.example.www.sayhello.SayHelloStub.<init>(SayHelloStub.java:83)
at org.example.www.sayhello.SayHelloStub.<init>(SayHelloStub.java:131)
at test.org.example.www.sayhello.SayHelloTest.testSayHello(SayHelloTest.java:24)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
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:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.NullPointerException
at org.apache.axiom.locator.DefaultOMMetaFactoryLocator.<init>(DefaultOMMetaFactoryLocator.java:64)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at java.lang.Class.newInstance0(Class.java:372)
at java.lang.Class.newInstance(Class.java:325)
at org.apache.axiom.om.OMAbstractFactory.<clinit>(OMAbstractFactory.java:95)
... 26 more
webservicejunit测试

解决方案 »

  1.   

    java.lang.ExceptionInInitializerErro这种问题往往是初始化顺序不对造成的at org.example.www.sayhello.SayHelloStub.populateAxisService(SayHelloStub.java:47)
    at org.example.www.sayhello.SayHelloStub.<init>(SayHelloStub.java:94)
    at org.example.www.sayhello.SayHelloStub.<init>(SayHelloStub.java:83)
    at org.example.www.sayhello.SayHelloStub.<init>(SayHelloStub.java:131)
    at test.org.example.www.sayhello.SayHelloTest.testSayHello(SayHelloTest.java:24)
    每个错误后面都有提示行号,自己去看看那个地方有问题webservice 没做过,不会