[opencms-dev] handle404 appears on every 404 page within the export folder

Graeme Kidd coolkidd3 at hotmail.com
Mon Aug 30 16:30:51 CEST 2010


Hi,

If I add "opencms" to the path like your suggestion:
RewriteRule .* http://test.scholar.hw.ac.uk:8088/opencms/handle404?exporturi=%{REQUEST_URI}&%{QUERY_STRING} [P]

Note: I am not using "balancer://mycluster/" Since I am using a dev machine that doesnt use clustering.

Then when I go to http://test.co.uk/export/doesnotexist.gif I get the following error page:
"Error displaying the resource!"
"The requested resource "null" could not be displayed due to a unknown error."

Since I am on a dev machine I decided to enable rewite logs which show the following:
(2) init rewrite engine with requested uri /export/doesnotexist.gif
(3) applying pattern '.*' to uri '/export/doesnotexist.gif'
(4) RewriteCond: input='/export/doesnotexist.gif' pattern='^/export/(.*)' [NC] => matched
(4) RewriteCond: input='D:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/ROOT/export/doesnotexist.gif' pattern='!-f' => matched
(4) RewriteCond: input='D:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/ROOT/export/doesnotexist.gif/index_export.html' pattern='!-f' => matched
(2) rewrite '/export/doesnotexist.gif' -> 'http://test.co.uk:8088/opencms/handle404?exporturi=/export/doesnotexist.gif&'
(3) split uri=http://test.co.uk:8088/opencms/handle404?exporturi=/export/doesnotexist.gif& -> uri=http://test.co.uk:8088/opencms/handle404, args=exporturi=/export/doesnotexist.gif
(2) forcing proxy-throughput with http://test.co.uk:8088/opencms/handle404
(1) go-ahead with proxy request proxy:http://test.co.uk:8088/opencms/handle404 [OK]

I also added the following line to the log4j.properties file:
log4j.logger.org.opencms.importexport.CmsExport=DEBUG

This meant the following appeared on the opencms.log file:
30 Aug 2010 15:04:43,324 DEBUG [cexport.CmsStaticExportManager:2347] Cannot export file "/doesnotexist.gif". Does the guest user have access to it?
org.opencms.file.CmsVfsResourceNotFoundException: Error reading resource from path "/doesnotexist.gif".
    at org.opencms.file.CmsVfsResourceNotFoundException.createException(CmsVfsResourceNotFoundException.java:79)
    at org.opencms.db.CmsDbContext.throwException(CmsDbContext.java:238)
    at org.opencms.db.CmsDbContext.report(CmsDbContext.java:212)
    at org.opencms.db.CmsSecurityManager.readResource(CmsSecurityManager.java:4035)
    at org.opencms.file.CmsObject.readResource(CmsObject.java:3525)
    at org.opencms.file.CmsObject.readResource(CmsObject.java:3492)
    at org.opencms.staticexport.CmsStaticExportManager.getVfsNameInternal(CmsStaticExportManager.java:2338)
    at org.opencms.staticexport.CmsStaticExportManager.getExportData(CmsStaticExportManager.java:2231)
    at org.opencms.staticexport.CmsStaticExportManager.getExportData(CmsStaticExportManager.java:906)
    at org.opencms.main.OpenCmsServlet.handle(OpenCmsServlet.java:196)
    at org.opencms.main.OpenCmsServlet.invokeHandler(OpenCmsServlet.java:272)
    at org.opencms.main.OpenCmsServlet.doGet(OpenCmsServlet.java:150)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    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:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
    at java.lang.Thread.run(Unknown Source)
Caused by: org.opencms.file.CmsVfsResourceNotFoundException: Unable to read resource "/doesnotexist.gif".
    at org.opencms.db.generic.CmsVfsDriver.readResource(CmsVfsDriver.java:1951)
    at org.opencms.db.CmsDriverManager.readResource(CmsDriverManager.java:6524)
    at org.opencms.db.CmsSecurityManager.readResource(CmsSecurityManager.java:5854)
    at org.opencms.db.CmsSecurityManager.readResource(CmsSecurityManager.java:4033)
    ... 22 more

If I remove the "opencms" path in the apache configuration and visit:
 http://test.co.uk/export/doesnotexist.gif

Then I am back to this:
"Server error 404"
 "The requested resource "/handle404" was not found on the server."

