[jira] Created: (COCOON-2270) Cocoon fails to find files when deployed into a directory containing a '#' character

View: New views
5 Messages — Rating Filter:   Alert me  

[jira] Created: (COCOON-2270) Cocoon fails to find files when deployed into a directory containing a '#' character

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Cocoon fails to find files when deployed into a directory containing a '#' character
------------------------------------------------------------------------------------

                 Key: COCOON-2270
                 URL: https://issues.apache.org/jira/browse/COCOON-2270
             Project: Cocoon
          Issue Type: Bug
          Components: - Components: Sitemap
    Affects Versions: 2.1.11
            Reporter: Christopher Schultz


I have been using Cocoon 2.1.10 and 2.1.11 for quite some time with a handful of modest pipelines using XSLTs on the local disk.

Recently, I've been building a development server to be shared among several developers on our team. In order to share HTTP ports and URL spaces, we've chosen to use URL spaces like "/[username]/[appname]" rather than simply "/[appname]" as we've used in the past.

We use Apache Tomcat 5.5 as our app server, and the proper way to deploy a web application with a / in its context name is to use either a WAR file such as [username]#[appname].war, or a directory with the same name (minus the ".war", of course).

When we do this, we find that Cocoon gets tripped-up, apparently confused by the # symbol in the path name. It can't find our templates on the disk (maybe?) and it's also failing to find its own "exception2html.xslt" file.

Cocoon has been deployed into this directory:
/home/cschultz/projects/cocoon/app/webapps/cschultz#chadis

Our top-level sitemap has the default exception handler configuration:
    <map:handle-errors>
      <map:select type="exception">

        <map:when test="not-found">
          <map:generate type="exception"/>
          <map:transform src="stylesheets/system/exception2html.xslt">
            <map:parameter name="contextPath" value="{request:contextPath}"/>
            <map:parameter name="realPath" value="{realpath:}"/>
            <map:parameter name="pageTitle" value="Resource not found"/>
          </map:transform>
          <map:serialize status-code="404"/>
        </map:when>

        <map:when test="invalid-continuation">
          <map:generate type="exception"/>
          <map:transform src="stylesheets/system/exception2html.xslt">
            <map:parameter name="contextPath" value="{request:contextPath}"/>
            <map:parameter name="realPath" value="{realpath:}"/>
            <map:parameter name="pageTitle" value="Invalid Continuation"/>
          </map:transform>
          <map:serialize status-code="404"/>
        </map:when>

        <map:otherwise>
          <map:generate type="exception"/>
          <map:transform src="stylesheets/system/exception2html.xslt">
            <map:parameter name="contextPath" value="{request:contextPath}"/>
            <map:parameter name="realPath" value="{realpath:}"/>
          </map:transform>
          <map:serialize status-code="500"/>
        </map:otherwise>
      </map:select>

    </map:handle-errors>

When we try to execute our transformers, we get the following error:

Message: /home/cschultz/.webapps/cocoon/8225/webapps/stylesheets/system/exception2html.xslt (No such file or directory)

If you notice, this path is not correct. It should be:
/home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/stylesheets/system/exception2html.xslt

Note that the path element after "webapps" has been removed.

I have tried changing the path to the exception stylesheet in the top-level sitemap to:

          <map:transform src="/home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/stylesheets/system/exception2html.xslt">

But this results in the following error:
Message: /home/cschultz/.webapps/cocoon/8225/webapps/cschultz (No such file or directory)

Note the path is truncated at the '#' symbol.

Finally, I tried changing the path to:
          <map:transform src="/home/cschultz/.webapps/cocoon/8225/webapps/cschultz%23chadis/stylesheets/system/exception2html.xslt">

Message: Did not find the stylesheet root!

Description: org.apache.cocoon.ProcessingException: Unable to get transformer handler for file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/stylesheets/system/exception2html.xslt at <map:serialize> - file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/sitemap.xmap:736:45 at <map:transform> - file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/sitemap.xmap:731:133 at <map:generate type="exception"> - file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/sitemap.xmap:730:43

full exception chain stacktrace

