|
|
Spring IOC Container not loading custom editors
I have a class called ProxyList with a corresponding ProxyListEditor (both are in the org.jasig.cas.client.validation package).
There's also a Cas20ProxyTicketValidator class that has a property called allowedProxyChains and the property is of type ProxyList.
I have a test case that loads the application context via the classpath and so it attempts to create a Cas20ProxyTicketValidator.
It always fails with not being to convert type String to ProxyList (no editor could be found, etc.)
Am I missing something to get this editor to automatically be recognized? Is there a specific BeanFactory/ApplicationContext that needs to be used? (I'm using the ClassPathApplicationContext).
The source is here:
svn/cas-clien...nt/validation/
I've tried in both Spring 2.0.8 (the same one Spring Security uses) and 2.5.1 and 2.5.4
Thanks!
-Scott
Here's the stack trace (too big for the other email):
-------------------------------------------------------------------------------
Test set: org.jasig.cas.client.validation.Cas20ProxyTicketVa lidatorTests
-------------------------------------------------------------------------------
Tests run: 3, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.328 sec lt;lt;lt; FAILURE!
testConstructionFromSpringBean(org.jasig.cas.clien t.validation.Cas20ProxyTicketValidatorTests) Time elapsed: 1.265 sec lt;lt;lt; ERROR!
org..beans.factory.BeanCreationExce ption: Error creating bean with name 'proxyTicketValidator' defined in class path resource [cas20ProxyTicketValidator.xml]: Initialization of bean failed; nested exception is org..beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [org.jasig.cas.client.validation.ProxyList] for property 'allowedProxyChains'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [org.jasig.cas.client.validation.ProxyList] for property 'allowedProxyChains': no matching editors or conversion strategy found
Caused by: org..beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [org.jasig.cas.client.validation.ProxyList] for property 'allowedProxyChains'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [org.jasig.cas.client.validation.ProxyList] for property 'allowedProxyChains': no matching editors or conversion strategy found
Caused by: java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [org.jasig.cas.client.validation.ProxyList] for property 'allowedProxyChains': no matching editors or conversion strategy found
at org..beans.TypeConverterDelegate.co nvertIfNecessary(TypeConverterDelegate.java:231)
at org..beans.TypeConverterDelegate.co nvertIfNecessary(TypeConverterDelegate.java:138)
at org..beans.BeanWrapperImpl.convertF orProperty(BeanWrapperImpl.java:380)
at org..beans.factory.support.Abstract AutowireCapableBeanFactory.applyPropertyValues(Abs tractAutowireCapableBeanFactory.java:1112)
at org..beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCapableBeanFactory.java:862)
at org..beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:423)
at org..beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 49)
at org..beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:155)
at org..beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:246)
at org..beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:160)
at org..beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:291)
at org..context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:352)
at org..context.support.ClassPathXmlAp plicationContext.lt;initgt;(ClassPathXmlApplicationCon text.java:122)
at org..context.support.ClassPathXmlAp plicationContext.lt;initgt;(ClassPathXmlApplicationCon text.java:66)
at org.jasig.cas.client.validation.Cas20ProxyTicketVa lidatorTests.testConstructionFromSpringBean(Cas20P roxyTicketValidatorTests.java:94)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:154 )
at junit.framework.TestCase.runBare(TestCase.java:127 )
at junit.framework.TestResult$1.protect(TestResult.ja va:106)
at junit.framework.TestResult.runProtected(TestResult .java:124)
at junit.framework.TestResult.run(TestResult.java:109 )
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:2 08)
at junit.framework.TestSuite.run(TestSuite.java:203)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.maven.surefire.junit.JUnitTestSet.execu te(JUnitTestSet.java:213)
at org.apache.maven.surefire.suite.AbstractDirectoryT estSuite.executeTestSet(AbstractDirectoryTestSuite .java:140)
at org.apache.maven.surefire.suite.AbstractDirectoryT estSuite.execute(AbstractDirectoryTestSuite.java:1 27)
at org.apache.maven.surefire.Surefire.run(Surefire.ja va:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.maven.surefire.booter.SurefireBooter.ru nSuitesInProcess(SurefireBooter.java:345)
at org.apache.maven.surefire.booter.SurefireBooter.ma in(SurefireBooter.java:1009)
Caused by: org..beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [org.jasig.cas.client.validation.ProxyList] for property 'allowedProxyChains'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [org.jasig.cas.client.validation.ProxyList] for property 'allowedProxyChains': no matching editors or conversion strategy found
Caused by: java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [org.jasig.cas.client.validation.ProxyList] for property 'allowedProxyChains': no matching editors or conversion strategy found
at org..beans.TypeConverterDelegate.co nvertIfNecessary(TypeConverterDelegate.java:231)
at org..beans.TypeConverterDelegate.co nvertIfNecessary(TypeConverterDelegate.java:138)
at org..beans.BeanWrapperImpl.convertF orProperty(BeanWrapperImpl.java:380)
at org..beans.factory.support.Abstract AutowireCapableBeanFactory.applyPropertyValues(Abs tractAutowireCapableBeanFactory.java:1112)
at org..beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCapableBeanFactory.java:862)
at org..beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:423)
at org..beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 49)
at org..beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:155)
at org..beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:246)
at org..beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:160)
at org..beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:291)
at org..context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:352)
at org..context.support.ClassPathXmlAp plicationContext.lt;initgt;(ClassPathXmlApplicationCon text.java:122)
at org..context.support.ClassPathXmlAp plicationContext.lt;initgt;(ClassPathXmlApplicationCon text.java:66)
at org.jasig.cas.client.validation.Cas20ProxyTicketVa lidatorTests.testConstructionFromSpringBean(Cas20P roxyTicketValidatorTests.java:94)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:154 )
at junit.framework.TestCase.runBare(TestCase.java:127 )
at junit.framework.TestResult$1.protect(TestResult.ja va:106)
at junit.framework.TestResult.runProtected(TestResult .java:124)
at junit.framework.TestResult.run(TestResult.java:109 )
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:2 08)
at junit.framework.TestSuite.run(TestSuite.java:203)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.maven.surefire.junit.JUnitTestSet.execu te(JUnitTestSet.java:213)
at org.apache.maven.surefire.suite.AbstractDirectoryT estSuite.executeTestSet(AbstractDirectoryTestSuite .java:140)
at org.apache.maven.surefire.suite.AbstractDirectoryT estSuite.execute(AbstractDirectoryTestSuite.java:1 27)
at org.apache.maven.surefire.Surefire.run(Surefire.ja va:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.maven.surefire.booter.SurefireBooter.ru nSuitesInProcess(SurefireBooter.java:345)
at org.apache.maven.surefire.booter.SurefireBooter.ma in(SurefireBooter.java:1009)
For those who have a similar problem, mine was actually that the property editor had a bug that returned the wrong type. The error message from the IOC container just wasn't very clear about that.
How to get the fix to the property editor? |
|