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
不知道该怎么办。