PDA

View Full Version : Problem while loading ConnectController



rajdeeplahkar
Jul 14th, 2011, 12:06 PM
Hi,

I am getting the following error when i declare ConnectController as a bean in my application-context xml file.
<bean class="org.springframework.social.connect.web.ConnectCont roller">
<property name="applicationUrl" value="${application.url}" />
</bean>

22:33:30.261 [[ERROR] DispatcherServlet] Context initialization failed
org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.web.servlet.mvc.annotation.De faultAnnotationHandlerMapping#0': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.social.connect.web.ConnectCon troller#0' defined in ServletContext resource [/WEB-INF/spring-context/application-context.xml]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigExcepti on: Could not generate CGLIB subclass of class [class org.springframework.social.connect.web.ConnectCont roller]: Common causes of this problem include using a final class or a non-visible class; nested exception is java.lang.IllegalArgumentException: Superclass has no null constructors but no arguments were given

I am using Spring core 3.0.5 and Spring social 1.0 RC1

Would really appreciate if someone can help me out regarding this.

Thanks and regards
Rajdeep

Keith Donald
Jul 14th, 2011, 02:22 PM
For some reason cglib is trying to subclass ConnectController in your application, presumably to proxy it. Why is this?

Keith

rajdeeplahkar
Jul 16th, 2011, 05:07 AM
Hi Keith,

I found the root cause of the issue. Actually in order to enable tracing at controller and service layers, we have enabled an intercepter using BeanNameAutoProxyCreator. The entry in the dispatcher context XML is as below:
<bean
class="org.springframework.aop.framework.autoproxy.BeanNa meAutoProxyCreator">
<property name="beanNames" value="*Controller,*Service" />
<property name="proxyTargetClass" value="true" />
<property name="interceptorNames">
<list>
<value>traceLoggingInterceptor</value>
</list>
</property>
<property name="order" value="2" />
</bean>
This entry was trying to create a proxy for the connectcontroller as well (using CLIB) and hence the issue. Now we need to find a way to differentiate our application controllers versus the spring social controllers so that the proxying happens only for our applicatin controllers.

Thanks and regards
Rajdeep