commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc DEXET <Marc.De...@dsi.cnrs.fr>
Subject RE : Jelly and forehead problem
Date Mon, 22 Dec 2003 17:30:10 GMT
I had the CaseTag class

CaseTag.java
----------------------
import org.apache.commons.jelly.MissingAttributeException;
import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;
import org.xml.sax.SAXException;


public class CaseTag extends TagSupport {

    private String type;

    public CaseTag() {
    }

    public void doTag(final XMLOutput output) throws
MissingAttributeException, JellyTagException {
        if (type == null) {
            throw new MissingAttributeException("type");
        }
        System.out.println("type = " + type);
        if (!"lower".equalsIgnoreCase(type) &&
!"upper".equalsIgnoreCase(type)) {
            throw new JellyTagException("type must be 'lower' or 'upper'");
        }

        String content = getBodyText();

        try
        {
                if ("lower".equalsIgnoreCase(type)) {
                         output.write(content.toLowerCase());
                } else {
                        output.write(content.toUpperCase());
                }
        } catch(SAXException e)
        {
                e.printStackTrace();
        }

    }

    public void setType(String type) {
        this.type = type;
    }

}------------------------------------------

CaseTagLibrary.java
-------------------------------------------
package com.jelly.examples;

import org.apache.commons.jelly.TagLibrary;

public class CaseTagLibrary extends TagLibrary {

        public CaseTagLibrary() {
                registerTag("case", CaseTag.class);

        }
}
-------------------------------------------
.......................
Marc DeXeT
BEST - DSI Meudon
01.45.07.51.56
marc.dexet@dsi.cnrs.fr
.......................



-----Message d'origine-----
De : Marc DEXET 
Envoyé : lundi 22 décembre 2003 18:27
À : 'commons-user@jakarta.apache.org'
Objet : Jelly and forehead problem


Hello
I get some troubles with Jelly and Forehead
When I test custom class extract from
http://builder.com.com/5100-6370-1044636.html (arranged for beta4) I get
this error
---------------------------------------------------
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at com.werken.forehead.Forehead.run(Forehead.java:543)
        at com.werken.forehead.Forehead.main(Forehead.java:573)
Caused by: java.lang.NoClassDefFoundError:
org/apache/commons/jelly/TagLibrary
        at java.lang.ClassLoader.defineClass0(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
        at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:282)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:282)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:282)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
        at
org.apache.commons.jelly.parser.XMLParser.createTag(XMLParser.java:1039)
        at
org.apache.commons.jelly.parser.XMLParser.startElement(XMLParser.java:647)
        at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown
Source)
        at
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
Source)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatc
her.dispatch(Unknown Source)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
        at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
        at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at
org.apache.commons.jelly.parser.XMLParser.parse(XMLParser.java:283)
        at org.apache.commons.jelly.Jelly.compileScript(Jelly.java:171)
        at
org.apache.commons.jelly.util.CommandLineParser.invokeCommandLineJelly(Comma
ndLineParser.java:144)
        at org.apache.commons.jelly.Jelly.main(Jelly.java:137)
        ... 6 more
---------------------------------------------------

The script is 
---------------------------------------------------
<jelly
    xmlns="jelly:core"
    xmlns:case="jelly:com.jelly.examples.CaseTagLibrary">
    <case:case type="upper">Hello World!</case:case>
</jelly>
---------------------------------------------------

the forehead.conf file is
---------------------------------------------------
+ant.home
+jelly.home
+tools.jar

=[root.jelly] org.apache.commons.jelly.Jelly

[root]

[root.jelly]
  ${ant.home}/lib/*.jar
  ${jelly.home}/lib/*.jar
  ${jelly.home}/custom/example.jar
---------------------------------------------------


ANT_HOME, JELLY_HOME are correct.

THe Jelly compilation was succeed.
I put the example .jar with right namespace in $JELLY_HOME/custom

Do you have an idea ?
.......................
Marc DeXeT
Centre National de la Recherche Scientifique
National Center for Scientific Research 
.......................

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message