Hi,
   Just gave a try on this issue.. It is likely caused by missing jaas
configuration file. After did following steps manually. the sample can work.
      1. Create a jaas config file :
                /** Login Configuration for the SCA-Calculator-Policies
sample
                 ** for convenience, I am using NTLoginModule temporarily
                 **/

Calculator {
   com.sun.security.auth.module.NTLoginModule required;
};
     2. add jvm parameter: -Djava.security.auth.login.config=jaas.conf
     3. Go to CalculatorCallbackHandler.java, modify the hardcode user/pw to
correct one.
     I am new to sca policy.. if I missed anything here, pls correct me.

On Dec 17, 2007 8:14 PM, Simon Nash <[EMAIL PROTECTED]> wrote:

> I am getting the following error when building the latest trunk.  Any
> ideas?
>
>   Simon
>
> [INFO]
> -------------------------------------------------------------------------
> ---
> [INFO] Building Apache Tuscany SCA Calculator Sample using Implementation
> Polici
> es
> [INFO]    task-segment: [install]
> [INFO]
> -------------------------------------------------------------------------
> ---
> [INFO] [resources:resources]
> [INFO] Using default encoding to copy filtered resources.
> [INFO] [compiler:compile]
> [INFO] Compiling 12 source files to
> H:\tuscany58\sca\samples\calculator-implemen
> tation-policies\target\classes
> [INFO] [resources:testResources]
> [INFO] Using default encoding to copy filtered resources.
> [INFO] [compiler:testCompile]
> [INFO] Compiling 1 source file to
> H:\tuscany58\sca\samples\calculator-implementa
> tion-policies\target\test-classes
> [INFO] [surefire:test]
> [INFO] Surefire report directory:
> H:\tuscany58\sca\samples\calculator-implementa
> tion-policies\target\surefire-reports
>
> -------------------------------------------------------
>  T E S T S
> -------------------------------------------------------
> Running calculator.CalculatorTestCase
> 17-Dec-2007 11:28:27
> org.apache.tuscany.sca.contribution.processor.ValidatingXML
> StreamReader$1 error
> WARNING: XMLSchema validation problem in:
> file:/H:/tuscany58/sca/samples/calcula
> tor-implementation-policies/target/classes/Calculator.composite, line: 28,
> colum
> n: 4
> cvc-complex-type.2.4.a: Invalid content was found starting with element
> 'operati
> on'. One of '{WC[##other:"http://www.osoa.org/xmlns/sca/1.0"]}' is
> expected.
> 17-Dec-2007 11:28:28
> INFO:  Invoking operation - add
> 17-Dec-2007 11:28:28
> FINER: Inovoking operation add with arguments 3.0, 2.0,
> 17-Dec-2007 11:28:28
> INFO:  Returned from operation - add
> 17-Dec-2007 11:28:28
> FINER: Returning from operation add with return value 5
> 17-Dec-2007 11:28:28
> INFO:  Invoking operation - subtract
> 17-Dec-2007 11:28:28
> FINER: Inovoking operation subtract with arguments 3.0, 2.0,
> 17-Dec-2007 11:28:28
> INFO:  Returned from operation - subtract
> 17-Dec-2007 11:28:28
> FINER: Returning from operation subtract with return value 1
> 17-Dec-2007 11:28:28
> org.apache.tuscany.sca.contribution.processor.ValidatingXML
> StreamReader$1 error
> WARNING: XMLSchema validation problem in:
> file:/H:/tuscany58/sca/samples/calcula
> tor-implementation-policies/target/classes/Calculator.composite, line: 28,
> colum
> n: 4
> cvc-complex-type.2.4.a: Invalid content was found starting with element
> 'operati
> on'. One of '{WC[##other:"http://www.osoa.org/xmlns/sca/1.0"]}' is
> expected.
> 17-Dec-2007 11:28:28
> INFO:  Invoking operation - add
> 17-Dec-2007 11:28:28
> FINER: Inovoking operation add with arguments 3.0, 2.0,
> 17-Dec-2007 11:28:28
> INFO:  Invoking operation - add
> 17-Dec-2007 11:28:28
> FINER: Inovoking operation add with arguments 3.0, 2.0,
> 17-Dec-2007 11:28:28
> INFO:  Returned from operation - add
> 17-Dec-2007 11:28:28
> FINER: Returning from operation add with return value 5
> 17-Dec-2007 11:28:28
> INFO:  Returned from operation - add
> 17-Dec-2007 11:28:28
> FINER: Returning from operation add with return value 5
> 17-Dec-2007 11:28:28
> INFO:  Invoking operation - subtract
> 17-Dec-2007 11:28:28
> FINER: Inovoking operation subtract with arguments 3.0, 2.0,
> 17-Dec-2007 11:28:28
> INFO:  Returned from operation - subtract
> 17-Dec-2007 11:28:28
> FINER: Returning from operation subtract with return value 1
> 17-Dec-2007 11:28:28
> INFO:  Invoking operation - multiply
> 17-Dec-2007 11:28:28
> FINER: Inovoking operation multiply with arguments 3.0, 2.0,
> 17-Dec-2007 11:28:28
> INFO:  Returned from operation - multiply
> 17-Dec-2007 11:28:28
> FINER: Returning from operation multiply with return value
> java.lang.RuntimeExce
> ption: java.lang.SecurityException: Unable to locate a login configuration
> Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 1.462 sec
> <<< FA
> ILURE!
> testCalculator(calculator.CalculatorTestCase)  Time elapsed: 1.202 sec
>  <<< ERRO
> R!
> java.lang.RuntimeException: java.lang.SecurityException: Unable to locate
> a logi
> n configuration
>         at
> org.apache.tuscany.sca.policy.security.jaas.JaasAuthenticationPolicyH
> andler.beforeInvoke(JaasAuthenticationPolicyHandler.java:58)
>         at
> org.apache.tuscany.sca.implementation.java.invocation.PolicyHandlingI
> nterceptor.applyPreInvocationPolicies(PolicyHandlingInterceptor.java:63)
>         at
> org.apache.tuscany.sca.implementation.java.invocation.PolicyHandlingI
> nterceptor.invoke(PolicyHandlingInterceptor.java:45)
>         at
> org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JD
> KInvocationHandler.java:249)
>         at
> org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JD
> KInvocationHandler.java:146)
>         at $Proxy7.multiply(Unknown Source)
>         at calculator.CalculatorServiceImpl.multiply(
> CalculatorServiceImpl.java:
> 63)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke
> (NativeMethodAccessorImpl.
> java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAcces
> sorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at
> org.apache.tuscany.sca.implementation.java.invocation.JavaImplementat
> ionInvoker.invoke(JavaImplementationInvoker.java:105)
>         at
> org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JD
> KInvocationHandler.java:249)
>         at
> org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JD
> KInvocationHandler.java:146)
>         at $Proxy4.multiply(Unknown Source)
>         at calculator.CalculatorTestCase.testCalculator(
> CalculatorTestCase.java:
> 50)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke
> (NativeMethodAccessorImpl.
> java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAcces
> sorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at junit.framework.TestCase.runTest(TestCase.java:168)
>         at junit.framework.TestCase.runBare(TestCase.java:134)
>         at junit.framework.TestResult$1.protect(TestResult.java:110)
>         at junit.framework.TestResult.runProtected(TestResult.java:128)
>         at junit.framework.TestResult.run(TestResult.java:113)
>         at junit.framework.TestCase.run(TestCase.java:124)
>         at junit.framework.TestSuite.runTest(TestSuite.java:232)
>         at junit.framework.TestSuite.run(TestSuite.java:227)
>         at org.junit.internal.runners.OldTestClassRunner.run
> (OldTestClassRunner.
> java:35)
>         at org.apache.maven.surefire.junit4.JUnit4TestSet.execute
> (JUnit4TestSet.
> java:62)
>         at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTes
> tSet(AbstractDirectoryTestSuite.java:138)
>         at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(Ab
> stractDirectoryTestSuite.java:125)
>         at org.apache.maven.surefire.Surefire.run(Surefire.java:132)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke
> (NativeMethodAccessorImpl.
> java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAcces
> sorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at
> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(Su
> refireBooter.java:308)
>         at org.apache.maven.surefire.booter.SurefireBooter.main(
> SurefireBooter.j
> ava:879)
> Caused by: java.lang.SecurityException: Unable to locate a login
> configuration
>         at com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java
> :97)
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
>
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance
> (NativeConstruct
> orAccessorImpl.java:39)
>         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance
> (DelegatingC
> onstructorAccessorImpl.java:27)
>         at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
>         at java.lang.Class.newInstance0(Class.java:350)
>         at java.lang.Class.newInstance(Class.java:303)
>         at javax.security.auth.login.Configuration$3.run(
> Configuration.java:216)
>
>         at java.security.AccessController.doPrivileged(Native Method)
>         at javax.security.auth.login.Configuration.getConfiguration
> (Configuratio
> n.java:210)
>         at javax.security.auth.login.LoginContext$1.run(LoginContext.java
> :237)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at javax.security.auth.login.LoginContext.init(LoginContext.java
> :234)
>         at javax.security.auth.login.LoginContext.<init>(LoginContext.java
> :403)
>         at
> org.apache.tuscany.sca.policy.security.jaas.JaasAuthenticationPolicyH
> andler.beforeInvoke(JaasAuthenticationPolicyHandler.java:55)
>         ... 38 more
> Caused by: java.io.IOException: Unable to locate a login configuration
>         at com.sun.security.auth.login.ConfigFile.init(ConfigFile.java
> :206)
>         at com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java
> :95)
>         ... 52 more
>
> testAnotherCalculator(calculator.CalculatorTestCase)  Time elapsed: 0.23sec  
> <<
> < ERROR!
> java.lang.RuntimeException: java.lang.SecurityException: Unable to locate
> a logi
> n configuration
>         at
> org.apache.tuscany.sca.policy.security.jaas.JaasAuthenticationPolicyH
> andler.beforeInvoke(JaasAuthenticationPolicyHandler.java:58)
>         at
> org.apache.tuscany.sca.implementation.java.invocation.PolicyHandlingI
> nterceptor.applyPreInvocationPolicies(PolicyHandlingInterceptor.java:63)
>         at
> org.apache.tuscany.sca.implementation.java.invocation.PolicyHandlingI
> nterceptor.invoke(PolicyHandlingInterceptor.java:45)
>         at
> org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JD
> KInvocationHandler.java:249)
>         at
> org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JD
> KInvocationHandler.java:146)
>         at $Proxy7.multiply(Unknown Source)
>         at calculator.CalculatorServiceImpl.multiply(
> CalculatorServiceImpl.java:
> 63)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke
> (NativeMethodAccessorImpl.
> java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAcces
> sorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at
> org.apache.tuscany.sca.implementation.java.invocation.JavaImplementat
> ionInvoker.invoke(JavaImplementationInvoker.java:105)
>         at
> org.apache.tuscany.sca.implementation.java.invocation.PolicyHandlingI
> nterceptor.invoke(PolicyHandlingInterceptor.java:46)
>         at
> org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JD
> KInvocationHandler.java:249)
>         at
> org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JD
> KInvocationHandler.java:146)
>         at $Proxy4.multiply(Unknown Source)
>         at calculator.CalculatorTestCase.testAnotherCalculator
> (CalculatorTestCas
> e.java:58)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke
> (NativeMethodAccessorImpl.
> java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAcces
> sorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at junit.framework.TestCase.runTest(TestCase.java:168)
>         at junit.framework.TestCase.runBare(TestCase.java:134)
>         at junit.framework.TestResult$1.protect(TestResult.java:110)
>         at junit.framework.TestResult.runProtected(TestResult.java:128)
>         at junit.framework.TestResult.run(TestResult.java:113)
>         at junit.framework.TestCase.run(TestCase.java:124)
>         at junit.framework.TestSuite.runTest(TestSuite.java:232)
>         at junit.framework.TestSuite.run(TestSuite.java:227)
>         at org.junit.internal.runners.OldTestClassRunner.run
> (OldTestClassRunner.
> java:35)
>         at org.apache.maven.surefire.junit4.JUnit4TestSet.execute
> (JUnit4TestSet.
> java:62)
>         at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTes
> tSet(AbstractDirectoryTestSuite.java:138)
>         at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(Ab
> stractDirectoryTestSuite.java:125)
>         at org.apache.maven.surefire.Surefire.run(Surefire.java:132)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke
> (NativeMethodAccessorImpl.
> java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAcces
> sorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at
> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(Su
> refireBooter.java:308)
>         at org.apache.maven.surefire.booter.SurefireBooter.main(
> SurefireBooter.j
> ava:879)
> Caused by: java.lang.SecurityException: Unable to locate a login
> configuration
>         at com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java
> :97)
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
>
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance
> (NativeConstruct
> orAccessorImpl.java:39)
>         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance
> (DelegatingC
> onstructorAccessorImpl.java:27)
>         at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
>         at java.lang.Class.newInstance0(Class.java:350)
>         at java.lang.Class.newInstance(Class.java:303)
>         at javax.security.auth.login.Configuration$3.run(
> Configuration.java:216)
>
>         at java.security.AccessController.doPrivileged(Native Method)
>         at javax.security.auth.login.Configuration.getConfiguration
> (Configuratio
> n.java:210)
>         at javax.security.auth.login.LoginContext$1.run(LoginContext.java
> :237)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at javax.security.auth.login.LoginContext.init(LoginContext.java
> :234)
>         at javax.security.auth.login.LoginContext.<init>(LoginContext.java
> :403)
>         at
> org.apache.tuscany.sca.policy.security.jaas.JaasAuthenticationPolicyH
> andler.beforeInvoke(JaasAuthenticationPolicyHandler.java:55)
>         ... 39 more
> Caused by: java.io.IOException: Unable to locate a login configuration
>         at com.sun.security.auth.login.ConfigFile.init(ConfigFile.java
> :206)
>         at com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java
> :95)
>         ... 53 more
>
>
> Results :
>
> Tests in error:
>   testCalculator(calculator.CalculatorTestCase)
>   testAnotherCalculator(calculator.CalculatorTestCase)
>
> Tests run: 2, Failures: 0, Errors: 2, Skipped: 0
>
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] BUILD FAILURE
> [INFO]
> ------------------------------------------------------------------------
> [INFO] There are test failures.
>
> Please refer to
> H:\tuscany58\sca\samples\calculator-implementation-policies\targ
> et\surefire-reports for the individual test results.
> [INFO]
> ------------------------------------------------------------------------
> [INFO] For more information, run Maven with the -e switch
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 1 minute 57 seconds
> [INFO] Finished at: Mon Dec 17 11:28:28 GMT 2007
> [INFO] Final Memory: 20M/40M
> [INFO]
> ------------------------------------------------------------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Thanks & Best Wishes
-----------------------------------
Zhenghui Li(李正辉)

Reply via email to