Announcement Announcement Module
Collapse
No announcement yet.
Issue extending connect controller Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Issue extending connect controller

    Using some recent examples on the message board I can extend connect controller and override methods. However, when I try to add a method I get this:

    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'connectController' defined in class path resource [spring/social.xml]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigExcepti on: Could not generate CGLIB subclass of class [class com.xx.yy.controller.MyConnectController]: 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 use xml configuration and spring 1.1.0.M4. The reason I want to add a method is to write a custom connectionStatus method instead of returning the JSP. I have also tried to override the connectionStatus method as well but receive the same error. Once I remove my new method or my attempt to override the connectionStatus I get no errors at startup.

    The problem I am trying to solve is I need to know if a user is connected to a service provider. I thought I could use the social:connected tags but the architecture of my application is such that these tags don't work because the tag code can't get access to the social beans since they are in different web apps.

  • #2
    I've not seen your controller code, but I'm willing to take a stab at this. They key phrase in your error is "Superclass has no null constructors but no arguments were given".

    My guess is that your subclass doesn't have a constructor that calls into ConnectController's constructor. Since ConnectController doesn't have a default constructor, Java doesn't know how to create the subclass.

    Simple fix: Create a constructor with the same arguments as ConnectController's constructor and just pass everything into super().

    Comment


    • #3
      Here is my constructor :

      @Inject
      public MyConnectController(ConnectionFactoryLocator connectionFactoryLocator, ConnectionRepository connectionRepository) {
      super(connectionFactoryLocator, connectionRepository);
      this.connectionRepository = connectionRepository;
      }

      My understanding is that I can't add a default constructor since ConnectController doesn't have one. I basically followed the example on the forums a few days ago and the above constructor is not what causes an issue. I can start up the app and it functions as is. But once I start adding an additional method to my subclass that is not in the super class - I get that exception. I found some other forum posts about cglib and setting <aop:scoped-proxy proxy-target-class="false" /> but it looks like the 1.1 tag <social:jdbc-connection-repository/> handles that in the underlying code (unless I am reading it wrong).

      thanks,
      Barry

      Comment

      Working...
      X