cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with a Web Quick Start website

bogdan1208
Champ in-the-making
Champ in-the-making
I have been meaning to post this for quite some time ago. I would like to ask if other users of WQS have similar issues as me and if they have found a solution. 

Last year I have started using Alfresco Web Quick Start as a platform for creating the website for the project I am involved with. The website can be found at http://www.dial-a-molecule.org. My problem now is that I realized that it does not appear in any of the indexes from Google so my site does not have a PageRank and does not appear in the Google searches. And that is a bad situation to be if you have a site that you are actively promoting.

I have tracked the problem and it seems that when googlebot tries to access the website it gets a HTTP/1.1·500·Internal·Server·Error, error that does not appear when other user try to access the website. The problem can be replicated using Rex Swain's HTTP Viewer at http://www.rexswain.com/httpview.html and inserting the URL http://www.dial-a-molecule.org.

Do you have any suggestions on how to address this problem?

Thanks,
Bogdan
10 REPLIES 10

bremmington
Champ on-the-rise
Champ on-the-rise
Last night I looked through the relevant code again, and I still believe that the problem is that your JVM is returning a null default locale. I set up a local system so I could replicate the issue against your website by sending a request with the same headers as Rex Swain's HTTP Viewer was sending. I also saw the 500 response coming back. When I added an Accept-Language header to the request I immediately saw a 200 response (success) instead. I can't see a way that this can happen unless your JVM is reporting a null default locale. When I fire the request without the Accept-Language header at my own server I get a valid 200 response - it assumes a locale of "en". I also looked at the source code for the Locale class in Sun's Java, and I can't see how that can return a null - it should default to "en" if all else fails.

I'm not really sure where I can take this now. The problem appears to be with your JVM. Which JVM is your Tomcat instance running on? Is it a Sun JVM? This may be a stretch, but there is one more thing we could try. It does mean you extending your Java compilation skills a little further. First, you would need to compile this code:

import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

public class LocaleLoggerInterceptor extends HandlerInterceptorAdapter
{
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception
    {
        LogFactory.getLog(LocaleLoggerInterceptor.class).error("Default locale = " + Locale.getDefault());
        return true;
    }
}
The easiest way to do that is to copy that code into a file named "LocaleLoggerInterceptor.java" in the folder "webapps\wcmqs\WEB-INF\classes" in your server's Tomcat installation. Then open a command prompt in that folder and run this command:

javac -classpath .;..\..\..\..\lib\servlet-api.jar;..\lib\org.springframework.webmvc-3.0.0.jar;..\lib\commons-logging-1.1.1.jar LocaleLoggerInterceptor.java
Hopefully this will compile without error or warning and you'll end up with a file named "LocaleLoggerInterceptor.class" in the same folder. The next step is to find a file named "surf-config.xml". This will be in exactly the same folder as you're currently in (<tomcat home>\webapps\wcmqs\WEB-INF\classes). Open this file in a text editor, and find this section:

        <!– Override list of interceptors defined in webframeworkHandlerMappings so that we can add our own. –>
        <property name="interceptors">
            <list>
                <ref bean="requestContextInterceptor"/>
                <!–
                <ref bean="themeInterceptor"/>
                <ref bean="previewContextInterceptor"/>
                –>
                <!– Interceptors added to apply application-wide processing to requests. See also quickstart-request.xml –>
                <ref bean="cmisSessionInterceptor"/>
                <ref bean="applicationDataInterceptor"/>
            </list>
        </property>   
Add one line near the top of this section so it becomes:

        <!– Override list of interceptors defined in webframeworkHandlerMappings so that we can add our own. –>
        <property name="interceptors">
            <list>
                <bean class="LocaleLoggerInterceptor" />
                <ref bean="requestContextInterceptor"/>
                <!–
                <ref bean="themeInterceptor"/>
                <ref bean="previewContextInterceptor"/>
                –>
                <!– Interceptors added to apply application-wide processing to requests. See also quickstart-request.xml –>
                <ref bean="cmisSessionInterceptor"/>
                <ref bean="applicationDataInterceptor"/>
            </list>
        </property>   
Save the file and restart Tomcat. When you request a page from your site now you should see a line like this in your log file:
08:33:29,898 ERROR [LocaleLoggerInterceptor] Default locale = en_GB
If you get to that point then let me know what the line in your log file looks like.