This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

Springs and RestEasy synchronization problem

May 15th, 2012, 03:43 AM

The project i am working on is a combination of Springs , Hibernate and Resteasy services. In this project i need to get the data from mysql database using hibernate and Springs is used of configuring all the service and Impl classes.
It has two methods which return database data in xml and json format using reseasy procedures.I have configured every thing correctly and the output is generated correctly but the problem is "The same code is sometimes producing the output and sometimes not"(It is giving a null pointer exception and stack trace is as follows).

SEVERE: Servlet.service() for servlet [Resteasy] in context with path [/resteasy] threw exception
org.jboss.resteasy.spi.UnhandledException: java.lang.NullPointerException
at org.jboss.resteasy.core.SynchronousDispatcher.hand leApplicationException(SynchronousDispatcher.java: 323)
at org.jboss.resteasy.core.SynchronousDispatcher.hand leException(SynchronousDispatcher.java:199)
at org.jboss.resteasy.core.SynchronousDispatcher.hand leInvokerException(SynchronousDispatcher.java:175)
at org.jboss.resteasy.core.SynchronousDispatcher.getR esponse(SynchronousDispatcher.java:529)
at org.jboss.resteasy.core.SynchronousDispatcher.invo ke(SynchronousDispatcher.java:491)
at org.jboss.resteasy.core.SynchronousDispatcher.invo ke(SynchronousDispatcher.java:120)
at org.jboss.resteasy.plugins.server.servlet.ServletC ontainerDispatcher.service(ServletContainerDispatc her.java:200)
at org.jboss.resteasy.plugins.server.servlet.HttpServ letDispatcher.service(HttpServletDispatcher.java:4 8)
at org.jboss.resteasy.plugins.server.servlet.HttpServ letDispatcher.service(HttpServletDispatcher.java:4 3)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:722)
at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBas e.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(A ccessLogValve.java:929)
at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:405)
at org.apache.coyote.http11.AbstractHttp11Processor.p rocess(AbstractHttp11Processor.java:964)
at org.apache.coyote.AbstractProtocol$AbstractConnect ionHandler.process(AbstractProtocol.java:515)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProce ssor.run(JIoEndpoint.java:304)
at java.util.concurrent.ThreadPoolExecutor.runWorker( ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.NullPointerException
at com.filter.rest.guiimpl.FilterRestServiceImpl.list NodesXML(FilterRestServiceImpl.java:37)
at sun.reflect.GeneratedMethodAccessor41.invoke(Unkno wn Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke( MethodInjectorImpl.java:140)
at org.jboss.resteasy.core.ResourceMethod.invokeOnTar get(ResourceMethod.java:252)
at org.jboss.resteasy.core.ResourceMethod.invoke(Reso urceMethod.java:217)
at org.jboss.resteasy.core.ResourceMethod.invoke(Reso urceMethod.java:206)
at org.jboss.resteasy.core.SynchronousDispatcher.getR esponse(SynchronousDispatcher.java:514)
... 22 more

This bean <bean id="masterDAO" class="com.filter.dao.jpa.MasterJpaDao"> is for implementing the database methods which will
make a database query to get the data.

<bean id="filterService" class="com.rest.filter.impl.FilterServiceImpl"> this bean is used for making the view of the fetched data.
If any details are required i am ready to post them.
Please help me in solving this issue . Thanks in advance.