org.apache.cocoon.ProcessingException: Unable to get transformer handler for file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/stylesheets/system/exception2html.xslt
        at <map:serialize> - file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/sitemap.xmap:736:45
        at <map:transform> - file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/sitemap.xmap:731:133
        at <map:generate type="exception"> - file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/sitemap.xmap:730:43
        at org.apache.cocoon.transformation.TraxTransformer.setup(TraxTransformer.java:339)
        at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.setupPipeline(AbstractProcessingPipeline.java:398)
        at org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline.setupPipeline(AbstractCachingProcessingPipeline.java:718)
        at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.preparePipeline(AbstractProcessingPipeline.java:501)
        at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:453)
        at org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(SerializeNode.java:144)
        at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
        at org.apache.cocoon.components.treeprocessor.sitemap.SwitchSelectNode.invoke(SwitchSelectNode.java:99)
        at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
        at org.apache.cocoon.components.treeprocessor.sitemap.HandleErrorsNode.invoke(HandleErrorsNode.java:90)
        at org.apache.cocoon.components.treeprocessor.sitemap.ErrorHandlerHelper.prepareErrorHandler(ErrorHandlerHelper.java:182)
        at org.apache.cocoon.components.treeprocessor.sitemap.ErrorHandlerHelper.prepareErrorHandler(ErrorHandlerHelper.java:135)
        at org.apache.cocoon.components.treeprocessor.sitemap.ErrorHandlerHelper.invokeErrorHandler(ErrorHandlerHelper.java:108)
        at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:157)
        at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
        at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:93)
        at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:235)
        at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:177)
        at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:254)
        at org.apache.cocoon.Cocoon.process(Cocoon.java:699)
        at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1154)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
        at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:200)
        at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:283)
        at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:773)
        at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:703)
        at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:895)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
        at java.lang.Thread.run(Thread.java:595)
Caused by: org.apache.excalibur.xml.xslt.XSLTProcessorException: Exception when creating Transformer from file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/stylesheets/system/exception2html.xslt
        at org.apache.cocoon.components.xslt.TraxProcessor.getTransformerHandlerAndValidity(TraxProcessor.java:300)
        at org.apache.cocoon.transformation.TraxTransformer.setup(TraxTransformer.java:331)
        ... 36 more
