cancel
Showing results for 
Search instead for 
Did you mean: 

Share: A JSONObject text must begin with '{'

jevon
Champ in-the-making
Champ in-the-making
Hi,

I have been trying to get Alfresco 4.0.b working on an existing Tomcat 7.0.22 on Windows XP using MySQL. I can get the explorer application to work fine, but I can't get the Share application to work at all.

Tomcat is running on port 8081, but I have followed the instructions at https://wiki.alfresco.com/wiki/Changing_Default_Port_Configuration, and set the properties for alfresco.port and share.port in alfresco-global.properties. I've cleared the database so that it is recreated, and set doc.root manually.

Neither alfresco.log or catalina.out have anything useful, but here's a copy anyway.

Trying to browse to http://localhost:8081/share/ 302 redirects to http://localhost:8081/share/page/site-index, which displays the message "A server error has occured.", and generates the following exception:

2011-12-18 23:55:10,514  INFO  [web.site.EditionInterceptor] [http-bio-8081-exec-6] Successfully retrieved license information from Alfresco.
2011-12-18 23:55:10,654  ERROR [alfresco.web.site] [http-bio-8081-exec-6] org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.extensions.surf.exception.WebFrameworkServiceException: Unable to process response: A JSONObject text must begin with '{' at character 1
org.springframework.extensions.surf.exception.WebFrameworkServiceException: Unable to process response: A JSONObject text must begin with '{' at character 1
        at org.alfresco.web.site.EditionInterceptor.preHandle(EditionInterceptor.java:138)
        at org.springframework.web.servlet.handler.WebRequestHandlerInterceptorAdapter.preHandle(WebRequestHandlerInterceptorAdapter.java:54)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:781)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
        at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.alfresco.web.site.servlet.MTAuthenticationFilter.doFilter(MTAuthenticationFilter.java:74)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.alfresco.web.site.servlet.SSOAuthenticationFilter.doFilter(SSOAuthenticationFilter.java:307)
        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:100)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:964)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:304)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)
Caused by: org.json.JSONException: A JSONObject text must begin with '{' at character 1
        at org.json.JSONTokener.syntaxError(JSONTokener.java:413)
        at org.json.JSONObject.<init>(JSONObject.java:180)
        at org.json.JSONObject.<init>(JSONObject.java:420)
        at org.alfresco.web.site.EditionInterceptor$EditionInfo.<init>(EditionInterceptor.java:192)
        at org.alfresco.web.site.EditionInterceptor.preHandle(EditionInterceptor.java:101)
        … 29 more

Any ideas??
2 REPLIES 2

jevon
Champ in-the-making
Champ in-the-making
I installed Wireshark to debug the network traffic, and I think I found the cause of the problem (#123456 Smiley Very Happy): we are behind a HTTP proxy, and Share is not respecting these settings – in particular, to NOT use the proxy for localhost: (In this log, 130.123.172.212 == localhost)

130.123.172.212 -> proxy: GET http://localhost:8081/alfresco/s/api/admin/restrictions?guest=true HTTP/1.1
proxy -> 130.123.172.212: HTTP/1.1 201 Moved Permanently
   Location: http://130.123.172.212
130.123.172.212 -> proxy: GET http://130.123.172.212 HTTP/1.1
proxy -> 130.123.172.212: either 200 OK or 404 Not Found, depending on the proxy

Share should not even be calling the web proxy, since 130.123.172.212 == localhost. It's picking up a web proxy location from somewhere, but I have no idea where.

This exact problem was reported in ALF-1518 and apparently was fixed, but I haven't found how to set or override the proxy. In particular, none of these methods work:

* Through Control Panel/Internet Options
* Through Control Panel/Java/Network Settings
* Through TOMCAT_HOME/conf/catalina.conf
* Through TOMCAT_HOME/bin/setenv.bat
* Through manually setting JAVA_OPTS in System/Runtime Properties
* Manually aliasing 130.123.172.212 to localhost in windows/system32/drivers/etc/hosts

I know that these methods don't work because I am trying to manually set a different proxy on a different IP. So. How do I get Share to respect proxy settings?

Edit: A list of properties that I've set: -Dhttp.proxyHost=xxx -Dhttp.proxyPort=8080 -Dhttp.nonProxyHosts=localhost -Dhttp.proxySet=true

jevon
Champ in-the-making
Champ in-the-making
After learning out how to debug Alfresco in Eclipse, I found the root of the problem: I had the following property in my catalina.properties file:

http.nonProxyHosts="localhost"

The quotes were not being removed by the code. This line should instead be

http.nonProxyHosts=localhost