2
import org.owasp.esapi.*;

public class esapiTest
{
public static void main(String args[])
{
test();
}
public static void test()
{
String clean = ESAPI.encoder().canonicalize("someString");
Randomizer r=ESAPI.randomizer();    
System.out.println(r);
System.out.println(".....................");
System.out.println(clean);
}
}

実行時にこれらのエラーが発生するのはなぜですか? 私は ESAPI-2.0.1.jar を使用していますが、サーバー上で実行しようとしていません。Eclipseでテストするだけです。それらはビルド パスと参照ライブラリにあります。どんな助けでも素晴らしいでしょう。ありがとう。

Attempting to load ESAPI.properties via file I/O.
Attempting to load ESAPI.properties as resource file via file I/O.
Found in 'org.owasp.esapi.resources' directory: C:\resources\ESAPI.properties
Loaded 'ESAPI.properties' properties file
Attempting to load validation.properties via file I/O.
Attempting to load validation.properties as resource file via file I/O.
Found in 'org.owasp.esapi.resources' directory: C:\resources\validation.properties
Loaded 'validation.properties' properties file
Exception in thread "main" org.owasp.esapi.errors.ConfigurationException: java.lang.reflect.InvocationTargetException Encoder class (org.owasp.esapi.reference.DefaultEncoder) CTOR threw exception.
    at org.owasp.esapi.util.ObjFactory.make(ObjFactory.java:129)
    at org.owasp.esapi.ESAPI.encoder(ESAPI.java:99)
    at esapiTest.test(esapiTest.java:12)
    at esapiTest.main(esapiTest.java:7)
Caused by: 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:597)
    at org.owasp.esapi.util.ObjFactory.make(ObjFactory.java:86)
    ... 3 more
Caused by: org.owasp.esapi.errors.ConfigurationException: java.lang.reflect.InvocationTargetException LogFactory class (org.owasp.esapi.reference.Log4JLogFactory) CTOR threw exception.
    at org.owasp.esapi.util.ObjFactory.make(ObjFactory.java:129)
    at org.owasp.esapi.ESAPI.logFactory(ESAPI.java:137)
    at org.owasp.esapi.ESAPI.getLogger(ESAPI.java:154)
    at org.owasp.esapi.reference.DefaultEncoder.<init>(DefaultEncoder.java:75)
    at org.owasp.esapi.reference.DefaultEncoder.getInstance(DefaultEncoder.java:59)
    ... 8 more
Caused by: 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:597)
    at org.owasp.esapi.util.ObjFactory.make(ObjFactory.java:86)
    ... 12 more
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/spi/LoggerFactory
    at org.owasp.esapi.reference.Log4JLogFactory.<init>(Log4JLogFactory.java:62)
    at org.owasp.esapi.reference.Log4JLogFactory.getInstance(Log4JLogFactory.java:68)
    ... 17 more

何をすべきかわからない。

4

1 に答える 1

2

Log4j.jar (org.apache.log4j) の検索に問題があるようです

于 2012-11-23T20:31:37.183 に答える