You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Laurent Comte <la...@oodrive.fr> on 2003/02/13 19:58:22 UTC

Using a servlet as source for a generator


Hi all,

i've read the article at
http://wiki.cocoondev.org/Wiki.jsp?page=IntegrateAServlet and i have a
question ...

I tried to use a servlet as a source for a generator and it works when i set
the full url of the servlet (like "http://localhost:8080/myApp/myServlet").

Unfortunately, when i dont't specify the full url but the "servlet-mapping"
(like "/myApp/myServlet") for src, i've got a weird error (see below) ...

Of course, when i type the same url in my browser, it works
("http://localhost:8080/myApp/myServlet"). Cocoon and my servlet are in the
same webApp (and same Tomcat's Context).

Does it really work for you ?

sitemap.xmap is standard and i had just added this :

  <map:pipelines>
    <map:pipeline match="myApp/test">
      <map:generate uri="/myApp/myServlet"/><!-- return XML -->
      <map:serialize />
    </map:pipeline>
  </map:pipelines>


My conf:

Win2000 SP3
J2SE 1.4.1_01
Tomcat 4.1.18
Cocoon 2.0.4


========== The Error :


type fatal

message Exception during processing of file:/D:/myApp/myServlet

description org.apache.cocoon.ProcessingException: Exception during
processing of file:/D:/myApp/myServlet: java.io.FileNotFoundException:
\myApp\myServlet (The system cannot find the path specified)

sender org.apache.cocoon.servlet.ParanoidCocoonServlet

source Cocoon servlet

stack-trace

org.apache.cocoon.ProcessingException: Exception during processing of
file:/D:/myApp/myServlet: java.io.FileNotFoundException: \myApp\myServlet
(The system cannot find the path specified)
	at
org.apache.cocoon.components.source.AbstractStreamSource.toSAX(AbstractStrea
mSource.java:211)
	at
org.apache.cocoon.generation.FileGenerator.generate(FileGenerator.java:143)
	at
org.apache.cocoon.components.pipeline.CachingEventPipeline.process(CachingEv
entPipeline.java:250)
	at
org.apache.cocoon.components.pipeline.CachingStreamPipeline.process(CachingS
treamPipeline.java:399)
	at
org.apache.cocoon.www.sitemap_xmap.process(D:\Java\Oodrive\Tomcat\work\cocoo
n-files\org/apache/cocoon/www\sitemap_xmap.java:1449)
	at
org.apache.cocoon.www.sitemap_xmap.process(D:\Java\Oodrive\Tomcat\work\cocoo
n-files\org/apache/cocoon/www\sitemap_xmap.java:1340)
	at org.apache.cocoon.sitemap.Handler.process(Handler.java:224)
	at org.apache.cocoon.sitemap.Manager.invoke(Manager.java:179)
	at
org.apache.cocoon.sitemap.SitemapManager.process(SitemapManager.java:154)
	at org.apache.cocoon.Cocoon.process(Cocoon.java:575)
	at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:999)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:260)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:191)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
	at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:170)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172
)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
1040)
	at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1151
)
	at java.lang.Thread.run(Thread.java:536)
Caused by: java.io.FileNotFoundException: \myApp\myServlet (The system
cannot find the path specified)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.(FileInputStream.java:103)
	at
org.apache.cocoon.components.source.FileSource.getInputStream(FileSource.jav
a:140)
	at
org.apache.cocoon.components.source.AbstractStreamSource.getInputSource(Abst
ractStreamSource.java:161)
	at
org.apache.cocoon.components.source.AbstractStreamSource.toSAX(AbstractStrea
mSource.java:206)
	... 37 more
java.io.FileNotFoundException: \myApp\myServlet (The system cannot find the
path specified)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.(FileInputStream.java:103)
	at
org.apache.cocoon.components.source.FileSource.getInputStream(FileSource.jav
a:140)
	at
org.apache.cocoon.components.source.AbstractStreamSource.getInputSource(Abst
ractStreamSource.java:161)
	at
org.apache.cocoon.components.source.AbstractStreamSource.toSAX(AbstractStrea
mSource.java:206)
	at
org.apache.cocoon.generation.FileGenerator.generate(FileGenerator.java:143)
	at
org.apache.cocoon.components.pipeline.CachingEventPipeline.process(CachingEv
entPipeline.java:250)
	at
org.apache.cocoon.components.pipeline.CachingStreamPipeline.process(CachingS
treamPipeline.java:399)
	at
org.apache.cocoon.www.sitemap_xmap.process(D:\Java\Oodrive\Tomcat\work\cocoo
n-files\org/apache/cocoon/www\sitemap_xmap.java:1449)
	at
org.apache.cocoon.www.sitemap_xmap.process(D:\Java\Oodrive\Tomcat\work\cocoo
n-files\org/apache/cocoon/www\sitemap_xmap.java:1340)
	at org.apache.cocoon.sitemap.Handler.process(Handler.java:224)
	at org.apache.cocoon.sitemap.Manager.invoke(Manager.java:179)
	at
org.apache.cocoon.sitemap.SitemapManager.process(SitemapManager.java:154)
	at org.apache.cocoon.Cocoon.process(Cocoon.java:575)
	at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:999)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:260)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:191)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
	at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:170)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172
)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
1040)
	at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1151
)
	at java.lang.Thread.run(Thread.java:536)


