Thanks Grzegorz,
Servlet implementation and Spring bean registration:
I've, then, been able to set my XQuery Servlet in a block registered as a
bean.
I patched the block web.xml to implement eXist database servlet, and add the
required dependencies in the pom.xml (after installing then in my mvn local
repositery).
It works. I can now start XQuery block using [mvn jetty:run] and execute any
XQuery file stored in my block under the root webapp and, in the meantime,
access the database.
Servlet Service functionality:
I tried to access this block from another block (named block test1) by:
adding the XQuery block (named test2) as a dependency of the block test1, in
test1 pom.xml.
adding the XQuery block entry in test1 servlet-sevice.xml
creating, in test1 block, a sitemap pipeline calling the XQuery servlet:
pipeline :
<map:match pattern="trytest2">
<map:generate src="servlet:test2:/header.xml" type="file"/>
<map:serialize type="xml"/>
</map:match>
note:
XQuery block has no use of sitemap.xmap but I kept
src/main/resources/COB-INF directory.
I've been succesful accessing another block from test1 block (this block was
based on org.apache.cocoon.sitemap.SitemapServlet)
problem with my XQuery Servlet called from test1 block:
I got an error:
2008-01-25 20:27:04,624 btpool0-1 DEBUG cocoon - Resolving
'servlet:test2:/test2/header.xml' with base
'file:///C:/Users/BMS/Documents/test/test1/./src/main/resources/COB-INF/' in
context 'file:/C:/Users/BMS/Documents/test/test1/'
2008-01-25 20:27:04,624 btpool0-1 DEBUG support.DefaultListableBeanFactory -
Returning cached instance of singleton bean
'org.apache.avalon.framework.service.ServiceManager'
2008-01-25 20:27:04,624 btpool0-1 DEBUG support.DefaultListableBeanFactory -
Returning cached instance of singleton bean
'org.apache.excalibur.source.SourceFactory/servlet'
2008-01-25 20:27:04,624 btpool0-1 DEBUG cocoon - Resolved to systemID :
servlet:test2:/test2/header.xml
2008-01-25 20:27:04,646 btpool0-1 DEBUG cocoon - Cached response not found
for 'trytest2' using key: PK_G-file-
servlet:test2:/test2/header.xml_S-xml-;encoding=ISO-8859-1
2008-01-25 20:27:04,665 btpool0-1 DEBUG util.ConfigurationHelper - Got eXist
home from broker: C:\Users\BMS\Documents\test\test1
\target\rcl\webapp\WEB-INF
2008-01-25 20:27:04,665 btpool0-1 WARN http.Descriptor - Giving up unable
to read descriptor file from C:\Users\BMS\Documents\test\test1
\target\rcl\webapp\WEB-INF\descriptor.xml
2008-01-25 20:27:04,666 btpool0-1 WARN http.Descriptor - Giving up unable
to read descriptor.xml file from classloader in package
org.exist.http
2008-01-25 20:27:04,666 btpool0-1 DEBUG cocoon -
getValidityForInternalPipeline(0): generator: using getValidity,
validity==null
2008-01-25 20:27:04,689 btpool0-1 ERROR cocoon - Internal Cocoon Problem
org.apache.cocoon.ProcessingException: Failed to process pipeline
at <map:serialize type="xml"> -
file:///C:/Users/BMS/Documents/test/test1/./src/main/resources/COB-INF/sitemap.xmap:107:36
at <map:generate type="file"> -
file:///C:/Users/BMS/Documents/test/test1/./src/main/resources/COB-INF/sitemap.xmap:106:74
at <map:match> -
file:///C:/Users/BMS/Documents/test/test1/./src/main/resources/COB-INF/sitemap.xmap:105:37
at
org.apache.cocoon.ProcessingException.throwLocated(ProcessingException.java:143)
at
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.handleException(AbstractProcessingPipeline.java:921)
at
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.processXMLPipeline(AbstractProcessingPipeline.java:546)
at
org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline.processXMLPipeline
(AbstractCachingProcessingPipeline.java:275)
at
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:437)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.cocoon.core.container.spring.avalon.PoolableProxyHandler.invoke(PoolableProxyHandler.java:72)
at $Proxy8.process(Unknown Source)
at
org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(SerializeNode.java:144)
at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:55)
at
org.apache.cocoon.components.treeprocessor.sitemap.MatchNode.invoke(MatchNode.java:87)
...
...
at
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
Caused by: java.lang.NullPointerException
at java.io.File.<init>(File.java:222)
at org.exist.http.servlets.XQueryServlet.process(XQueryServlet.java:265)
at org.exist.http.servlets.XQueryServlet.doGet(XQueryServlet.java:164)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at
org.apache.cocoon.servletservice.ServletServiceContext$PathDispatcher.forward(ServletServiceContext.java:567)
at
org.apache.cocoon.servletservice.ServletServiceContext$NamedDispatcher.forward(ServletServiceContext.java:503)
at
org.apache.cocoon.servletservice.ServletConnection.connect(ServletConnection.java:130)
at
org.apache.cocoon.servletservice.components.ServletSource.connect(ServletSource.java:167)
at
org.apache.cocoon.servletservice.components.ServletSource.getInputStream(ServletSource.java:78)
at
org.apache.cocoon.components.source.util.SourceUtil.getInputSource(SourceUtil.java:395)
at
org.apache.cocoon.components.source.util.SourceUtil.parse(SourceUtil.java:264)
at
org.apache.cocoon.generation.FileGenerator.generate(FileGenerator.java:144)
at
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.processXMLPipeline(AbstractProcessingPipeline.java:542)
It seems it cannot find the file, but if I execute only the XQuery Servlet,
it works.
Here's my XQuery Servlet bean:
<bean id="com.mycompany.test2.service"
class="org.exist.http.servlets.XQueryServlet">
<servlet:context mount-path="/test2"
context-path="blockcontext:/test2/"/>
</bean>
Any idea?
Regards,
Josh
--
View this message in context:
http://www.nabble.com/servlet-mapping-in-Cocoon-2.2-bean--tp15028682p15096282.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]