Caused by: javax.xml.transform.TransformerException: Did not find the stylesheet root!
        at org.apache.xalan.processor.StylesheetHandler.endDocument(StylesheetHandler.java:494)
        at org.apache.xerces.parsers.AbstractSAXParser.endDocument(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown Source)
        at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source)
        at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
        at org.apache.xerces.impl.XMLEntityScanner.skipSpaces(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentScannerImpl$TrailingMiscDispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
        at org.apache.excalibur.xml.impl.JaxpParser.parse(JaxpParser.java:315)
        at org.apache.excalibur.xmlizer.DefaultXMLizer.toSAX(DefaultXMLizer.java:128)
        at org.apache.cocoon.components.xslt.TraxProcessor.sourceToSAX(TraxProcessor.java:311)
        at org.apache.cocoon.components.xslt.TraxProcessor.getTransformerHandlerAndValidity(TraxProcessor.java:241)
        ... 37 more
Caused by: javax.xml.transform.TransformerException: Did not find the stylesheet root!
        at org.apache.xalan.processor.StylesheetHandler.endDocument(StylesheetHandler.java:474)
        ... 53 more

This webapp works perfectly fine if deployed as, say, "chadis.war" (without the # symbol).



--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (COCOON-2270) Cocoon fails to find files when deployed into a directory containing a '#' character

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/COCOON-2270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12773522#action_12773522 ]

Christopher Schultz commented on COCOON-2270:
---------------------------------------------

I can confirm that changing the # symbol to a - (minus) enabled Cocoon to work correctly.

This is a reasonable workaround for us in the short-term, but it should be possible to use file paths (on a disk) containing # marks as deployment directories for Cocoon.

> Cocoon fails to find files when deployed into a directory containing a '#' character
> ------------------------------------------------------------------------------------
>
>                 Key: COCOON-2270
>                 URL: https://issues.apache.org/jira/browse/COCOON-2270
>             Project: Cocoon
>          Issue Type: Bug
>          Components: - Components: Sitemap
>    Affects Versions: 2.1.11
>            Reporter: Christopher Schultz
>
> I have been using Cocoon 2.1.10 and 2.1.11 for quite some time with a handful of modest pipelines using XSLTs on the local disk.
> Recently, I've been building a development server to be shared among several developers on our team. In order to share HTTP ports and URL spaces, we've chosen to use URL spaces like "/[username]/[appname]" rather than simply "/[appname]" as we've used in the past.
> We use Apache Tomcat 5.5 as our app server, and the proper way to deploy a web application with a / in its context name is to use either a WAR file such as [username]#[appname].war, or a directory with the same name (minus the ".war", of course).
> When we do this, we find that Cocoon gets tripped-up, apparently confused by the # symbol in the path name. It can't find our templates on the disk (maybe?) and it's also failing to find its own "exception2html.xslt" file.
> Cocoon has been deployed into this directory:
> /home/cschultz/projects/cocoon/app/webapps/cschultz#chadis
> Our top-level sitemap has the default exception handler configuration:
>     <map:handle-errors>
>       <map:select type="exception">
>         <map:when test="not-found">
>           <map:generate type="exception"/>
>           <map:transform src="stylesheets/system/exception2html.xslt">
>             <map:parameter name="contextPath" value="{request:contextPath}"/>
>             <map:parameter name="realPath" value="{realpath:}"/>
>             <map:parameter name="pageTitle" value="Resource not found"/>
>           </map:transform>
>           <map:serialize status-code="404"/>
>         </map:when>
>         <map:when test="invalid-continuation">
>           <map:generate type="exception"/>
>           <map:transform src="stylesheets/system/exception2html.xslt">
>             <map:parameter name="contextPath" value="{request:contextPath}"/>
>             <map:parameter name="realPath" value="{realpath:}"/>
>             <map:parameter name="pageTitle" value="Invalid Continuation"/>
>           </map:transform>
>           <map:serialize status-code="404"/>
>         </map:when>
>         <map:otherwise>
>           <map:generate type="exception"/>
>           <map:transform src="stylesheets/system/exception2html.xslt">
>             <map:parameter name="contextPath" value="{request:contextPath}"/>
>             <map:parameter name="realPath" value="{realpath:}"/>
>           </map:transform>
>           <map:serialize status-code="500"/>
>         </map:otherwise>
>       </map:select>
>     </map:handle-errors>
> When we try to execute our transformers, we get the following error:
> Message: /home/cschultz/.webapps/cocoon/8225/webapps/stylesheets/system/exception2html.xslt (No such file or directory)
> If you notice, this path is not correct. It should be:
> /home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/stylesheets/system/exception2html.xslt
> Note that the path element after "webapps" has been removed.
> I have tried changing the path to the exception stylesheet in the top-level sitemap to:
>           <map:transform src="/home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/stylesheets/system/exception2html.xslt">
> But this results in the following error:
> Message: /home/cschultz/.webapps/cocoon/8225/webapps/cschultz (No such file or directory)
> Note the path is truncated at the '#' symbol.
> Finally, I tried changing the path to:
>           <map:transform src="/home/cschultz/.webapps/cocoon/8225/webapps/cschultz%23chadis/stylesheets/system/exception2html.xslt">
> Message: Did not find the stylesheet root!
> Description: org.apache.cocoon.ProcessingException: Unable to get transformer handler for file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/stylesheets/system/exception2html.xslt at <map:serialize> - file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/sitemap.xmap:736:45 at <map:transform> - file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/sitemap.xmap:731:133 at <map:generate type="exception"> - file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/sitemap.xmap:730:43
> full exception chain stacktrace
> org.apache.cocoon.ProcessingException: Unable to get transformer handler for file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/stylesheets/system/exception2html.xslt
> at <map:serialize> - file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/sitemap.xmap:736:45
> at <map:transform> - file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/sitemap.xmap:731:133
> at <map:generate type="exception"> - file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/sitemap.xmap:730:43
> at org.apache.cocoon.transformation.TraxTransformer.setup(TraxTransformer.java:339)
> at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.setupPipeline(AbstractProcessingPipeline.java:398)
> at org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline.setupPipeline(AbstractCachingProcessingPipeline.java:718)
> at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.preparePipeline(AbstractProcessingPipeline.java:501)
> at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:453)
> at org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(SerializeNode.java:144)
> at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
> at org.apache.cocoon.components.treeprocessor.sitemap.SwitchSelectNode.invoke(SwitchSelectNode.java:99)
> at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
> at org.apache.cocoon.components.treeprocessor.sitemap.HandleErrorsNode.invoke(HandleErrorsNode.java:90)
> at org.apache.cocoon.components.treeprocessor.sitemap.ErrorHandlerHelper.prepareErrorHandler(ErrorHandlerHelper.java:182)
> at org.apache.cocoon.components.treeprocessor.sitemap.ErrorHandlerHelper.prepareErrorHandler(ErrorHandlerHelper.java:135)
> at org.apache.cocoon.components.treeprocessor.sitemap.ErrorHandlerHelper.invokeErrorHandler(ErrorHandlerHelper.java:108)
> at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:157)
> at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
> at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:93)
> at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:235)
> at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:177)
> at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:254)
> at org.apache.cocoon.Cocoon.process(Cocoon.java:699)
> at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1154)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
> at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:200)
> at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:283)
> at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:773)
> at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:703)
> at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:895)
> at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
> at java.lang.Thread.run(Thread.java:595)
> Caused by: org.apache.excalibur.xml.xslt.XSLTProcessorException: Exception when creating Transformer from file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/stylesheets/system/exception2html.xslt
> at org.apache.cocoon.components.xslt.TraxProcessor.getTransformerHandlerAndValidity(TraxProcessor.java:300)
> at org.apache.cocoon.transformation.TraxTransformer.setup(TraxTransformer.java:331)
> ... 36 more
> Caused by: javax.xml.transform.TransformerException: Did not find the stylesheet root!
> at org.apache.xalan.processor.StylesheetHandler.endDocument(StylesheetHandler.java:494)
> at org.apache.xerces.parsers.AbstractSAXParser.endDocument(Unknown Source)
> at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown Source)
> at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source)
> at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
> at org.apache.xerces.impl.XMLEntityScanner.skipSpaces(Unknown Source)
> at org.apache.xerces.impl.XMLDocumentScannerImpl$TrailingMiscDispatcher.dispatch(Unknown Source)
> at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
> at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
> at org.apache.excalibur.xml.impl.JaxpParser.parse(JaxpParser.java:315)
> at org.apache.excalibur.xmlizer.DefaultXMLizer.toSAX(DefaultXMLizer.java:128)
> at org.apache.cocoon.components.xslt.TraxProcessor.sourceToSAX(TraxProcessor.java:311)
> at org.apache.cocoon.components.xslt.TraxProcessor.getTransformerHandlerAndValidity(TraxProcessor.java:241)
> ... 37 more
> Caused by: javax.xml.transform.TransformerException: Did not find the stylesheet root!
> at org.apache.xalan.processor.StylesheetHandler.endDocument(StylesheetHandler.java:474)
> ... 53 more
> This webapp works perfectly fine if deployed as, say, "chadis.war" (without the # symbol).

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (COCOON-2270) Cocoon fails to find files when deployed into a directory containing a '#' character

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/COCOON-2270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12773532#action_12773532 ]

Jasha Joachimsthal commented on COCOON-2270:
--------------------------------------------

Characters like # and ? are special. The sourceresolver tries to create a uri of your path and therefore stops at the # character.

> Cocoon fails to find files when deployed into a directory containing a '#' character
> ------------------------------------------------------------------------------------
>
>                 Key: COCOON-2270
>                 URL: https://issues.apache.org/jira/browse/COCOON-2270
>             Project: Cocoon
>          Issue Type: Bug
>          Components: - Components: Sitemap
>    Affects Versions: 2.1.11
>            Reporter: Christopher Schultz
>
> I have been using Cocoon 2.1.10 and 2.1.11 for quite some time with a handful of modest pipelines using XSLTs on the local disk.
> Recently, I've been building a development server to be shared among several developers on our team. In order to share HTTP ports and URL spaces, we've chosen to use URL spaces like "/[username]/[appname]" rather than simply "/[appname]" as we've used in the past.
> We use Apache Tomcat 5.5 as our app server, and the proper way to deploy a web application with a / in its context name is to use either a WAR file such as [username]#[appname].war, or a directory with the same name (minus the ".war", of course).
> When we do this, we find that Cocoon gets tripped-up, apparently confused by the # symbol in the path name. It can't find our templates on the disk (maybe?) and it's also failing to find its own "exception2html.xslt" file.
> Cocoon has been deployed into this directory:
> /home/cschultz/projects/cocoon/app/webapps/cschultz#chadis
> Our top-level sitemap has the default exception handler configuration:
>     <map:handle-errors>
>       <map:select type="exception">
>         <map:when test="not-found">
>           <map:generate type="exception"/>
>           <map:transform src="stylesheets/system/exception2html.xslt">
>             <map:parameter name="contextPath" value="{request:contextPath}"/>
>             <map:parameter name="realPath" value="{realpath:}"/>
>             <map:parameter name="pageTitle" value="Resource not found"/>
>           </map:transform>
>           <map:serialize status-code="404"/>
>         </map:when>
>         <map:when test="invalid-continuation">
>           <map:generate type="exception"/>
>           <map:transform src="stylesheets/system/exception2html.xslt">
>             <map:parameter name="contextPath" value="{request:contextPath}"/>
>             <map:parameter name="realPath" value="{realpath:}"/>
>             <map:parameter name="pageTitle" value="Invalid Continuation"/>
>           </map:transform>
>           <map:serialize status-code="404"/>
>         </map:when>
>         <map:otherwise>
>           <map:generate type="exception"/>
>           <map:transform src="stylesheets/system/exception2html.xslt">
>             <map:parameter name="contextPath" value="{request:contextPath}"/>
>             <map:parameter name="realPath" value="{realpath:}"/>
>           </map:transform>
>           <map:serialize status-code="500"/>
>         </map:otherwise>
>       </map:select>
>     </map:handle-errors>
> When we try to execute our transformers, we get the following error:
> Message: /home/cschultz/.webapps/cocoon/8225/webapps/stylesheets/system/exception2html.xslt (No such file or directory)
> If you notice, this path is not correct. It should be:
> /home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/stylesheets/system/exception2html.xslt
> Note that the path element after "webapps" has been removed.
> I have tried changing the path to the exception stylesheet in the top-level sitemap to:
>           <map:transform src="/home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/stylesheets/system/exception2html.xslt">
> But this results in the following error:
> Message: /home/cschultz/.webapps/cocoon/8225/webapps/cschultz (No such file or directory)
> Note the path is truncated at the '#' symbol.
> Finally, I tried changing the path to:
>           <map:transform src="/home/cschultz/.webapps/cocoon/8225/webapps/cschultz%23chadis/stylesheets/system/exception2html.xslt">
> Message: Did not find the stylesheet root!
> Description: org.apache.cocoon.ProcessingException: Unable to get transformer handler for file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/stylesheets/system/exception2html.xslt at <map:serialize> - file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/sitemap.xmap:736:45 at <map:transform> - file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/sitemap.xmap:731:133 at <map:generate type="exception"> - file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/sitemap.xmap:730:43
> full exception chain stacktrace
> org.apache.cocoon.ProcessingException: Unable to get transformer handler for file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/stylesheets/system/exception2html.xslt
> at <map:serialize> - file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/sitemap.xmap:736:45
> at <map:transform> - file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/sitemap.xmap:731:133
> at <map:generate type="exception"> - file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/sitemap.xmap:730:43
> at org.apache.cocoon.transformation.TraxTransformer.setup(TraxTransformer.java:339)
> at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.setupPipeline(AbstractProcessingPipeline.java:398)
> at org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline.setupPipeline(AbstractCachingProcessingPipeline.java:718)
> at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.preparePipeline(AbstractProcessingPipeline.java:501)
> at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:453)
> at org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(SerializeNode.java:144)
> at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
> at org.apache.cocoon.components.treeprocessor.sitemap.SwitchSelectNode.invoke(SwitchSelectNode.java:99)
> at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
> at org.apache.cocoon.components.treeprocessor.sitemap.HandleErrorsNode.invoke(HandleErrorsNode.java:90)
> at org.apache.cocoon.components.treeprocessor.sitemap.ErrorHandlerHelper.prepareErrorHandler(ErrorHandlerHelper.java:182)
> at org.apache.cocoon.components.treeprocessor.sitemap.ErrorHandlerHelper.prepareErrorHandler(ErrorHandlerHelper.java:135)
> at org.apache.cocoon.components.treeprocessor.sitemap.ErrorHandlerHelper.invokeErrorHandler(ErrorHandlerHelper.java:108)
> at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:157)
> at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
> at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:93)
> at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:235)
> at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:177)
> at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:254)
> at org.apache.cocoon.Cocoon.process(Cocoon.java:699)
> at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1154)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
> at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:200)
> at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:283)
> at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:773)
> at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:703)
> at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:895)
> at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
> at java.lang.Thread.run(Thread.java:595)
> Caused by: org.apache.excalibur.xml.xslt.XSLTProcessorException: Exception when creating Transformer from file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/stylesheets/system/exception2html.xslt
> at org.apache.cocoon.components.xslt.TraxProcessor.getTransformerHandlerAndValidity(TraxProcessor.java:300)
> at org.apache.cocoon.transformation.TraxTransformer.setup(TraxTransformer.java:331)
> ... 36 more
> Caused by: javax.xml.transform.TransformerException: Did not find the stylesheet root!
> at org.apache.xalan.processor.StylesheetHandler.endDocument(StylesheetHandler.java:494)
> at org.apache.xerces.parsers.AbstractSAXParser.endDocument(Unknown Source)
> at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown Source)
> at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source)
> at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
> at org.apache.xerces.impl.XMLEntityScanner.skipSpaces(Unknown Source)
> at org.apache.xerces.impl.XMLDocumentScannerImpl$TrailingMiscDispatcher.dispatch(Unknown Source)
> at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
> at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
> at org.apache.excalibur.xml.impl.JaxpParser.parse(JaxpParser.java:315)
> at org.apache.excalibur.xmlizer.DefaultXMLizer.toSAX(DefaultXMLizer.java:128)
> at org.apache.cocoon.components.xslt.TraxProcessor.sourceToSAX(TraxProcessor.java:311)
> at org.apache.cocoon.components.xslt.TraxProcessor.getTransformerHandlerAndValidity(TraxProcessor.java:241)
> ... 37 more
> Caused by: javax.xml.transform.TransformerException: Did not find the stylesheet root!
> at org.apache.xalan.processor.StylesheetHandler.endDocument(StylesheetHandler.java:474)
> ... 53 more
> This webapp works perfectly fine if deployed as, say, "chadis.war" (without the # symbol).

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (COCOON-2270) Cocoon fails to find files when deployed into a directory containing a '#' character

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/COCOON-2270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12773545#action_12773545 ]

Christopher Schultz commented on COCOON-2270:
---------------------------------------------

Does this mean that # symbols in my file paths are a no-go?

It's frustrating that Tomcat (another Apache project) uses a convention that Cocoon cannot tolerate. :(

> Cocoon fails to find files when deployed into a directory containing a '#' character
> ------------------------------------------------------------------------------------
>
>                 Key: COCOON-2270
>                 URL: https://issues.apache.org/jira/browse/COCOON-2270
>             Project: Cocoon
>          Issue Type: Bug
>          Components: - Components: Sitemap
>    Affects Versions: 2.1.11
>            Reporter: Christopher Schultz
>
> I have been using Cocoon 2.1.10 and 2.1.11 for quite some time with a handful of modest pipelines using XSLTs on the local disk.
> Recently, I've been building a development server to be shared among several developers on our team. In order to share HTTP ports and URL spaces, we've chosen to use URL spaces like "/[username]/[appname]" rather than simply "/[appname]" as we've used in the past.
> We use Apache Tomcat 5.5 as our app server, and the proper way to deploy a web application with a / in its context name is to use either a WAR file such as [username]#[appname].war, or a directory with the same name (minus the ".war", of course).
> When we do this, we find that Cocoon gets tripped-up, apparently confused by the # symbol in the path name. It can't find our templates on the disk (maybe?) and it's also failing to find its own "exception2html.xslt" file.
> Cocoon has been deployed into this directory:
> /home/cschultz/projects/cocoon/app/webapps/cschultz#chadis
> Our top-level sitemap has the default exception handler configuration:
>     <map:handle-errors>
>       <map:select type="exception">
>         <map:when test="not-found">
>           <map:generate type="exception"/>
>           <map:transform src="stylesheets/system/exception2html.xslt">
>             <map:parameter name="contextPath" value="{request:contextPath}"/>
>             <map:parameter name="realPath" value="{realpath:}"/>
>             <map:parameter name="pageTitle" value="Resource not found"/>
>           </map:transform>
>           <map:serialize status-code="404"/>
>         </map:when>
>         <map:when test="invalid-continuation">
>           <map:generate type="exception"/>
>           <map:transform src="stylesheets/system/exception2html.xslt">
>             <map:parameter name="contextPath" value="{request:contextPath}"/>
>             <map:parameter name="realPath" value="{realpath:}"/>
>             <map:parameter name="pageTitle" value="Invalid Continuation"/>
>           </map:transform>
>           <map:serialize status-code="404"/>
>         </map:when>
>         <map:otherwise>
>           <map:generate type="exception"/>
>           <map:transform src="stylesheets/system/exception2html.xslt">
>             <map:parameter name="contextPath" value="{request:contextPath}"/>
>             <map:parameter name="realPath" value="{realpath:}"/>
>           </map:transform>
>           <map:serialize status-code="500"/>
>         </map:otherwise>
>       </map:select>
>     </map:handle-errors>
> When we try to execute our transformers, we get the following error:
> Message: /home/cschultz/.webapps/cocoon/8225/webapps/stylesheets/system/exception2html.xslt (No such file or directory)
> If you notice, this path is not correct. It should be:
> /home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/stylesheets/system/exception2html.xslt
> Note that the path element after "webapps" has been removed.
> I have tried changing the path to the exception stylesheet in the top-level sitemap to:
>           <map:transform src="/home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/stylesheets/system/exception2html.xslt">
> But this results in the following error:
> Message: /home/cschultz/.webapps/cocoon/8225/webapps/cschultz (No such file or directory)
> Note the path is truncated at the '#' symbol.
> Finally, I tried changing the path to:
>           <map:transform src="/home/cschultz/.webapps/cocoon/8225/webapps/cschultz%23chadis/stylesheets/system/exception2html.xslt">
> Message: Did not find the stylesheet root!
> Description: org.apache.cocoon.ProcessingException: Unable to get transformer handler for file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/stylesheets/system/exception2html.xslt at <map:serialize> - file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/sitemap.xmap:736:45 at <map:transform> - file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/sitemap.xmap:731:133 at <map:generate type="exception"> - file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/sitemap.xmap:730:43
> full exception chain stacktrace
> org.apache.cocoon.ProcessingException: Unable to get transformer handler for file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/stylesheets/system/exception2html.xslt
> at <map:serialize> - file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/sitemap.xmap:736:45
> at <map:transform> - file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/sitemap.xmap:731:133
> at <map:generate type="exception"> - file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/sitemap.xmap:730:43
> at org.apache.cocoon.transformation.TraxTransformer.setup(TraxTransformer.java:339)
> at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.setupPipeline(AbstractProcessingPipeline.java:398)
> at org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline.setupPipeline(AbstractCachingProcessingPipeline.java:718)
> at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.preparePipeline(AbstractProcessingPipeline.java:501)
> at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:453)
> at org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(SerializeNode.java:144)
> at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
> at org.apache.cocoon.components.treeprocessor.sitemap.SwitchSelectNode.invoke(SwitchSelectNode.java:99)
> at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
> at org.apache.cocoon.components.treeprocessor.sitemap.HandleErrorsNode.invoke(HandleErrorsNode.java:90)
> at org.apache.cocoon.components.treeprocessor.sitemap.ErrorHandlerHelper.prepareErrorHandler(ErrorHandlerHelper.java:182)
> at org.apache.cocoon.components.treeprocessor.sitemap.ErrorHandlerHelper.prepareErrorHandler(ErrorHandlerHelper.java:135)
> at org.apache.cocoon.components.treeprocessor.sitemap.ErrorHandlerHelper.invokeErrorHandler(ErrorHandlerHelper.java:108)
> at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:157)
> at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
> at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:93)
> at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:235)
> at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:177)
> at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:254)
> at org.apache.cocoon.Cocoon.process(Cocoon.java:699)
> at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1154)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
> at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:200)
> at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:283)
> at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:773)
> at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:703)
> at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:895)
> at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
> at java.lang.Thread.run(Thread.java:595)
> Caused by: org.apache.excalibur.xml.xslt.XSLTProcessorException: Exception when creating Transformer from file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/stylesheets/system/exception2html.xslt
> at org.apache.cocoon.components.xslt.TraxProcessor.getTransformerHandlerAndValidity(TraxProcessor.java:300)
> at org.apache.cocoon.transformation.TraxTransformer.setup(TraxTransformer.java:331)
> ... 36 more
> Caused by: javax.xml.transform.TransformerException: Did not find the stylesheet root!
> at org.apache.xalan.processor.StylesheetHandler.endDocument(StylesheetHandler.java:494)
> at org.apache.xerces.parsers.AbstractSAXParser.endDocument(Unknown Source)
> at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown Source)
> at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source)
> at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
> at org.apache.xerces.impl.XMLEntityScanner.skipSpaces(Unknown Source)
> at org.apache.xerces.impl.XMLDocumentScannerImpl$TrailingMiscDispatcher.dispatch(Unknown Source)
> at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
> at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
> at org.apache.excalibur.xml.impl.JaxpParser.parse(JaxpParser.java:315)
> at org.apache.excalibur.xmlizer.DefaultXMLizer.toSAX(DefaultXMLizer.java:128)
> at org.apache.cocoon.components.xslt.TraxProcessor.sourceToSAX(TraxProcessor.java:311)
> at org.apache.cocoon.components.xslt.TraxProcessor.getTransformerHandlerAndValidity(TraxProcessor.java:241)
> ... 37 more
> Caused by: javax.xml.transform.TransformerException: Did not find the stylesheet root!
> at org.apache.xalan.processor.StylesheetHandler.endDocument(StylesheetHandler.java:474)
> ... 53 more
> This webapp works perfectly fine if deployed as, say, "chadis.war" (without the # symbol).

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (COCOON-2270) Cocoon fails to find files when deployed into a directory containing a '#' character

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/COCOON-2270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12773554#action_12773554 ]

Christopher Schultz commented on COCOON-2270:
---------------------------------------------

Also, using %23 ought to have converted a # (meaning anchor) into a literal # (meaning part-of-the-path). Why does this not work as I expect?

> Cocoon fails to find files when deployed into a directory containing a '#' character
> ------------------------------------------------------------------------------------
>
>                 Key: COCOON-2270
>                 URL: https://issues.apache.org/jira/browse/COCOON-2270
>             Project: Cocoon
>          Issue Type: Bug
>          Components: - Components: Sitemap
>    Affects Versions: 2.1.11
>            Reporter: Christopher Schultz
>
> I have been using Cocoon 2.1.10 and 2.1.11 for quite some time with a handful of modest pipelines using XSLTs on the local disk.
> Recently, I've been building a development server to be shared among several developers on our team. In order to share HTTP ports and URL spaces, we've chosen to use URL spaces like "/[username]/[appname]" rather than simply "/[appname]" as we've used in the past.
> We use Apache Tomcat 5.5 as our app server, and the proper way to deploy a web application with a / in its context name is to use either a WAR file such as [username]#[appname].war, or a directory with the same name (minus the ".war", of course).
> When we do this, we find that Cocoon gets tripped-up, apparently confused by the # symbol in the path name. It can't find our templates on the disk (maybe?) and it's also failing to find its own "exception2html.xslt" file.
> Cocoon has been deployed into this directory:
> /home/cschultz/projects/cocoon/app/webapps/cschultz#chadis
> Our top-level sitemap has the default exception handler configuration:
>     <map:handle-errors>
>       <map:select type="exception">
>         <map:when test="not-found">
>           <map:generate type="exception"/>
>           <map:transform src="stylesheets/system/exception2html.xslt">
>             <map:parameter name="contextPath" value="{request:contextPath}"/>
>             <map:parameter name="realPath" value="{realpath:}"/>
>             <map:parameter name="pageTitle" value="Resource not found"/>
>           </map:transform>
>           <map:serialize status-code="404"/>
>         </map:when>
>         <map:when test="invalid-continuation">
>           <map:generate type="exception"/>
>           <map:transform src="stylesheets/system/exception2html.xslt">
>             <map:parameter name="contextPath" value="{request:contextPath}"/>
>             <map:parameter name="realPath" value="{realpath:}"/>
>             <map:parameter name="pageTitle" value="Invalid Continuation"/>
>           </map:transform>
>           <map:serialize status-code="404"/>
>         </map:when>
>         <map:otherwise>
>           <map:generate type="exception"/>
>           <map:transform src="stylesheets/system/exception2html.xslt">
>             <map:parameter name="contextPath" value="{request:contextPath}"/>
>             <map:parameter name="realPath" value="{realpath:}"/>
>           </map:transform>
>           <map:serialize status-code="500"/>
>         </map:otherwise>
>       </map:select>
>     </map:handle-errors>
> When we try to execute our transformers, we get the following error:
> Message: /home/cschultz/.webapps/cocoon/8225/webapps/stylesheets/system/exception2html.xslt (No such file or directory)
> If you notice, this path is not correct. It should be:
> /home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/stylesheets/system/exception2html.xslt
> Note that the path element after "webapps" has been removed.
> I have tried changing the path to the exception stylesheet in the top-level sitemap to:
>           <map:transform src="/home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/stylesheets/system/exception2html.xslt">
> But this results in the following error:
> Message: /home/cschultz/.webapps/cocoon/8225/webapps/cschultz (No such file or directory)
> Note the path is truncated at the '#' symbol.
> Finally, I tried changing the path to:
>           <map:transform src="/home/cschultz/.webapps/cocoon/8225/webapps/cschultz%23chadis/stylesheets/system/exception2html.xslt">
> Message: Did not find the stylesheet root!
> Description: org.apache.cocoon.ProcessingException: Unable to get transformer handler for file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/stylesheets/system/exception2html.xslt at <map:serialize> - file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/sitemap.xmap:736:45 at <map:transform> - file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/sitemap.xmap:731:133 at <map:generate type="exception"> - file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/sitemap.xmap:730:43
> full exception chain stacktrace
> org.apache.cocoon.ProcessingException: Unable to get transformer handler for file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/stylesheets/system/exception2html.xslt
> at <map:serialize> - file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/sitemap.xmap:736:45
> at <map:transform> - file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/sitemap.xmap:731:133
> at <map:generate type="exception"> - file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/sitemap.xmap:730:43
> at org.apache.cocoon.transformation.TraxTransformer.setup(TraxTransformer.java:339)
> at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.setupPipeline(AbstractProcessingPipeline.java:398)
> at org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline.setupPipeline(AbstractCachingProcessingPipeline.java:718)
> at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.preparePipeline(AbstractProcessingPipeline.java:501)
> at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:453)
> at org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(SerializeNode.java:144)
> at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
> at org.apache.cocoon.components.treeprocessor.sitemap.SwitchSelectNode.invoke(SwitchSelectNode.java:99)
> at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
> at org.apache.cocoon.components.treeprocessor.sitemap.HandleErrorsNode.invoke(HandleErrorsNode.java:90)
> at org.apache.cocoon.components.treeprocessor.sitemap.ErrorHandlerHelper.prepareErrorHandler(ErrorHandlerHelper.java:182)
> at org.apache.cocoon.components.treeprocessor.sitemap.ErrorHandlerHelper.prepareErrorHandler(ErrorHandlerHelper.java:135)
> at org.apache.cocoon.components.treeprocessor.sitemap.ErrorHandlerHelper.invokeErrorHandler(ErrorHandlerHelper.java:108)
> at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:157)
> at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
> at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:93)
> at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:235)
> at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:177)
> at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:254)
> at org.apache.cocoon.Cocoon.process(Cocoon.java:699)
> at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1154)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
> at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:200)
> at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:283)
> at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:773)
> at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:703)
> at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:895)
> at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
> at java.lang.Thread.run(Thread.java:595)
> Caused by: org.apache.excalibur.xml.xslt.XSLTProcessorException: Exception when creating Transformer from file:///home/cschultz/.webapps/cocoon/8225/webapps/cschultz#chadis/stylesheets/system/exception2html.xslt
> at org.apache.cocoon.components.xslt.TraxProcessor.getTransformerHandlerAndValidity(TraxProcessor.java:300)
> at org.apache.cocoon.transformation.TraxTransformer.setup(TraxTransformer.java:331)
> ... 36 more
> Caused by: javax.xml.transform.TransformerException: Did not find the stylesheet root!
> at org.apache.xalan.processor.StylesheetHandler.endDocument(StylesheetHandler.java:494)
> at org.apache.xerces.parsers.AbstractSAXParser.endDocument(Unknown Source)
> at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown Source)
> at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source)
> at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
> at org.apache.xerces.impl.XMLEntityScanner.skipSpaces(Unknown Source)
> at org.apache.xerces.impl.XMLDocumentScannerImpl$TrailingMiscDispatcher.dispatch(Unknown Source)
> at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
> at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
> at org.apache.excalibur.xml.impl.JaxpParser.parse(JaxpParser.java:315)
> at org.apache.excalibur.xmlizer.DefaultXMLizer.toSAX(DefaultXMLizer.java:128)
> at org.apache.cocoon.components.xslt.TraxProcessor.sourceToSAX(TraxProcessor.java:311)
> at org.apache.cocoon.components.xslt.TraxProcessor.getTransformerHandlerAndValidity(TraxProcessor.java:241)
> ... 37 more
> Caused by: javax.xml.transform.TransformerException: Did not find the stylesheet root!
> at org.apache.xalan.processor.StylesheetHandler.endDocument(StylesheetHandler.java:474)
> ... 53 more
> This webapp works perfectly fine if deployed as, say, "chadis.war" (without the # symbol).

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.