You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xml.apache.org by Sascha MŸller <sa...@fh-koeln.de> on 2000/01/17 17:10:20 UTC

Simple help on Cocoon DCP-classes

Hello,
i am trying around with Cocoon1.5 + JServ on Linux and on WinNT.
Where  do i have to put the classpath-information for my self-written
DCP-Class. In the cocoon.properties (wrapper.classpath=) or in the
zone.properties or somewhere else?
I think it is the cocoon.properties. But when i insert my class, i got a
NoClassDefFoundError: org/apache/cocoon/dcp/ServletDCPProcessor 
in jserv.log

Sascha

Re: Simple help on Cocoon DCP-classes

Posted by Sascha MŸller <sa...@fh-koeln.de>.

Ricardo Rocha schrieb:
> 
> > Sorry, i am confuesd. It was i the jserv.properties (not cocoon) and
> > then the NoClassDefFoundError comes up.
> > If it is not in the classpath i get a different Error (DCP Error:..could
> > not find class; it is part of the response page).
> > With CodeWarrior i build a DCPTest.jar file from
> > DCPTest.java
> 
> A common reason for NoClassDefFoundError in DCP is
> when your DCP class itself _is_ accessible through the
> classpath but another class it uses internally is not.
I see.
> 
> You should check your code and verify what classes are
> used by your DCP class (directly or indirectly) such that
> they're accessible through the classpath when your first
> compile the DCP class but are not accessible to Jserv
> because they're not included in the proper wrapper.classpath.
> entry.

In my class i just use the same classes and methods as in the
org.apache.cocoon.example.DCPExample
The example works fine.

Sorry i have no idea.

Sascha

RE: Simple help on Cocoon DCP-classes

Posted by Ricardo Rocha <ri...@apache.org>.
> Sorry, i am confuesd. It was i the jserv.properties (not cocoon) and
> then the NoClassDefFoundError comes up.
> If it is not in the classpath i get a different Error (DCP Error:..could
> not find class; it is part of the response page).
> With CodeWarrior i build a DCPTest.jar file from
> DCPTest.java

A common reason for NoClassDefFoundError in DCP is
when your DCP class itself _is_ accessible through the
classpath but another class it uses internally is not.

You should check your code and verify what classes are
used by your DCP class (directly or indirectly) such that
they're accessible through the classpath when your first
compile the DCP class but are not accessible to Jserv
because they're not included in the proper wrapper.classpath.
entry.

Re: Simple help on Cocoon DCP-classes

Posted by Sascha MŸller <sa...@fh-koeln.de>.
Ricardo Rocha wrote:
> 
> Hello,
> > i am trying around with Cocoon1.5 + JServ on Linux and on WinNT.
> > Where  do i have to put the classpath-information for my self-written
> > DCP-Class. In the cocoon.properties (wrapper.classpath=) or in the
> > zone.properties or somewhere else?
> > I think it is the cocoon.properties. But when i insert my class, i got a
> > NoClassDefFoundError: org/apache/cocoon/dcp/ServletDCPProcessor
> > in jserv.log
> 
> It should be in the jserv.properties' wrapper.classpath section
> (note it's _not_ cocoon.properties nor zone.properties).

Sorry, i am confuesd. It was i the jserv.properties (not cocoon) and
then the NoClassDefFoundError comes up.
If it is not in the classpath i get a different Error (DCP Error:..could
not find class; it is part of the response page).
With CodeWarrior i build a DCPTest.jar file from
DCPTest.java

this is my class: (i saw it working one time on my machine at home, but
now it does not!)

package de.fhkoeln.zam.example;
import java.util.*;
import java.text.*;
import org.w3c.dom.*;
import javax.servlet.http.*;
import org.apache.cocoon.dcp.*;


public class DCPTest extends ServletDCPProcessor {

  public String getDocTyp() 
  {
    Enumeration e = this.request.getParameterNames();

    if (!e.hasMoreElements()) { // No parameters given, remove node from
document
      return null;
    }
    int count;
    for (count = 0; e.hasMoreElements(); count++) {
      String name = (String) e.nextElement();
      String[] values = this.request.getParameterValues(name);
                if (name.equals("doctyp"))
                {
                return values[0];
                }
        }
        return null;
  }

    public String getSystemDate(Dictionary parameters) {
    Date now = new Date();
    String formattedDate = now.toString();
    String format = (String) parameters.get("format");

    if (format != null) {
      try {
        SimpleDateFormat dateFormat = new SimpleDateFormat(format);
        formattedDate = dateFormat.format(now);
      } catch (Exception e) { } // Bad format, ignore and return default
    }

    return formattedDate;
  }
}

Any Idea why there comes up a ClassDefFoundError

> 
> This kind of question probably belongs to the Cocoon mailing
> list, btw :-)
> 
> Regards,
> 
> Ricardo

RE: Simple help on Cocoon DCP-classes

Posted by Ricardo Rocha <ri...@apache.org>.
Hello,
> i am trying around with Cocoon1.5 + JServ on Linux and on WinNT.
> Where  do i have to put the classpath-information for my self-written
> DCP-Class. In the cocoon.properties (wrapper.classpath=) or in the
> zone.properties or somewhere else?
> I think it is the cocoon.properties. But when i insert my class, i got a
> NoClassDefFoundError: org/apache/cocoon/dcp/ServletDCPProcessor 
> in jserv.log

It should be in the jserv.properties' wrapper.classpath section
(note it's _not_ cocoon.properties nor zone.properties).

This kind of question probably belongs to the Cocoon mailing
list, btw :-)

Regards,

Ricardo