cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Javier Puerto <jpue...@gmail.com>
Subject Re: XSLT import/include errors
Date Thu, 20 Jun 2013 20:03:31 GMT
2013/6/20 gelo1234 <gelo1234@gmail.com>

> Right, it was NOT Xalan, I used Saxon in my old config. Where could we
> change Xalan to Saxon in C3 ?
>

This was discused before in the mailing list [1], it's a two step process

* Add saxon dependency to pom file. [2]
* Create file META-INF/services/javax.xml.transform.TransformerFactory with
content:

net.sf.saxon.TransformerFactoryImpl

But you can't use both engines at the same time.


>
> Now I've got another "strange" XSL error:
> XML document structures must start and end within the same entity.
>
> What could that mean??? :)
>
> That Xalan is making me scratching my head against the wall :)
>

I think it's better to try Saxon directly if you used to work with it.
Xalan is usually faster but as you have to migrate already made templates
from Saxon IMO it's better to switch the engine.

[1] http://mvnrepository.com/artifact/net.sf.saxon/Saxon-HE
[2]
http://cocoon.markmail.org/message/mjuftsfwdxmnc5fn?q=saxon#query:saxon+page:1+mid:fe2faygf7jdfrzb3+state:results


> Greetings,
> Greg
>
>
> 2013/6/20 Javier Puerto <jpuerto@gmail.com>
>
>>
>>
>>
>> 2013/6/20 gelo1234 <gelo1234@gmail.com>
>>
>>> OK, resolved the issue. Deleted xslt/ directory :/ and now its starting.
>>> STRANGE!!
>>>
>>
>> Yeah, computer's stuff. :)
>>
>>
>>>
>>> And also found that more detailed error info about not being able to
>>> compile XSLT stylesheet was in Tomcat log.
>>>
>>> It seems that with C3 <xsl:variables../> cannot be inherited. The error
>>> said about the same <xsl:variable .../> being defined in 2 different places
>>> :/
>>> One place - in main XSL file and other one - in imported XSL file.
>>>
>>> While it worked fine in C2.1. I use extensively <xsl:template /> and
>>> <xsl:variable ../> inheritance, now in C3 it makes XSLT not being compiled
>>> :/
>>>
>>
>> What version of C2.1 did you use? Maybe old Xalan? I've found the
>> following note in the Xalan documentation [1]:
>>
>> "Note that all top-level parameters and variables from all imported and
>> included stylesheets will be placed as direct children of the top-level
>> stylesheet in the AST. This done to make global variables truly global and
>> not just global in the stylesheet where it was declared."
>>
>> You should avoid duplicate variable declarations, at the end of the page
>> it's explained how the forward references works. You could extract some
>> common variables to a XSLT template so you can use several templates
>> without collision.
>>
>>  [1]: http://xml.apache.org/xalan-j/xsltc/xsl_variable_design.html
>>
>>
>>> Greetings,
>>> Greg
>>>
>>>
>>>
>>> 2013/6/20 gelo1234 <gelo1234@gmail.com>
>>>
>>>>
>>>> Now Im lost. The Cocoon context doesn't work anymore. Restarting Tomcat
>>>> doesn't help. I tried to clean work directory, and still
>>>> NullPointerException.
>>>>
>>>> Any idea what might be wrong ?
>>>> And how to switch off imported xslt caching ?
>>>>
>>>> INFO: Starting Servlet Engine: Apache Tomcat/7.0.40
>>>> cze 20, 2013 8:43:28 PM org.apache.catalina.startup.HostConfig
>>>> deployDirectory
>>>> INFO: Deploying web application directory
>>>> /var/lib/tomcat/webapps/mywebapp-1.0-SNAPSHOT
>>>> cze 20, 2013 8:43:29 PM org.apache.catalina.core.ContainerBase
>>>> addChildInternal
>>>> SEVERE: ContainerBase.addChild: start:
>>>> org.apache.catalina.LifecycleException: Failed to start component
>>>> [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/mywebapp-1.0-SNAPSHOT]]
>>>>     at
>>>> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
>>>>     at
>>>> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
>>>>     at
>>>> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
>>>>     at
>>>> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
>>>>     at
>>>> org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1114)
>>>>     at
>>>> org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1672)
>>>>     at java.util.concurrent.Executors$RunnableAdapter.call(Unknown
>>>> Source)
>>>>     at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
>>>>     at java.util.concurrent.FutureTask.run(Unknown Source)
>>>>     at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
>>>>     at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
>>>> Source)
>>>>     at java.lang.Thread.run(Unknown Source)
>>>> Caused by: java.lang.NullPointerException
>>>>     at
>>>> org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2092)
>>>>     at
>>>> org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2093)
>>>>     at
>>>> org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2093)
>>>>     at
>>>> org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2093)
>>>>     at
>>>> org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2093)
>>>>     at
>>>> org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1300)
>>>>     at
>>>> org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878)
>>>>     at
>>>> org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369)
>>>>     at
>>>> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
>>>>     at
>>>> org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
>>>>     at
>>>> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5269)
>>>>     at
>>>> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
>>>>     ... 11 more
>>>>
>>>> cze 20, 2013 8:43:29 PM org.apache.catalina.startup.HostConfig
>>>> deployDirectory
>>>> SEVERE: Error deploying web application directory
>>>> /var/lib/tomcat/webapps/mywebapp-1.0-SNAPSHOT
>>>> java.lang.IllegalStateException: ContainerBase.addChild: start:
>>>> org.apache.catalina.LifecycleException: Failed to start component
>>>> [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/mywebapp-1.0-SNAPSHOT]]
>>>>     at
>>>> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:904)
>>>>     at
>>>> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
>>>>     at
>>>> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
>>>>     at
>>>> org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1114)
>>>>     at
>>>> org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1672)
>>>>     at java.util.concurrent.Executors$RunnableAdapter.call(Unknown
>>>> Source)
>>>>     at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
>>>>     at java.util.concurrent.FutureTask.run(Unknown Source)
>>>>     at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
>>>>     at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
>>>> Source)
>>>>     at java.lang.Thread.run(Unknown Source)
>>>>
>>>> Greetings,
>>>> Greg
>>>>
>>>>
>>>>
>>>> 2013/6/20 Javier Puerto <jpuerto@gmail.com>
>>>>
>>>>> Hi Greg,
>>>>>
>>>>> El 20/06/2013 20:00, "gelo1234" <gelo1234@gmail.com> escribió:
>>>>>
>>>>> >
>>>>> >
>>>>> > It looks like XSLT also got cut in functionality in C3. I tried
to
>>>>> rerun old XSL stylesheets with new C3 and gave up.
>>>>> >
>>>>> > The error says nothing meaningful:
>>>>> >
>>>>> > <exception-report class="org.apache.cocoon.pipeline.SetupException"
>>>>> timestamp="Thu, 20 Jun 2013 19:58:23 +0200"><message>Impossible
to read
>>>>> XSLT from 'javax.xml.transform.stream.StreamSource@cba24d', see
>>>>> nested exception</message><cause>Could not compile
>>>>> stylesheet</cause><stacktraceCause>javax.xml.transform.TransformerConfigurationException:
>>>>> Could not compile stylesheet
>>>>> >     at
>>>>> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(Unknown
>>>>> Source)
>>>>> >     at
>>>>> org.apache.cocoon.sax.component.XSLTTransformer.load(XSLTTransformer.java:216)
>>>>> >     at
>>>>> org.apache.cocoon.sax.component.XSLTTransformer.load(XSLTTransformer.java:165)
>>>>> >     at
>>>>> org.apache.cocoon.sax.component.XSLTTransformer.setConfiguration(XSLTTransformer.java:264)
>>>>> >     at
>>>>> org.apache.cocoon.sitemap.InvocationImpl.installComponent(InvocationImpl.java:257)
>>>>> >     at
>>>>> >
>>>>> > It looks like there is a problem with xsl:import/xsl:include from
>>>>> the main xsl stylesheet.
>>>>>
>>>>> You are right, seems to be a problem with the imports. I've used
>>>>> Imports and includes with cocoo3 without problems, except that imported
>>>>> files are cached and doesn't update running in RCL. The xslt engine is
>>>>> still xalan so the templates should work like before except for the sources
>>>>> with cocoon:/ protocol that aren't supported.
>>>>>
>>>>> > Moreover I found that when <xsl:template match="RootElement"
is not
>>>>> in the main XSL stylesheet the same error appears.
>>>>>
>>>>> Could you send an example block to reproduce the issue?
>>>>>
>>>>> >
>>>>> > Can we switch on more debugging info what is wrong ?
>>>>>
>>>>> You can edit the logback.xml file and set level to debug but the
>>>>> exception comes from xalan. I suggest to look for sources loaded with
>>>>> cocoon:/ in your code and substitute by servlet:/.
>>>>>
>>>>> >
>>>>> > Greetings,
>>>>> > Greg
>>>>>
>>>>> Salu2.
>>>>>
>>>>
>>>>
>>>
>>
>

Mime
View raw message