Issues getting REST services to run with mobile app

Bug and problem reporting

Moderators: hugo, alexandre, rmvanarkel

Post Reply
simonjwoolf
Posts: 111
Joined: Mon May 28, 2012 8:49 am

Issues getting REST services to run with mobile app

Post by simonjwoolf » Fri Apr 12, 2013 6:37 am

Hi,

We are trying to use the Cyclos Mobile App but REST services on all of our Cyclos instances just throw an error:

Code: Select all

ERROR RestFilter - Error on REST call
java.lang.NullPointerException
	at nl.strohalm.cyclos.http.ResettableHttpServletResponse.getStatus(ResettableHttpServletResponse.java:235)
	at nl.strohalm.cyclos.http.BaseWebServiceTransactionFilter.doRunInTransaction(BaseWebServiceTransactionFilter.java:163)
	at nl.strohalm.cyclos.http.BaseWebServiceTransactionFilter.access$1(BaseWebServiceTransactionFilter.java:142)
	at nl.strohalm.cyclos.http.BaseWebServiceTransactionFilter$1.doInTransactionWithoutResult(BaseWebServiceTransactionFilter.java:74)
	at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:33)
	at nl.strohalm.cyclos.utils.TransactionHelperImpl$1.doInTransaction(TransactionHelperImpl.java:242)
	at nl.strohalm.cyclos.utils.TransactionHelperImpl$1.doInTransaction(TransactionHelperImpl.java:1)
	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
	at nl.strohalm.cyclos.utils.TransactionHelperImpl.runInCurrentThreadWithResult(TransactionHelperImpl.java:236)
	at nl.strohalm.cyclos.utils.TransactionHelperImpl.runInCurrentThread(TransactionHelperImpl.java:197)
	at nl.strohalm.cyclos.http.BaseWebServiceTransactionFilter.execute(BaseWebServiceTransactionFilter.java:65)
	at nl.strohalm.cyclos.http.RestFilter.execute(RestFilter.java:108)
	at nl.strohalm.cyclos.http.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:51)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
	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)
Trying to access the rest services page http://127.0.0.1/cyclos/rest/general just results in the following message:

Code: Select all

{"errorCode":"INTERNAL_SERVER_ERROR"}
and the error trace is identical to the above (which was generated when we tried to access from the mobile phone app)

Versions:

Cyclos 3.7.1
Cyclos Mobile App 1.2 (Android v4 - Galaxy S3)
Last edited by simonjwoolf on Fri Apr 12, 2013 8:27 am, edited 2 times in total.
---
Simon Woolf
Cyclos Consultant

admin
Site Admin
Posts: 1413
Joined: Mon Jan 24, 2005 10:31 am

Re: Issues getting REST services to run with mobile app

Post by admin » Fri Apr 12, 2013 8:14 am

Can you access the demo site with the mobile app? (just put domain www.cyclos.org as URL in the app.)
We will have a look at the logs.

simonjwoolf
Posts: 111
Joined: Mon May 28, 2012 8:49 am

Re: Issues getting REST services to run with mobile app

Post by simonjwoolf » Fri Apr 12, 2013 8:26 am

Yes, that works just fine
---
Simon Woolf
Cyclos Consultant

rmvanarkel
Posts: 240
Joined: Tue Oct 05, 2010 1:14 pm

Re: Issues getting REST services to run with mobile app

Post by rmvanarkel » Fri Apr 12, 2013 11:37 am

Hi Simon,

I am affraid this problem occurred because you are using a customized version of Cyclos. We checked the class ResettableHttpServletResponse and could it be that it is modified? The best thing you can do is update to Cyclos 3.7.3 and see if it works then.

Good luck!

cqrendo
Posts: 2
Joined: Tue May 22, 2012 9:39 am

Re: Issues getting REST services to run with mobile app

Post by cqrendo » Sat May 11, 2013 6:20 pm

I am using 3.7.3 (tomcat 7) and I getting the same problem

antonioh
Posts: 1
Joined: Thu Jun 13, 2013 1:31 pm

Re: Issues getting REST services to run with mobile app

Post by antonioh » Fri Jun 14, 2013 2:52 pm

I have the same problem.
Anything has resolved it?

judahmu
Posts: 10
Joined: Mon Jul 01, 2013 10:14 am

Re: Issues getting REST services to run with mobile app

Post by judahmu » Mon Jul 01, 2013 8:43 pm

simonjwoolf wrote:Hi,
We are trying to use the Cyclos Mobile App but REST services on all of our Cyclos instances just throw an error
Because /rest/general is the only REST action that does not require BASIC authorization, I believe they forgot to initialize the status Integer in that situation only.

I "resolved" it in my code by changing ResettableHttpServletResponse to

Code: Select all

    public int getStatus() {
        if (status == null) {
            return 200;
        } 
        return status;
    }
:!: Because status handling is working correctly for the other Rest services, I don't believe an incorrect HTTP 200 status will leak through...

discapacidad5
Posts: 4
Joined: Wed Nov 22, 2017 9:25 am

Re: Issues getting REST services to run with mobile app

Post by discapacidad5 » Wed Nov 29, 2017 1:03 pm

hol how they solved the problem I get the same error with cyclos .3.7.3
{"errorCode": "INTERNAL_SERVER_ERROR"}

Post Reply