org.apache.xml.security.Init.init()


2003-07-02 04:52:26 AM
jbuilder0
Hi all,
I encouter this problem when I try to run a projekt to sign an
XML-Dokument. In the Class CreateSig I try to initialize the library.
here is my code:
import java.io.*;
import java.lang.reflect.*;
import java.security.*;
import java.security.cert.*;
import java.util.*;
import javax.xml.transform.TransformerException;
import org.w3c.dom.*;
import org.apache.xpath.XPathAPI;
import org.apache.xml.security.algorithms.MessageDigestAlgorithm;
import org.apache.xml.security.c14n.*;
import org.apache.xml.security.exceptions.XMLSecurityException;
import org.apache.xml.security.signature.*;
import org.apache.xml.security.keys.*;
import org.apache.xml.security.keys.content.*;
import org.apache.xml.security.keys.content.x509.*;
import org.apache.xml.security.keys.keyresolver.*;
import org.apache.xml.security.keys.storage.*;
import org.apache.xml.security.keys.storage.implementations.*;
import org.apache.xml.security.utils.*;
import org.apache.xml.security.transforms.*;
import org.apache.xml.security.Init;
import org.apache.xml.serialize.*;
import org.apache.log4j.Logger;
import de.tum.cobricks.item.*;
public class CreateItemSig {
static {
org.apache.xml.security.Init.init() ;
}
public static void main(String unused[]) throws Exception {
hier implementation...
sig.sign(privateKey);
...further implementation..
}
I get this in the compiler:
log4j:WARN No appenders could be found for logger
(org.apache.xml.security.algorithms.SignatureAlgorithm).
log4j:WARN Please initialize the log4j system properly.
org.apache.xml.security.signature.XMLSignatureException: You must
initialize the xml-security library correctly before you use it. Call
the static method "org.apache.xml.security.Init.init();" to do that
before you use any functionality from that library.
Original Exception was java.lang.NullPointerException at
org.apache.xml.security.algorithms.SignatureAlgorithm.<init>(Unknown Source)
at org.apache.xml.security.signature.SignedInfo.<init>(Unknown Source)
at org.apache.xml.security.signature.XMLSignature.<init>(Unknown Source)
at org.apache.xml.security.signature.XMLSignature.<init>(Unknown Source)
at soap.CreateItemSig.main(CreateItemSig.java:88)
java.lang.NullPointerException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:140)
at org.apache.xml.security.algorithms.SignatureAlgorithm.<init>(Unknown
Source)
at org.apache.xml.security.signature.SignedInfo.<init>(Unknown Source)
at org.apache.xml.security.signature.XMLSignature.<init>(Unknown Source)
at org.apache.xml.security.signature.XMLSignature.<init>(Unknown Source)
at soap.CreateItemSig.main(CreateItemSig.java:88)
Exception in thread "main"
I ve got the file log4j.properties in my homedirectory and a copy of it
in the jbuilderProject\src directory
what is rong?