Now that I have some log data I thought you would be intreseted in this as well:
(2) init rewrite engine with requested uri /export/doesnotexist.gif
(3) applying pattern '.*' to uri '/export/doesnotexist.gif'
(4) RewriteCond: input='/export/doesnotexist.gif' pattern='^/export/(.*)' [NC] => matched
(4) RewriteCond: input='D:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/ROOT/export/doesnotexist.gif' pattern='!-f' => matched
(4) RewriteCond: input='D:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/ROOT/export/doesnotexist.gif/index_export.html' pattern='!-f' => matched
(2) rewrite '/export/doesnotexist.gif' -> 'http://test.co.uk:8088/handle404?exporturi=/export/doesnotexist.gif&'
(3) split uri=http://test.co.uk:8088/handle404?exporturi=/export/doesnotexist.gif& -> uri=http://test.co.uk:8088/handle404, args=exporturi=/export/doesnotexist.gif
(2) forcing proxy-throughput with http://test.co.uk:8088/handle404
(1) go-ahead with proxy request proxy:http://test.co.uk:8088/handle404 [OK]

The stacktrace seems to follow a slightly different route e.g. "27 more" instead of "22 more":
30 Aug 2010 14:37:54,527 DEBUG [cexport.CmsStaticExportManager:2347] Cannot export file "/doesnotexist.gif". Does the guest user have access to it?
org.opencms.file.CmsVfsResourceNotFoundException: Error reading resource from path "/doesnotexist.gif".
    at org.opencms.file.CmsVfsResourceNotFoundException.createException(CmsVfsResourceNotFoundException.java:79)
    at org.opencms.db.CmsDbContext.throwException(CmsDbContext.java:238)
    at org.opencms.db.CmsDbContext.report(CmsDbContext.java:212)
    at org.opencms.db.CmsSecurityManager.readResource(CmsSecurityManager.java:4035)
    at org.opencms.file.CmsObject.readResource(CmsObject.java:3525)
    at org.opencms.file.CmsObject.readResource(CmsObject.java:3492)
    at org.opencms.staticexport.CmsStaticExportManager.getVfsNameInternal(CmsStaticExportManager.java:2338)
    at org.opencms.staticexport.CmsStaticExportManager.getExportData(CmsStaticExportManager.java:2231)
    at org.opencms.staticexport.CmsStaticExportManager.getExportData(CmsStaticExportManager.java:906)
    at org.opencms.main.OpenCmsServlet.handle(OpenCmsServlet.java:196)
    at org.opencms.main.OpenCmsServlet.invokeHandler(OpenCmsServlet.java:272)
    at org.opencms.main.OpenCmsServlet.doGet(OpenCmsServlet.java:150)
    at org.opencms.main.OpenCmsServletErrorHandler.doGet(OpenCmsServletErrorHandler.java:82)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    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.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:438)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
    at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:416)
    at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:343)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:144)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
    at java.lang.Thread.run(Unknown Source)
Caused by: org.opencms.file.CmsVfsResourceNotFoundException: Unable to read resource "/doesnotexist.gif".
    at org.opencms.db.generic.CmsVfsDriver.readResource(CmsVfsDriver.java:1951)
    at org.opencms.db.CmsDriverManager.readResource(CmsDriverManager.java:6524)
    at org.opencms.db.CmsSecurityManager.readResource(CmsSecurityManager.java:5854)
    at org.opencms.db.CmsSecurityManager.readResource(CmsSecurityManager.java:4033)
    ... 27 more

any other ideas?

Thanks,
Graeme

