You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Sven Kuenzler <sv...@gmx.net> on 2000/05/06 15:05:55 UTC

Cocoon with Tomcat, part (n+1) ...

Hi,

I have a problem using the new 1.7.3 with Cocon (again).

I copied the lib/*.jar from the new distribution to the tomcat lib
directory.
Then I altered my web.xml to point to the new 1.7.3 cocoon.properties. I
edited this file according to my environment (I set the path to the
repository).

When trying to access a xml file, however, I got an error about the
XHTMLFormatter which could not be accessed. Well, I don't need XHTML
anyway, so I commented it out.

Now it worked. Well, that was too easy. And indeed, I forgot a small
little thing. I forgot to replace the cocoon.jar!

Now after replacing cocoon-1.7.3-dev with the release version, I get the
following exception
---
Publishing Engine could not be initialized.

       java.lang.NullPointerException
               at org.apache.cocoon.Cocoon.init(Cocoon.java:135)
               at
org.apache.tomcat.core.ServletWrapper.initServlet(ServletWrapper.java:315)
               at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:445)
               at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
               at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:160)
               at
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338)
               at java.lang.Thread.run(Thread.java:475)
---

Please note that the new configuration and the lib jars worked with the
old -dev-version (probably a 2-weeks-old cvs snapshot). So, what might
be wrong here?

	Sven....

Re: Cocoon with Tomcat, part (n+1) ...

Posted by Giacomo Pati <Gi...@pwr.ch>.
Stefano Mazzocchi wrote:
> 
> Question for those tomcat users out-there (I know, I know, I should
> leave my sinking jserv boat), what would be the _easiest_ way to do a
> Cocoon distribution?
> 
> The use of getResource() was added to allow the configurations to be
> loaded without requiring any change to both web.xml and
> cocoon.properties
> 
> So, should we ship with
> 
>  /conf/cocoon.properties
>  /WEB-INF/web.xml

I would suggest to have 

  /WEB-INF/conf/cocoon.properties
  /WEB-INF/web.xml

so you can use the same protetion rule for the properties files as with
the WEB-INF directory. 

I suggest the separate conf directory in the WEB-INF directory to
collect all conf files there in case you need to run other servlets
(like XMLForm or others) in the same context which needs sort of
configuration files. 

> 
> then in web.xml
> 
>  <init-param>
>   <param-name>properties</param-name>
>   <param-value>conf/cocoon.properties</param-value>

   <param-value>WEB-INF/conf/cocoon.properties</param-value>

>  </init-param>
> 
> ???
> 
> What about WARs?

Maybe the build.xml can take care of building a WAR file. Then
everything you need is to put that WAR file into the webapps directory.
Maybe we should also change the path to the repository directory to the
WEB-INF diretory. This way the protection of the reportisory directory
is in place as with the cocoon.properties file. 

I you want, I can take care of adding a war target to the build.xml

BTW: Did anybody get XSP running without having any components in the
classpath of Tomcat? I've seen a entry in the FAQ that mentioned that
Tomcat 3.1 should be able to run XSP out of the servlet context only.
But the installation docs does not seems to be in sync with that.

Giacomo

-- 
PWR Organisation & Entwicklung            Tel:   +41 (0)1 856 2202
Giacomo Pati, CTO/CEO                     Fax:   +41 (0)1 856 2201
Hintereichenstrasse 7                     Mailto:Giacomo.Pati@pwr.ch
CH-8166 Niederweningen                    Web:   http://www.pwr.ch

Re: Cocoon with Tomcat, part (n+1) ...

Posted by Stefano Mazzocchi <st...@apache.org>.
Giacomo Pati wrote:
> 
> I had to make the path to the cocoon.properties file relative to the
> context (webapps/cocoon). So my web.xml look like
> 
> ...
>  <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>WEB-INF/conf/cocoon.properties</param-value>
>   </init-param>
>  </servlet>

Question for those tomcat users out-there (I know, I know, I should
leave my sinking jserv boat), what would be the _easiest_ way to do a
Cocoon distribution?

The use of getResource() was added to allow the configurations to be
loaded without requiring any change to both web.xml and
cocoon.properties

So, should we ship with 

 /conf/cocoon.properties
 /WEB-INF/web.xml

then in web.xml
 
 <init-param>
  <param-name>properties</param-name>
  <param-value>conf/cocoon.properties</param-value>
 </init-param>

???

What about WARs?

I'm wide open to suggestions on easying installation on tomcat.

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<st...@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------



Re: Cocoon with Tomcat, part (n+1) ...

Posted by Giacomo Pati <Gi...@pwr.ch>.
I had to make the path to the cocoon.properties file relative to the
context (webapps/cocoon). So my web.xml look like

...
 <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>WEB-INF/conf/cocoon.properties</param-value> 
  </init-param>
 </servlet>
...

Giacomo
 
Sven Kuenzler wrote:
> 
> Hi,
> 
> I have a problem using the new 1.7.3 with Cocon (again).
> 
> I copied the lib/*.jar from the new distribution to the tomcat lib
> directory.
> Then I altered my web.xml to point to the new 1.7.3 cocoon.properties. I
> edited this file according to my environment (I set the path to the
> repository).
> 
> When trying to access a xml file, however, I got an error about the
> XHTMLFormatter which could not be accessed. Well, I don't need XHTML
> anyway, so I commented it out.
> 
> Now it worked. Well, that was too easy. And indeed, I forgot a small
> little thing. I forgot to replace the cocoon.jar!
> 
> Now after replacing cocoon-1.7.3-dev with the release version, I get the
> following exception
> ---
> Publishing Engine could not be initialized.
> 
>        java.lang.NullPointerException
>                at org.apache.cocoon.Cocoon.init(Cocoon.java:135)
>                at
> org.apache.tomcat.core.ServletWrapper.initServlet(ServletWrapper.java:315)
>                at
> org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:445)
>                at
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
>                at
> org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:160)
>                at
> org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338)
>                at java.lang.Thread.run(Thread.java:475)
> ---
> 
> Please note that the new configuration and the lib jars worked with the
> old -dev-version (probably a 2-weeks-old cvs snapshot). So, what might
> be wrong here?
> 
>         Sven....

-- 
PWR Organisation & Entwicklung            Tel:   +41 (0)1 856 2202
Giacomo Pati, CTO/CEO                     Fax:   +41 (0)1 856 2201
Hintereichenstrasse 7                     Mailto:Giacomo.Pati@pwr.ch
CH-8166 Niederweningen                    Web:   http://www.pwr.ch

Re: Cocoon with Tomcat, part (n+1) ...

Posted by Sven Kuenzler <sv...@gmx.net>.
> where cocoon.properties is located as follows:
> /path/to/webapps/cocoon/WEB-INF/cocoon.properties

Strange. I use a similar web.xml, but my Tomcat looks for the file in
the context root. 

Thus, my solution is
<param-value>WEB-INF/cocoon.properties</param-value> in the right place.

How did you setup your cocoon-context in server.xml? My definition looks
like:

<Context path="/viva" docBase="/home/svenk/uni/viva" debug="10"
reloadable="true" > </Context>

Nevertheless, it works at last. Hooray ;-)

	Sven....


Re: Cocoon with Tomcat, part (n+1) ...

Posted by Mark Washeim <es...@canuck.com>.
Oh brother. Ok, finally, i followed my nose and put the proper Cocoon.java
back in place and modified the my tomcat setup such that:

/path/to/webapps/cocoon/WEB-INF/web.xml

looked like

<web-app>

   <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>
                cocoon.properties
            </param-value>
        </init-param>
    </servlet>
        <servlet-mapping>
        <servlet-name>
            org.apache.cocoon.Cocoon
        </servlet-name>
        <url-pattern>
            *.xml
        </url-pattern>
    </servlet-mapping>
</web-app>

where cocoon.properties is located as follows:
/path/to/webapps/cocoon/WEB-INF/cocoon.properties

Works.

Mark

on 6/5/00 7:38 pm, Mark Washeim at esalon@canuck.com wrote:

> This is further to my last mail:
> 
> I did a simple test to see if the resource method for obtaining the conf
> file was a problem. I simply edited Cocoon.java and hardcoded the URL:
> 
> //URL resource = config.getServletContext().getResource(confsName);
> URL resource = new URL ("http://localhost/cocoon/cocoon.properties");
> 
> And that, worked. To reiterate, my tomcat setup:
> 
> SERVER INFO: Tomcat Web Server/3.1 Beta (JSP 1.1; Servlet 2.2; Java 1.1.8;
> Mac OS 9.4 PowerPC; java.vendor=Apple Computer, Inc.)
> 
> 


-- 
Mark (Poetaster) Washeim

'On the linen wrappings of certain mummified remains
found near the Etrurian coast are invaluable writings
that await translation.

Quem colorem habet sapientia?'

Evan S. Connell

 



Re: Cocoon with Tomcat, part (n+1) ...

Posted by Mark Washeim <es...@canuck.com>.
This is further to my last mail:

I did a simple test to see if the resource method for obtaining the conf
file was a problem. I simply edited Cocoon.java and hardcoded the URL:

   //URL resource = config.getServletContext().getResource(confsName);
   URL resource = new URL ("http://localhost/cocoon/cocoon.properties");

And that, worked. To reiterate, my tomcat setup:

SERVER INFO: Tomcat Web Server/3.1 Beta (JSP 1.1; Servlet 2.2; Java 1.1.8;
Mac OS 9.4 PowerPC; java.vendor=Apple Computer, Inc.)


on 6/5/00 6:24 pm, Mark Washeim at esalon@canuck.com wrote:

> on 6/5/00 3:05 pm, Sven Kuenzler at svenk@gmx.net wrote:
> 
> SNIP
> 
> Looks like the init fails trying to find the conf file. I've downloaded cocoon
> 1.7.3 today and I'm having a similar problem after moving from 1.7.2.
> 
> Although the path is correct in the web.xml file, cocoon is throwing:
> 
> java.lang.NullPointerException
> at org.apache.cocoon.Cocoon.init(Cocoon.java:135)
> 
> When I examine Tomcat's logs:
> java.io.IOException: OSErr: -50
> at java.io.File.getCanonicalPath(File.java)
> at org.apache.tomcat.core.Context.getResource(Context.java:668)
> at 
> org.apache.tomcat.core.ServletContextFacade.getResource(ServletContextFacade.j
> ava:149)
> at org.apache.cocoon.Cocoon.init(Cocoon.java:122)
> 
> However, Turbine still finds and loads it's confs. I don't get it.
> 
> Incidently, 
> SERVER INFO: Tomcat Web Server/3.1 Beta (JSP 1.1; Servlet 2.2; Java 1.1.8; Mac
> OS 9.4 PowerPC; java.vendor=Apple Computer, Inc.)
> 
> Perhaps a Servlet 2.2 problem in my case?
> 
> Usually I work on a Unix setup (Apache, Jserv 1.x, etc) so I'm not entirely
> certain it's not related to my setup of tomcat???
> 
> Mark
> 
>> 
>> Now after replacing cocoon-1.7.3-dev with the release version, I get the
>> following exception
>> ---
>> Publishing Engine could not be initialized.
>> 
>> java.lang.NullPointerException
>> at org.apache.cocoon.Cocoon.init(Cocoon.java:135)
>> at
>> org.apache.tomcat.core.ServletWrapper.initServlet(ServletWrapper.java:315)
>> at
>> org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:445)
>> at
>> org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
>> at
>> 
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
o>> n
>> nectionHandler.java:160)
>> at
>> org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338)
>> at java.lang.Thread.run(Thread.java:475)
>> ---
>> 
>> Please note that the new configuration and the lib jars worked with the
>> old -dev-version (probably a 2-weeks-old cvs snapshot). So, what might
>> be wrong here?
>> 
>> Sven....
>> 

-- 
Mark (Poetaster) Washeim

'On the linen wrappings of certain mummified remains
found near the Etrurian coast are invaluable writings
that await translation.

Quem colorem habet sapientia?'

Evan S. Connell

 



Re: Cocoon with Tomcat, part (n+1) ...

Posted by Mark Washeim <es...@canuck.com>.
on 6/5/00 3:05 pm, Sven Kuenzler at svenk@gmx.net wrote:

SNIP

Looks like the init fails trying to find the conf file. I've downloaded
cocoon 1.7.3 today and I'm having a similar problem after moving from 1.7.2.

Although the path is correct in the web.xml file, cocoon is throwing:

java.lang.NullPointerException
    at org.apache.cocoon.Cocoon.init(Cocoon.java:135)

When I examine Tomcat's logs:
java.io.IOException: OSErr: -50
    at java.io.File.getCanonicalPath(File.java)
    at org.apache.tomcat.core.Context.getResource(Context.java:668)
    at 
org.apache.tomcat.core.ServletContextFacade.getResource(ServletContextFacade
.java:149)
    at org.apache.cocoon.Cocoon.init(Cocoon.java:122)

However, Turbine still finds and loads it's confs. I don't get it.

Incidently, 
SERVER INFO: Tomcat Web Server/3.1 Beta (JSP 1.1; Servlet 2.2; Java 1.1.8;
Mac OS 9.4 PowerPC; java.vendor=Apple Computer, Inc.)

Perhaps a Servlet 2.2 problem in my case?

Usually I work on a Unix setup (Apache, Jserv 1.x, etc) so I'm not entirely
certain it's not related to my setup of tomcat???

Mark

> 
> Now after replacing cocoon-1.7.3-dev with the release version, I get the
> following exception
> ---
> Publishing Engine could not be initialized.
> 
> java.lang.NullPointerException
> at org.apache.cocoon.Cocoon.init(Cocoon.java:135)
> at
> org.apache.tomcat.core.ServletWrapper.initServlet(ServletWrapper.java:315)
> at
> org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:445)
> at
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
> at
> org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpCon
> nectionHandler.java:160)
> at
> org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338)
> at java.lang.Thread.run(Thread.java:475)
> ---
> 
> Please note that the new configuration and the lib jars worked with the
> old -dev-version (probably a 2-weeks-old cvs snapshot). So, what might
> be wrong here?
> 
> Sven....
> 

-- 
Mark (Poetaster) Washeim

'On the linen wrappings of certain mummified remains
found near the Etrurian coast are invaluable writings
that await translation.

Quem colorem habet sapientia?'

Evan S. Connell