Hi Emmanuel,
Happy new year. It does look like development could be a little friendlier in
this case. David mentioned that there's a circular dependency that needs to be
handled delicately and it looks like the trace should have a built in fast
track fixer as well.
It seems like what you are trying to do should be really simple. Just load
some xml to get a component initialized so you can run some tests using the
initialized component?
When I do that type of stuff I usually create an EMF model (from an XML Schema
definition or Annotated Java Interfaces) and generate the code for it. This
results in the java beans that will store the configuration. Then for testing
I just create instance of the beans and initialize them programmatically. Then
the initialized configuration gets passed to the objects that do the work...
If you think this type of approach might be helpful I can help explore it more
with real world code, etc. Wish I had some simpler more rapid fixes to
suggest. If you describe the general process being done in more detail maybe
we could come up with some simpler solutions.
One thing that did come to mind as I was reading David's reply is configuration
validation. It sounds like two components are being initialized and if one
component's configuration is invalid, the other one gets hosed. So just
validating the configuration of the bean could provide better messages for
debugging. EMF also has a nice validation framework for that type of stuff.
Cheers,
- Ole
Emmanuel Lecharny wrote:
<rant>
Now, I'm really pissed off !
I have spent a full day and almost last night to get something supposely
simple to get working. No way.
I may be totally stupid, but considering the committer status is being
meritocratic, I guess that users will be totally fooled by the current
configuration we have.
I just can't stand to loose my time to try to setup a f***ing xml file
to understand what I basically want to do : initialize a bloody java
structure with a list of elements. Period. Prerequisite : having some
access to preset data...
I'm just lost in hundred of stack traces more stupid than the previous
hundred ones, and it seems to be a maze without exit.
WTF for X sake do we have to write such a piece of garbage :
<spring:bean id="systemContextEntry"
class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<spring:property name="targetObject"><spring:ref
local='directoryService'/></spring:property>
<spring:property
name="targetMethod"><spring:value>newEntry</spring:value></spring:property>
<spring:property name="arguments">
<spring:list>
<spring:value xmlns="http://www.springframework.org/schema/beans">
ou=system
</spring:value>
<spring:value xmlns="http://www.springframework.org/schema/beans">
objectClass: top
objectClass: organizationalUnit
objectClass: extensibleObject
ou: system
</spring:value>
</spring:list>
</spring:property>
</spring:bean>
just to call a bloody method with two arguments, to get this as a result :
_ _ ____ ____ / \ _
__ __ _ ___| |__ ___| _ \/ ___| / _ \ | '_ \ / _` |/ __|
'_ \ / _ \ | | \___ \ / ___ \| |_) | (_| | (__| | | | __/ |_|
|___) | /_/ \_\ .__/ \__,_|\___|_| |_|\___|____/|____/
|_|
Exception in thread "main"
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'MainADS' defined in URL
[file:/home/elecharny/apacheds/bigbang/installers/apacheds-noarch/server.xml]:
Cannot resolve reference to bean 'directoryService' while setting
constructor argument; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'directoryService' defined in URL
[file:/home/elecharny/apacheds/bigbang/installers/apacheds-noarch/server.xml]:
Cannot create inner bean '(inner bean)' of type
[org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition]
while setting bean property 'systemPartition'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name '(inner bean)' defined in URL
[file:/home/elecharny/apacheds/bigbang/installers/apacheds-noarch/server.xml]:
Initialization of bean failed; nested exception is
org.springframework.beans.TypeMismatchException: Failed to convert
property value of type [java.lang.String] to required type
[org.apache.directory.server.core.entry.ServerEntry] for property
'contextEntry'; nested exception is java.lang.IllegalArgumentException:
Cannot convert value of type [java.lang.String] to required type
[org.apache.directory.server.core.entry.ServerEntry] for property
'contextEntry': no matching editors or conversion strategy found
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'directoryService' defined in URL
[file:/home/elecharny/apacheds/bigbang/installers/apacheds-noarch/server.xml]:
Cannot create inner bean '(inner bean)' of type
[org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition]
while setting bean property 'systemPartition'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name '(inner bean)' defined in URL
[file:/home/elecharny/apacheds/bigbang/installers/apacheds-noarch/server.xml]:
Initialization of bean failed; nested exception is
org.springframework.beans.TypeMismatchException: Failed to convert
property value of type [java.lang.String] to required type
[org.apache.directory.server.core.entry.ServerEntry] for property
'contextEntry'; nested exception is java.lang.IllegalArgumentException:
Cannot convert value of type [java.lang.String] to required type
[org.apache.directory.server.core.entry.ServerEntry] for property
'contextEntry': no matching editors or conversion strategy found
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name '(inner bean)' defined in URL
[file:/home/elecharny/apacheds/bigbang/installers/apacheds-noarch/server.xml]:
Initialization of bean failed; nested exception is
org.springframework.beans.TypeMismatchException: Failed to convert
property value of type [java.lang.String] to required type
[org.apache.directory.server.core.entry.ServerEntry] for property
'contextEntry'; nested exception is java.lang.IllegalArgumentException:
Cannot convert value of type [java.lang.String] to required type
[org.apache.directory.server.core.entry.ServerEntry] for property
'contextEntry': no matching editors or conversion strategy found
Caused by: org.springframework.beans.TypeMismatchException: Failed to
convert property value of type [java.lang.String] to required type
[org.apache.directory.server.core.entry.ServerEntry] for property
'contextEntry'; nested exception is java.lang.IllegalArgumentException:
Cannot convert value of type [java.lang.String] to required type
[org.apache.directory.server.core.entry.ServerEntry] for property
'contextEntry': no matching editors or conversion strategy found
Caused by: java.lang.IllegalArgumentException: Cannot convert value of
type [java.lang.String] to required type
[org.apache.directory.server.core.entry.ServerEntry] for property
'contextEntry': no matching editors or conversion strategy found
at
org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231)
at
org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138)
at
org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:380)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1105)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:861)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:421)
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:215)
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:127)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1099)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:861)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:421)
at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:261)
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:109)
at
org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:389)
at
org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:120)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:799)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:717)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:384)
at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:287)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
at
org.apache.xbean.spring.context.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:149)
at
org.apache.xbean.spring.context.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:48)
at org.apache.directory.server.Service.init(Service.java:60)
at org.apache.directory.server.UberjarMain.main(UberjarMain.java:56)
Is it *supposed* to help ??? How many insanity like this will we support
before we can work on real stuff, like how to write a serious LDAP
server? Do we have to whip ourselves, crawl on sandpaper, walk on fire
just to be allowed to bring some line of not totally meaningless code,
or is there a way to get rid of all those shitty buzzwords called IOC,
XML, XSD, Spring, Xbean and any of such over rated and over abused so
called 'technologies' ?
WE ARE LOOSING OUR TIME WITH ALL THOSE USELESS CRAPS !!! KISS, damn !
</rant>
yes, I'm just pissed off ;(