----------------------------------------
> Date: Mon, 30 Aug 2010 09:46:52 +0200
> From: m.jaeger at alkacon.com
> To: opencms-dev at opencms.org
> Subject: Re: [opencms-dev] handle404 appears on every 404 page within the export folder
>
> Hi Graeme,
>
> Try it with that line:
> RewriteRule .* balancer://mycluster/opencms/handle404?exporturi=%{REQUEST_URI}&%{QUERY_STRING} [P]
>
> instead of that line, please:
> RewriteRule .* balancer://mycluster/handle404?exporturi=%{REQUEST_URI}&%{QUERY_STRING} [P]
>
>
> Because, I thought, that www.test.com is your own test site, I thought, that you do not get the OpenCms 404 error page, but another 404 error page. But, I think that you get the OpenCms 404 error page that says, that the
> requested resource "/handle404" is not available. If you change the line above, than that problem does not more exist.
>
> --
> Kind Regards,
> Mario.
>
> -------------------
> Mario Jäger
>
> Alkacon Software GmbH - The OpenCms Experts
> http://www.alkacon.com - http://www.opencms.org
>
>
> Graeme Kidd schrieb:
>>
>> Sorry I dont have a publically available url but the export processes does work. For example I could have this URL:
>> http://www.test.com/export/doesexist.gif
>>
>> If I delete "export/doesexist.gif" from the RFS then its created again as soon as I visit "http://www.test.com/export/doesexist.gif".
>>
>> When I attempt to go to a URL that contains the export path and the file really doesnt exist on either the VFS or RFS. It causes me to get a 404 page that mentions /handle404 e.g http://www.test.com/export/doesnotexist.gif
>>
>> I installed OpenCms as the Root and followed this because I am using mod_proxy with mod_proxy_ajp and mod_proxy_balancer:
>> http://www.opencms-wiki.org/Avoiding_/opencms/opencms_in_the_URL_%28apache_%2B_mod_proxy%29
>>
>> This means my virtual host looks like this:
>> < VirtualHost *:80>
>> < Directory "D:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/ROOT/">
>> Order allow,deny
>> Allow from all
>> < / Directory>
>> ServerName test.co.uk
>> DocumentRoot "D:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/ROOT/"
>> ErrorLog logs/error.log
>>
>> # Log only non-redirect requests in "normal" log file
>> SetEnvIf Request_URI "\/opencms\/*" redirect
>> CustomLog logs/test.co.uk-access.log common env=!redirect
>>
>> RewriteEngine on
>> RewriteLog logs/test.rewrite.log
>> RewriteLogLevel 9
>>
>> # Redirect all request to non-existing file in the export directory to OpenCms which will generate the files "on the fly"
>> RewriteCond %{REQUEST_URI} ^/export/(.*) [NC]
>> RewriteCond "%{DOCUMENT_ROOT}%{REQUEST_FILENAME}" !-f
>> RewriteCond "%{DOCUMENT_ROOT}%{REQUEST_FILENAME}/index_export.html" !-f
>> RewriteRule .* balancer://mycluster/handle404?exporturi=%{REQUEST_URI}&%{QUERY_STRING} [P]
>>
>> # Also redirect all other 404 errors to OpenCms
>> ErrorDocument 404 /system/shared/handle404.html
>>
>> ProxyPass /opencms/ !
>> RedirectPermanent /opencms/ http://test.co.uk/
>>
>> ProxyPass /resources/ !
>> ProxyPass /export/ !
>>
>> ProxyPass / balancer://mycluster/opencms/
>> ProxyPassReverse / balancer://mycluster/opencms/
>> < / VirtualHost>
>>
>> Graeme
>>
>>
>> ----------------------------------------
>>
>>> Date: Fri, 27 Aug 2010 10:07:48 +0200
>>> From: m.jaeger at alkacon.com
>>> To: opencms-dev at opencms.org
>>> Subject: Re: [opencms-dev] handle404 appears on every 404 page within the export folder
>>>
>>> Hi Graeme,
>>>
>>> Send us an example link to a successful exported OpenCms resource, please.
>>>
>>> What is the name of your OpenCms application in TomCat?
>>>
>>> Did you configure your OpenCms, TomCat and Apache like described here?: http://www.opencms-wiki.org/MultiSite_configuration_instructions_%28apache_%2B_mod_jk%29
>>>
>>> --
>>> Kind Regards,
>>> Mario.
>>>
>>> -------------------
>>> Mario Jäger
>>>
>>> Alkacon Software GmbH - The OpenCms Experts
>>> http://www.alkacon.com - http://www.opencms.org
>>>
>>>
>>> Graeme Kidd schrieb:
>>>
>>>> Yes sorry I copy and pasted from the documentation and not my real config so it does actually says:
>>>> RewriteRule .* balancer://mycluster/handle404?exporturi=%{REQUEST_URI}&%{QUERY_STRING} [P]
>>>>
>>>> Any other ideas?
>>>>
>>>> Thanks,
>>>> Graeme
>>>>
>>>>
>>>> ----------------------------------------
>>>>
>>>>
>>>>> Date: Thu, 26 Aug 2010 09:36:58 +0200
>>>>> From: m.jaeger at alkacon.com
>>>>> To: opencms-dev at opencms.org
>>>>> Subject: Re: [opencms-dev] handle404 appears on every 404 page within the export folder
>>>>>
>>>>> Hi Graeme,
>>>>>
>>>>> It seems, that you use Apache with mod_jk.
>>>>>
>>>>> Please, have a look here to check your configuration: http://www.opencms-wiki.org/MultiSite_configuration_instructions_%28apache_%2B_mod_jk%29
>>>>>
>>>>> I think one point is, that you should use the following line in the Apache configuration, if your OpenCms installation is installed as the ROOT application in Tomcat:
>>>>>
>>>>> RewriteRule .* http://127.0.0.1:8081/opencms/handle404?exporturi=%{REQUEST_URI}&%{QUERY_STRING} [P]
>>>>>
>>>>> instead of that line:
>>>>>
>>>>> RewriteRule .* http://127.0.0.1:8081/handle404?exporturi=%{REQUEST_URI}&%{QUERY_STRING} [P]
>>>>>
>>>>> --
>>>>> Kind Regards,
>>>>> Mario.
>>>>>
>>>>> -------------------
>>>>> Mario Jäger
>>>>>
>>>>> Alkacon Software GmbH - The OpenCms Experts
>>>>> http://www.alkacon.com - http://www.opencms.org
>>>>>
>>>>>
>>>>> Graeme Kidd schrieb:
>>>>>
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I am using the "CmsOnDemandStaticExportHandler" Static Export Handler which requires the following mod_rewrite configuration:
>>>>>> RewriteCond %{REQUEST_URI} ^/export/(.*) [NC]
>>>>>> RewriteCond "%{DOCUMENT_ROOT}%{REQUEST_FILENAME}" !-f
>>>>>> RewriteCond "%{DOCUMENT_ROOT}%{REQUEST_FILENAME}/index_export.html" !-f
>>>>>> RewriteRule .* http://127.0.0.1:8081/handle404?exporturi=%{REQUEST_URI}&%{QUERY_STRING} [P]
>>>>>>
>>>>>> This all works fine when the resource doesn’t exist but is still to be exported, what I find annoying however is when the file really doesn't exist. As it causes the 404 page to say this within the export directory:
>>>>>> "The requested resource "/handle404" was not found on the server."
>>>>>>
>>>>>> So for example you could have:
>>>>>> http://www.test.com/export/doesnotexist.gif
>>>>>>
>>>>>> Then instead of saying:
>>>>>> The requested resource "/export/doesnotexist.gif" was not found on the server.
>>>>>>
>>>>>> It says:
>>>>>> The requested resource "/handle404" was not found on the server.
>>>>>>
>>>>>> I have tried changing the line to "request.getRequestURL()" and "request.getServletPath()" but they both return a path that includes handle404.
>>>>>>
>>>>>> The only way round this I can think of would be to use JavaScript in the handle404.jsp page e.g.
>>>>>> "document.location.href"
>>>>>>
>>>>>> If that is the best solution then might I suggest that a future improvement would be to detect if the file really doesn’t exist and return the URI to its original location.
>>>>>>
>>>>>> Thanks,
>>>>>> Graeme
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> This mail is sent to you from the opencms-dev mailing list
>>>>>> To change your list options, or to unsubscribe from the list, please visit
>>>>>> http://lists.opencms.org/mailman/listinfo/opencms-dev
>>>>>>
>>>>>>
>>>>>>
>>>>> _______________________________________________
>>>>> This mail is sent to you from the opencms-dev mailing list
>>>>> To change your list options, or to unsubscribe from the list, please visit
>>>>> http://lists.opencms.org/mailman/listinfo/opencms-dev
>>>>>
>>>>>
>>>> _______________________________________________
>>>> This mail is sent to you from the opencms-dev mailing list
>>>> To change your list options, or to unsubscribe from the list, please visit
>>>> http://lists.opencms.org/mailman/listinfo/opencms-dev
>>>>
>>>>
>>> _______________________________________________
>>> This mail is sent to you from the opencms-dev mailing list
>>> To change your list options, or to unsubscribe from the list, please visit
>>> http://lists.opencms.org/mailman/listinfo/opencms-dev
>>>
>>
>>
>> _______________________________________________
>> This mail is sent to you from the opencms-dev mailing list
>> To change your list options, or to unsubscribe from the list, please visit
>> http://lists.opencms.org/mailman/listinfo/opencms-dev
>>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
 		 	   		  


More information about the opencms-dev mailing list