[opencms-dev] ANSWER: NoClassDefFoundError

Jeroen Habets Jeroen.Habets at framfab.nl
Fri Jan 5 11:57:55 CET 2001


After adding the directory where my own classes subside to the
repositories list in the zone.properties file, everything worked fine.

This information is not present in any manual! Also the
config/install.txt does not mention this.

Consise:
Add to your zone.properties file:

    repositories=(your servlet path)

to be able to use classes from there.

Jeroen
P.S. I had expected an answer to this question, from either this list or
the OpenCMS developers to which I also sent two messages.
P.P.S. Adjusting your CLASSPATH environment variable or
wrapper.classpath does not help, since OpenCMS uses a different
classloader.

Jeroen Habets wrote:

> Hi,
>
> I want to add functionality to OpenCMS 4.1.47 and wrote the class
> Test:
>
> package testpak;
>
> import com.opencms.template.*;
> import com.opencms.file.*;
> import com.opencms.core.*;
>
> public class Test extends CmsXmlTemplate {
>
>   public Object getHello(CmsObject cms,
>     String tagcontent,
>     A_CmsXmlContent doc,
>     Object userObject) throws CmsException {
>     return "Hello from java!";
>   }
> }
>
> with the class file saved as xxx/servlets/testpak/Test.class
>
> and template file:
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <page>
>     <CLASS>com.opencms.template.CmsXmlTemplate</CLASS>
>     <MASTERTEMPLATE>/content/templates/empty</MASTERTEMPLATE>
>     <ELEMENTDEF name="body">
>         <CLASS>testpak.Test</CLASS>
>         <TEMPLATE>/content/bodys/test.html</TEMPLATE>
>     </ELEMENTDEF>
> </page>
>
> I get the error:
>
> java.lang.NoClassDefFoundError: com/opencms/template/CmsXmlTemplate
>         at
> org.apache.jserv.JServConnection.processRequest(JServConnection.java:323)
>
>         at
> org.apache.jserv.JServConnection.run(JServConnection.java:188)
>         at java.lang.Thread.run(Thread.java:498)
>
> Help me, please!
> Jeroen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20010105/abac8f74/attachment.htm>


More information about the opencms-dev mailing list