You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Craig Altenburg <cr...@blueridge.com> on 2000/01/19 20:08:21 UTC

Cocoon 1.6 with Jakarta Tomcat

I am having a problem trying to get Cocoon to run with the Jakarta Tomcat
servlet engine.

My intent was to set up the configuration so that any request for a ".xml"
file would be passed to cocoon.  Now, if I request a URL like
"http://penguin.blueridge.com/hello.xml", Cocoon does get run but cannot
seem to find the file I requested (it IS there).  I get the message:

java.io.FileNotFoundException: /home/httpd/html/org.apache.cocoon.Cocoon (No
such file or directory)
   at java.io.FileInputStream.open(Native Method)
   at java.io.FileInputStream.<init>(FileInputStream.java, Compiled Code)
   at java.io.FileInputStream.<init>(FileInputStream.java, Compiled Code)
   at 
org.apache.cocoon.producer.ProducerFromFile.getStream(ProducerFromFile.java,
Compiled Code)
   at 
org.apache.cocoon.producer.AbstractProducer.getDocument(AbstractProducer.jav
a, Compiled Code)
   at org.apache.cocoon.Engine.handle(Engine.java, Compiled Code)
   at org.apache.cocoon.Cocoon.service(Cocoon.java, Compiled Code)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled
Code)
   at 
org.apache.tomcat.core.ServiceInvocationHandler.method(ServletWrapper.java,
Compiled Code)
   at 
org.apache.tomcat.core.ServletWrapper.handleInvocation(ServletWrapper.java,
Compiled Code)
   at 
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java,
Compiled Code)
   at org.apache.tomcat.core.Context.handleRequest(Context.java, Compiled
Code)
   at org.apache.tomcat.core.ContextManager.service(ContextManager.java,
Compiled Code)
   at 
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
(Ajp12ConnectionHandler.java, Compiled Code)
   at org.apache.tomcat.service.TcpConnectionThread.run(TcpEndpoint.java,
Compiled Code)
   at java.lang.Thread.run(Thread.java, Compiled Code)


Note that the file name that java.io.FileInputStream is trying to open seem
to be bogus.


As a test I also installed a JAR containing the SnoopServlet in the same way
that I installed Cocoon; but using ".snp" as the url-pattern.  This works
fine.  Requesting "http://penguin.blueridge.com/hello.snp" produces the
following:

.
.
.
Request URI: /hello.snp
Context Path: 
Servlet Path: /hello.snp
Path Info: null
Path Trans: null
Query String: null
.
.
.


The following is what I did to install cocoon (and the SnoopServlet) to the
best of my memory:


1) Modified /opt/tomcat/etc/tomcat.conf to send URLs that end in ".xml" and
".snp" to handler jserv-servlet.

AddType text/xml .xml
AddHandler jserv-servlet .xml

AddType test/snp .snp
AddHandler jserv-servlet .snp

2) Modified /opt/tomcat/tomcat.sh to add Cocoon and SnoopServlet to the
CLASSPATH.

CLASSPATH=${CLASSPATH}:/opt/cocoon-1.6/bin/Cocoon.jar
CLASSPATH=${CLASSPATH}:/opt/fop/fop_bin_0_12_0.jar
CLASSPATH=${CLASSPATH}:/opt/xalan_0_19_2/xalan.jar
CLASSPATH=${CLASSPATH}:/opt/xerces-1_0_1/xerces.jar

CLASSPATH=${CLASSPATH}:/home/httpd/SnoopServlet.jar

3) Modifed  /opt/tomcat/server.xml to make /home/httpd/html the base of the
default context.

<Context path="/" docBase="/home/httpd/html"
defaultSessionTimeOut="30" isWARExpanded="true"
isWARValidated="false" isInvokerEnabled="true"
isWorkDirPersistent="false"/>

4) Added /home/httpd/html/WEB-INF/web.xml to configure the default context.

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
  PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
  "http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">

<web-app>
  <servlet>
      <servlet-name>
          cocoon
      </servlet-name>
      <servlet-class>
          org.apache.cocoon.Cocoon
      </servlet-class>
      <init-param>
          <param-name>
              properties
          </param-name>
          <param-value>
              /opt/cocoon-1.6/conf/cocoon.properties
          </param-value>
      </init-param>
      <load-on-startup>
          3
      </load-on-startup>
  </servlet>

  <servlet>
      <servlet-name>
          snoop
      </servlet-name>
      <servlet-class>
          SnoopServlet
      </servlet-class>
      <init-param>
          <param-name>
              properties
          </param-name>
          <param-value>
              /opt/cocoon-1.6/conf/cocoon.properties <!-- just to keep
things the same -->
          </param-value>
      </init-param>
      <load-on-startup>
          3
      </load-on-startup>
  </servlet>

  <servlet-mapping>
      <servlet-name>
          cocoon
      </servlet-name>
      <url-pattern>
          *.xml
      </url-pattern>
  </servlet-mapping>

  <servlet-mapping>
      <servlet-name>
          snoop
      </servlet-name>
      <url-pattern>
          *.snp
      </url-pattern>
  </servlet-mapping>
</web-app>







-- 
Craig Altenburg