request-uri

myApp/test

path-info

test

=======================================================

Thanks.

Laurent


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: Using a servlet as source for a generator

Posted by Laurent Comte <la...@oodrive.fr>.

>> It seems that it check if uri begin with "http".

>That is what I thought as well. But
>http://wiki.cocoondev.org/Wiki.jsp?page=IntegrateAServlet
>seems to indicate otherwise.

Yes, but the author of this article told me that he didn't test it ! :-/
He will going to change his article ...


>> Does it work with "https" ???

>I don't think FileGenerator supports this.
>But you can try WebServiceProxyGenerator which uses commons-http client
>which supports https.

 In this case, i've got an SSL exception (certainly because i didn't
configure SSL
on my server), so it seems to look the ressource in the good place ...


Laurent.


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Using a servlet as source for a generator

Posted by Guido Casper <gc...@s-und-n.de>.
> It seems that it check if uri begin with "http".

That is what I thought as well. But
http://wiki.cocoondev.org/Wiki.jsp?page=IntegrateAServlet
seems to indicate otherwise.

> Does it work with "https" ???

I don't think FileGenerator supports this.
But you can try WebServiceProxyGenerator which uses commons-http client
which supports https.

HTH
Guido


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: Using a servlet as source for a generator

Posted by Laurent Comte <la...@oodrive.fr>.

>OK, one last guess:
><map:generate src="/myServlet"/>

I tried for 2 hours all sorts of things :(( ...
The only one working is with the full url ...

I think that for Cocoon:

1/ there's some confusion between "src" and "uri" attribute for the
generator
2/ there's some confusion on how to know if uri is internet-uri or
filesystem-uri ...
It seems that it check if uri begin with "http". Does it work with "https"
???


>If this does not work I would go with:
><map:generate
<src="http://{request:serverName}:{request:serverPort}{request:contextPath}/
m
<yServlet"/>

>AFAIK input modules have been backported to 2.0.5-dev

I use only 2.0.4 prod version, i have enough problems with it :)

Regards,
Laurent


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Using a servlet as source for a generator

Posted by Guido Casper <gc...@s-und-n.de>.
OK, one last guess:
<map:generate src="/myServlet"/>

If this does not work I would go with:
<map:generate
src="http://{request:serverName}:{request:serverPort}{request:contextPath}/m
yServlet"/>

AFAIK input modules have been backported to 2.0.5-dev

Guido

----- Original Message -----
From: "Laurent Comte" <la...@oodrive.fr>
To: <co...@xml.apache.org>
Sent: Friday, February 14, 2003 11:12 AM
Subject: RE: Using a servlet as source for a generator


>
> >Sorry, it should be
> ><map:generate src="myServlet"/>
>
> I've tried also, but in this case, it looks the ressource on the file
system
> (FileNotFoundException) ...
>
> Laurent
>
>
>
>
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
>


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: Using a servlet as source for a generator

Posted by Laurent Comte <la...@oodrive.fr>.
>Sorry, it should be
><map:generate src="myServlet"/>

I've tried also, but in this case, it looks the ressource on the file system
(FileNotFoundException) ...

Laurent




---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Using a servlet as source for a generator

Posted by Guido Casper <gc...@s-und-n.de>.
> >I think it doesn't fit your servlet mapping.
> >Try
> ><map:generate uri="myServlet"/>
> 
> It doesn't work ... It couldn't "setup pipeline" with an
> "org.apache.cocoon.ProcessingException: Could not setup pipeline.:
> org.xml.sax.SAXException: Invalid System ID"

Sorry, it should be
<map:generate src="myServlet"/>

Guido

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: Using a servlet as source for a generator

Posted by Laurent Comte <la...@oodrive.fr>.

>I think it doesn't fit your servlet mapping.
>Try
><map:generate uri="myServlet"/>

It doesn't work ... It couldn't "setup pipeline" with an
"org.apache.cocoon.ProcessingException: Could not setup pipeline.:
org.xml.sax.SAXException: Invalid System ID"


>If this doesn't work either and you are using 2.1 you can also try
><map:generate
>uri="http://{request:serverName}:{request:serverPort}{request:contextPath}/
m
>yServlet"/>

Doesn't work with 2.0.4 ...


>I believe this also works for 2.0.5-dev

Did not tried yet.


Regards.


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Using a servlet as source for a generator

Posted by Guido Casper <gc...@s-und-n.de>.
> Of course, when i type the same url in my browser, it works
> ("http://localhost:8080/myApp/myServlet"). Cocoon and my servlet are in
the
> same webApp (and same Tomcat's Context).
>
> Does it really work for you ?
>
> sitemap.xmap is standard and i had just added this :
>
>   <map:pipelines>
>     <map:pipeline match="myApp/test">
>       <map:generate uri="/myApp/myServlet"/><!-- return XML -->
>       <map:serialize />
>     </map:pipeline>
>   </map:pipelines>
>

I think it doesn't fit your servlet mapping.
Try
<map:generate uri="myServlet"/>


If this doesn't work either and you are using 2.1 you can also try
<map:generate
uri="http://{request:serverName}:{request:serverPort}{request:contextPath}/m
yServlet"/>


I believe this also works for 2.0.5-dev

HTH
Guido



---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>