[Esapi-user] CTOR threw exception running the simple ESAPI Test java to access AccessController.

Mohan Bethur mbethur at adobe.com
Wed Aug 31 20:37:12 EDT 2011


Here is the stackTrace. I did replace the Encryptor.MasterKey and Encryptor.MasterSalt. But in this case I am just making sure that ESAPI is successfully integrated and configured.

-------------------------------------------------------------------------------
Test set: com.myorg.pkg.TestEsapiIntegration
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.041 sec <<< FAILURE!
testEsapiIntegration(com.myorg.pkg.TestEsapiIntegration)  Time elapsed: 0.024 sec  <<< ERROR!
org.owasp.esapi.errors.ConfigurationException: java.lang.reflect.InvocationTargetException AccessController class (org.owasp.esapi.reference.DefaultAccessController) CTOR threw exception.
        at org.owasp.esapi.util.ObjFactory.make(ObjFactory.java:129)
        at org.owasp.esapi.ESAPI.accessController(ESAPI.java:85)
        at com.myorg.pkg.TestEsapiIntegration.testEsapiIntegration(TestEsapiIntegration.java:25)
        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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
        at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
        at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
        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.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
        at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
        at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:172)
        at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:104)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:70)
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)
        ... 31 more
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/configuration/ConfigurationException
        at org.owasp.esapi.reference.DefaultAccessController.<init>(DefaultAccessController.java:32)
        at org.owasp.esapi.reference.DefaultAccessController.getInstance(DefaultAccessController.java:22)
        ... 36 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.configuration.ConfigurationException
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        ... 38 more

Thanks
Mohan

-----Original Message-----
From: Kevin W. Wall [mailto:kevin.w.wall at gmail.com] 
Sent: Wednesday, August 31, 2011 5:25 PM
To: Mohan Bethur
Subject: Re: [Esapi-user] CTOR threw exception running the simple ESAPI Test java to access AccessController.

Mohan,

Could you post a stack trace of the exception as well as the exception
message to the list?
Thanks,
-kevin

On Wed, Aug 31, 2011 at 7:45 PM, Mohan Bethur <mbethur at adobe.com> wrote:
> I have this java code to check if ESAPI has been integrated and configured.
>
>
>
> package com.myorg.pkg;
>
>
>
> import org.junit.Test;
>
> import org.owasp.esapi.ESAPI;
>
>
>
> public class TestEsapiIntegration {
>
>
>
>                 @Test
>
>                 public void testEsapiIntegration() {
>
>                                 System.out.println("ESAPI.accessController
> found: " + ESAPI.accessController());
>
>
>
>                 }
>
> }
>
>
>
> When I run "maven install" I get the following error..
>
>
>
> Running com.myorg.pkg.TestEsapiIntegration
>
> Attempting to load ESAPI.properties via file I/O.
>
> Attempting to load ESAPI.properties as resource file via file I/O.
>
> Found in SystemResource Directory/resourceDirectory:
> /Users/trunk/content/jcr_root/apps/mgr/src/impl/target/test-classes/.esapi/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 SystemResource Directory/resourceDirectory:
> /Users/trunk/content/jcr_root/apps/mgr/src/impl/target/test-classes/.esapi/validation.properties
>
> Loaded 'validation.properties' properties file
>
>
>
> Tests in error:
>
>   testEsapiIntegration(com.myorg.pkg.TestEsapiIntegration):
> java.lang.reflect.InvocationTargetException AccessController class
> (org.owasp.esapi.reference.DefaultAccessController) CTOR threw exception.
>
>
>
> Does anyone have suggestions why I get this error.
>
>
>
> Thanks
>
> Mohan
>
> _______________________________________________
> Esapi-user mailing list
> Esapi-user at lists.owasp.org
> https://lists.owasp.org/mailman/listinfo/esapi-user
>
>



-- 
Blog: http://off-the-wall-security.blogspot.com/
"The most likely way for the world to be destroyed, most experts agree,
is by accident. That's where we come in; we're computer professionals.
We *cause* accidents."        -- Nathaniel Borenstein


More information about the Esapi-user mailing list