• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem in Tomcat

 
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am setting up cocoon on Tomcat server.I followed the instructions given in the java and XMl book in chapter 9 in setting up the web.xml file of Tomcat

I am unable to run the cocoom.xml file.what is the equivalent of the bold setting below on windows environment.
I should give the full path like d:\jakarta-tomcat/conf/cocoon.properties or should i give it as /jakarta-tomcat/conf/cocoon.properties



<servlet>
<servlet-name>
org.apache.cocoon.Cocoon
</servlet-name>
<servlet-class>
org.apache.cocoon.Cocoon
</servlet-class>
<init-param>
<param-name>
properties
</param-name>
<param-value>
/usr/lib/jakarta-tomcat/conf/cocoon.properties
</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>
org.apache.cocoon.Cocoon
</servlet-name>
<url-pattern>
*.xml
</url-pattern>
</servlet-mapping>


Pl reply
 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what is the equivalent of the bold setting below on windows environment.
not sure what you mean by this......
Could you pl. elaborate on this pl.
I successfuly installed Cocoon with tomcat in the past.
I also, installed tomcat on Apache using the ModJK stuff.
Let us know what your are trying to do. Unfortunately,
I don't have the book you mentioned to follow you.....
regds.
- satya
 
Mary Cole
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Satya,

/usr/lib/jakarta-tomcat/conf/cocoon.properties

This is the one.I guess this is on UNIX environment.Whats the equivalent on win env
Should I give the full path like d:\jakarta-tomcat/conf/cocoon.properties or should i give it as /jakarta-tomcat/conf/cocoon.properties

Hope you got my point

 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
....in setting up the web.xml file of Tomcat
are you trying to set this in the web.xml file?
I don't understand where you are trying to do this?
I mean which web.xml file under tomcat?
Is it the once in conf folder or what?
sorry, i am a little slow......
- satya
 
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Satya, why don't you give the link to your famous "How to Install Tomcat in 30 minutes" post ?? I think you have written it very well.
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ajith:
I thought, Mary was having problems with Cocoon and not Tomcat.
Also, I need to update the Tomcat Instructions, since the version
has since changed. I would be glad to do it if thats' what
Mary is looking for....

- satya
 
Mary Cole
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sathya,
Am putting the wordings from Oreilly book itself.Hope it will help you.

=================================================================
Configuring the Servlet Engine
Once you have built Cocoon, you need to configure your servlet engine to use Cocoon and tell it which requests Cocoon should handle. We look at setting up Cocoon to work with the Jakarta Tomcat servlet engine here;[3] as this is the reference implementation for the Java Servlet API 2.2, you should be able to mimic these steps for your own servlet engine if you are not using the Tomcat implementation.
The Cocoon framework is built to operate at an engine level rather than as another servlet in your engine. Therefore, we need to add Cocoon and its dependencies to the core servlet engine class path rather than in a particular servlet zone or context. Copy the Cocoon jar file and the Xerces, Xalan, and FOP jar files into the Tomcat lib/ subdirectory, off of the main Tomcat installation directory. You then need to add these libraries to the engine class path; in Tomcat, this is accomplished through editing the Tomcat initialization script. For Windows platforms, this is <TOMCAT_HOME>/bin/tomcat.bat ; for Unix platforms, <TOMCAT_HOME>/bin/tomcat.sh. In these files, you will see the lines that set the class path used by Tomcat when starting up. You should add the Cocoon distribution and its dependencies before these other entries in the configuration file. On Windows, this will look like:
set CLASSPATH=.
set CLASSPATH=%TOMCAT_HOME%\classes

rem Cocoon classes and libraries
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\xerces_1_0_3.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\xalan_1_0_0.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\fop_0_12_1.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\cocoon.jar

set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\webserver.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\jasper.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\xml.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\servlet.jar
set CLASSPATH=%CLASSPATH%;%JAVA_HOME%\lib\tools.jar
On Unix platforms, the modified file should look like this:
CLASSPATH=.

