Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.0.0-beta5
-
None
-
jdk1.8,eclipse luna, maven 3.3.9, the config is is default with jpa.
-
Patch
Description
if we uncomment JDBCGreylistHandler in smtpserver.xml, when we run the JamesAppSpringMain as application. we will get error. the error as below
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'smtpserver': Invocation of init method failed; nested exception is org.apache.james.protocols.lib.handler.ProtocolHandlerLoader$LoadingException: Unable to load handler
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:133)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:396)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1507)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:636)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:934)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
at org.apache.james.container.spring.context.JamesServerApplicationContext.<init>(JamesServerApplicationContext.java:40)
at org.apache.james.app.spring.JamesAppSpringMain.init(JamesAppSpringMain.java:61)
at org.apache.james.app.spring.JamesAppSpringMain.main(JamesAppSpringMain.java:42)
Caused by: org.apache.james.protocols.lib.handler.ProtocolHandlerLoader$LoadingException: Unable to load handler
at org.apache.james.container.spring.bean.factory.protocols.ProtocolHandlerLoaderBeanFactory.load(ProtocolHandlerLoaderBeanFactory.java:46)
at org.apache.james.protocols.lib.ProtocolHandlerChainImpl.init(ProtocolHandlerChainImpl.java:82)
at org.apache.james.protocols.lib.netty.AbstractProtocolAsyncServer.preInit(AbstractProtocolAsyncServer.java:51)
at org.apache.james.smtpserver.netty.SMTPServer.preInit(SMTPServer.java:95)
at org.apache.james.protocols.lib.netty.AbstractConfigurableAsyncServer.init(AbstractConfigurableAsyncServer.java:269)
at org.apache.james.protocols.lib.netty.AbstractServerFactory.init(AbstractServerFactory.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:344)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:295)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:130)
... 16 more
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.apache.james.smtpserver.fastfail.JDBCGreylistHandler': Unsatisfied dependency expressed through bean property 'whiteListedNetworks': Set this property value or disable dependency checking for this bean.
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.checkDependencies(AbstractAutowireCapableBeanFactory.java:1354)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1156)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:336)
at org.apache.james.container.spring.bean.factory.protocols.ProtocolHandlerLoaderBeanFactory.load(ProtocolHandlerLoaderBeanFactory.java:39)
... 28 more
this is because of the spring dependencyCheck at
/james-server-spring/src/main/java/org/apache/james/container/spring/bean/factory/protocols/ProtocolHandlerLoaderBeanFactory.java
line 39.
this will check the bq. org.apache.james.smtpserver.fastfail.JDBCGreylistHandler
setter at line 176
for the whiteListedNetworks will init at line 40
handler.init(config); which will invoke JDBCGreylistHandler init() and invoke setter at line 431.
so we need set the dependencyCheck to false at /ProtocolHandlerLoaderBeanFactory or change the setWhiteListedNetworks name to other at JDBCGreylistHandler. but i suggest to rename the function.
Attachments
Issue Links
- links to