我一直在寫一個充當服務器的項目,並讓服務啓動並運行,供客戶端使用。 我的服務器應用程序是基於Spring MVC 3框架的簡單CRUD應用程序。超過名爲Person的單個表的記錄。我的WebServices是SOAP1.1服務器,並且只要我在TomCat上部署我的項目,就會生效。我可以在本地主機上訪問它的wsdl,並且可以通過在tomcat上運行和部署該項目來訪問這些Web服務。我通過從服務方法中重新調用標誌來測試服務器。現在的問題是。如果我通過它的控制器在網上運行服務器應用程序,我可以通過Web界面正確處理。所有組件Repository,Service DAO都被正確註釋並通過Web工作。但是當我嘗試通過我的服務做同樣的工作時。我爲自動裝配對象獲得NullPointerExceptions。獲取NullPointerException異常訪問webService。我如何解決這個問題
以下是一個例外。請在評論中幫助並通過您的想法。
WARN org.apache.cxf.phase.PhaseInterceptorChain - Application {http://service.accounting.cassit.com/}personService#{http://service.accounting.cassit.com/}deletePerson has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault
at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:155)
at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.createFault(AbstractJAXWSMethodInvoker.java:86)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:121)
at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:61)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:75)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:255)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113)
at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:102)
at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:464)
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:188)
at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NullPointerException
at com.cassit.accounting.service.PersonServiceImpl.deletePerson(PersonServiceImpl.java:47)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:173)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:89)
當看這條線,並檢查行號47或各自的java文件。我知道我正在訪問一個AutoWired屬性。爲什麼這樣?
Caused by: java.lang.NullPointerException
at com.cassit.accounting.service.PersonServiceImpl.deletePerson(PersonServiceImpl.java:47)
最好的問候, aqif
請在PersonServiceImpl.java中添加代碼 – 2012-01-29 15:02:54
添加了Dao和Service類。 – 2012-01-29 15:18:47