# Cocoon classes and libraries
CLASSPATH=${CLASSPATH}:${TOMCAT_HOME}/lib/xerces_1_0_3.jar
CLASSPATH=${CLASSPATH}:${TOMCAT_HOME}/lib/xalan_0_20_0.jar
CLASSPATH=${CLASSPATH}:${TOMCAT_HOME}/lib/fop_0_12_1.jar
CLASSPATH=${CLASSPATH}:${TOMCAT_HOME}/lib/cocoon.jar

for i in ${TOMCAT_HOME}/lib/* ; do
CLASSPATH=${CLASSPATH}:$i
done

CLASSPATH=${CLASSPATH}:${JAVA_HOME}/lib/tools.jar
==============================================================

Everything is working fine till here.
==============================================================

It is important to ensure that the Cocoon classes precede the rest of the Tomcat classes, particularly xml.jar. While Xerces, Xalan, and Cocoon all use SAX 2 and DOM Level 2 classes and interfaces, the Sun Project X parser contained in xml.jar does not yet have SAX 2 and DOM Level 2 support; if this class and its SAX and DOM versions are found first, the Cocoon framework will error out.
With these libraries added, all that is left is to specify to Cocoon the location of its properties file (we will look at what this file does a little later). Copy the cocoon.properties file from the Cocoon root directory into <TOMCAT_HOME>/conf/. In this same directory, you will see web.xml, which configures the properties for engine-wide servlets. In this file are properties and mappings for various engine-level servlets; we need to add configuration for Cocoon here. Insert the following entries into the engine configuration file:
<servlet>
<servlet-name>
org.apache.cocoon.Cocoon
</servlet-name>
<servlet-class>
org.apache.cocoon.Cocoon
</servlet-class>
<init-param>
<param-name>
properties
</param-name>
<param-value>
/usr/lib/jakarta-tomcat/conf/cocoon.properties
</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>
org.apache.cocoon.Cocoon
</servlet-name>
<url-pattern>
*.xml
</url-pattern>
</servlet-mapping>
The location within the file does not matter, as long as you ensure that element nestings are not disrupted; in other words, the resulting file must remain well-formed XML. You will also need to insert the correct path to the cocoon.properties file for the value of the properties parameter. This tells the engine to pass this parameter to the main Cocoon servlet, enabling it to configure itself and the rest of the Cocoon framework. The servlet-mapping then instructs the engine to direct all URI requests that end in .xml to the Cocoon framework. With these changes made, you can start (or restart) Tomcat; ensure that no errors occur and the Cocoon install can be tested.
If everything has been configured correctly, you should be able to access http://<hostname>:<port>/Cocoon.xml in your web browser. If no errors occur, the HTML output should look like that shown in Figure 9-1.
=================================================================
So when I am accessing http://<hostname>:<port>/Cocoon.xml , its not working .Its giving 404 error.I think am wrong in setting the below thing in web.xml file.

<param-value>
/usr/lib/jakarta-tomcat/conf/cocoon.properties
</param-value>

Hope you got it now.Satya pl reply fast as I have a tight schedule.If you could give me your E-mail id that would be great too.
Thanx
 
Ajith Kallambella
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
PS : Mary I deleted two of your duplicate messages. Maybe you clicked on the submit button with toomuch enthusiasm
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mary:
From what I can make out of this, I would go with the
FULL PATH NAME to the cocoon.properties file.
My email Id is satya@javaranch.com. You can send me an
email by clicking on the mail icon on any one of my posts.
Feel free to send an email.
Just for the record, this is a little different from what
I did. This approach is trying to deploy the cocoon as an
engine-level servlet container(not sure if its the
right word). Earlier I used cocoon as a contex level
servlet container. Its not very different. To use cocoon at
an engine-level you are modifying the web.xml
file. To use cocoon as a context-level container we
modify the servlet.xml file and add a new context.
Hope this helps. Guess what, I will also give a shot in a
little while and update if I find anything new.
Sorry for the delay in replying!
regds.
- satya
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mary:
I seems to have conflicting opinions here:

  • the reason I said FULL PATH is based on the param value
    given in the book /usr/..... This always is a FULL PATH,
    ofcourse on UNIX. Thats the reason I think its full path.
  • On further investigation, when I used cocoon as context
    lever servlet-container
    , I did copy the web.xml and the cocoon.properties file from cocoon dir's to the web-inf dir
    under the cocoon context. Then I had to modify the same
    param-value as this one. To my surprise, it is mentioned in
    the documentation that this SHOULD be a relative path and not
    a FULL PATH. However, this is a different approach so I would
    first try the FULL PATH.

  • Will update with other info as I find it.
    regds.
    - satya
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Well, I have been trying both these approaches but nothing
seems to work. Also, the textbook seems to describe an older
version of cocoon so I am not sure if it still works with the
newer version that I have.
Anyways, if I get it to work I will let you know, else if
you want to try it as a context-based servlet container,
let me know I can explain. Not sure if I am missing something
else.....
regds.
- satya

 
Mary Cole
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Satya,
Thanx for your efforts.
If you are successful pl send me the web.xml file.
Also if you don't mind can you explain me whats those fundu words like engine level and context level a bit more.
All the best

 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, as I understand........
context level: making cocoon like a new web application
and deploying it in tomcat like any other web application.
Using a context tag in the conf/server.xml
file of Tomcat. This is what I did and this is what is
described in the latest cocoon release docs.
engine level: this I am a little shaky .....but as I read
from your earlier post I understood that this is another way
to get cocoon to work with tomcat. Instead of adding cocoon
as an application context in the server.xml, I
understood that we could deploy it as its own engine something
similar to a servlet engine and jsp engine. This is what the
author was explaining to do in the steps you gave earlier.
Again, since I haven't read the book on this, I am a little
shaky. I hope I get some time during the wkend so I can sneek
into the nearest Borders' book store and read this a little
more.
Thats what I understood, also I don't think I have your email
to email you the web.xml in case it works. If I don't hear
from you, I will post it here.
Sorry I couldn't help. Good Luck.
- satya
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mary,
The problem here is it is trying to find physical location of /Cocoon.xml under jakarta-tomcat-3.2.3/webapps/ROOT so you need to place Cocoon.xml under the ROOT directory.then it will work.
had a same problem
thanks
abhijeet
=================================================================
Configuring the Servlet Engine
Once you have built Cocoon, you need to configure your servlet engine to use Cocoon and tell it which requests Cocoon should handle. We look at setting up Cocoon to work with the Jakarta Tomcat servlet engine here;[3] as this is the reference implementation for the Java Servlet API 2.2, you should be able to mimic these steps for your own servlet engine if you are not using the Tomcat implementation.
The Cocoon framework is built to operate at an engine level rather than as another servlet in your engine. Therefore, we need to add Cocoon and its dependencies to the core servlet engine class path rather than in a particular servlet zone or context. Copy the Cocoon jar file and the Xerces, Xalan, and FOP jar files into the Tomcat lib/ subdirectory, off of the main Tomcat installation directory. You then need to add these libraries to the engine class path; in Tomcat, this is accomplished through editing the Tomcat initialization script. For Windows platforms, this is <TOMCAT_HOME>/bin/tomcat.bat ; for Unix platforms, <TOMCAT_HOME>/bin/tomcat.sh. In these files, you will see the lines that set the class path used by Tomcat when starting up. You should add the Cocoon distribution and its dependencies before these other entries in the configuration file. On Windows, this will look like:
set CLASSPATH=.
set CLASSPATH=%TOMCAT_HOME%\classes

rem Cocoon classes and libraries
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\xerces_1_0_3.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\xalan_1_0_0.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\fop_0_12_1.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\cocoon.jar

set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\webserver.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\jasper.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\xml.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\servlet.jar
set CLASSPATH=%CLASSPATH%;%JAVA_HOME%\lib\tools.jar
On Unix platforms, the modified file should look like this:
CLASSPATH=.

# Cocoon classes and libraries
CLASSPATH=${CLASSPATH}:${TOMCAT_HOME}/lib/xerces_1_0_3.jar
CLASSPATH=${CLASSPATH}:${TOMCAT_HOME}/lib/xalan_0_20_0.jar
CLASSPATH=${CLASSPATH}:${TOMCAT_HOME}/lib/fop_0_12_1.jar
CLASSPATH=${CLASSPATH}:${TOMCAT_HOME}/lib/cocoon.jar

for i in ${TOMCAT_HOME}/lib/* ; do
CLASSPATH=${CLASSPATH}:$i
done

CLASSPATH=${CLASSPATH}:${JAVA_HOME}/lib/tools.jar
==============================================================

Everything is working fine till here.
==============================================================

It is important to ensure that the Cocoon classes precede the rest of the Tomcat classes, particularly xml.jar. While Xerces, Xalan, and Cocoon all use SAX 2 and DOM Level 2 classes and interfaces, the Sun Project X parser contained in xml.jar does not yet have SAX 2 and DOM Level 2 support; if this class and its SAX and DOM versions are found first, the Cocoon framework will error out.
With these libraries added, all that is left is to specify to Cocoon the location of its properties file (we will look at what this file does a little later). Copy the cocoon.properties file from the Cocoon root directory into <TOMCAT_HOME>/conf/. In this same directory, you will see web.xml, which configures the properties for engine-wide servlets. In this file are properties and mappings for various engine-level servlets; we need to add configuration for Cocoon here. Insert the following entries into the engine configuration file:
<servlet>
<servlet-name>
org.apache.cocoon.Cocoon
</servlet-name>
<servlet-class>
org.apache.cocoon.Cocoon
</servlet-class>
<init-param>
<param-name>
properties
</param-name>
<param-value>
/usr/lib/jakarta-tomcat/conf/cocoon.properties
</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>
org.apache.cocoon.Cocoon
</servlet-name>
<url-pattern>
*.xml
</url-pattern>
</servlet-mapping>
The location within the file does not matter, as long as you ensure that element nestings are not disrupted; in other words, the resulting file must remain well-formed XML. You will also need to insert the correct path to the cocoon.properties file for the value of the properties parameter. This tells the engine to pass this parameter to the main Cocoon servlet, enabling it to configure itself and the rest of the Cocoon framework. The servlet-mapping then instructs the engine to direct all URI requests that end in .xml to the Cocoon framework. With these changes made, you can start (or restart) Tomcat; ensure that no errors occur and the Cocoon install can be tested.
If everything has been configured correctly, you should be able to access http://<hostname>:<port>/Cocoon.xml in your web browser. If no errors occur, the HTML output should look like that shown in Figure 9-1.
=================================================================
So when I am accessing http://<hostname>:<port>/Cocoon.xml , its not working .Its giving 404 error.I think am wrong in setting the below thing in web.xml file.

<param-value>
/usr/lib/jakarta-tomcat/conf/cocoon.properties
</param-value>

Hope you got it now.Satya pl reply fast as I have a tight schedule.If you could give me your E-mail id that would be great too.
Thanx[/B]
 
abhijeet, rai
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Has anybody found the solution for this problem.if yes pls post it on this site.
thanks
abhijeet

Originally posted by Mary, Cole:
Hi,

I am setting up cocoon on Tomcat server.I followed the instructions given in the java and XMl book in chapter 9 in setting up the web.xml file of Tomcat

I am unable to run the cocoom.xml file.what is the equivalent of the bold setting below on windows environment.
I should give the full path like d:\jakarta-tomcat/conf/cocoon.properties or should i give it as /jakarta-tomcat/conf/cocoon.properties



<servlet>
<servlet-name>
org.apache.cocoon.Cocoon
</servlet-name>
<servlet-class>
org.apache.cocoon.Cocoon
</servlet-class>
<init-param>
<param-name>
properties
</param-name>
<param-value>
/usr/lib/jakarta-tomcat/conf/cocoon.properties
</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>
org.apache.cocoon.Cocoon
</servlet-name>
<url-pattern>
*.xml
</url-pattern>
</servlet-mapping>


Pl reply


 
I have a knack for fixing things like this ... um ... sorry ... here is a consilitory tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic