Announcement Announcement Module
Collapse
No announcement yet.
Spring Social on CloudFoundry Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Social on CloudFoundry

    I've tried to deploy my simple little Spring Social app onto CloudFoundry and get the following message from the MySQL service I've chosen to use:
    Code:
    Caused by: org.springframework.jdbc.datasource.init.ScriptStatementFailedException: Failed to execute SQL script statement at line 1 of resource class path resource [org/springframework/social/connect/jdbc/JdbcUsersConnectionRepository.sql]: create table UserConnection (userId varchar(255) not null,  providerId varchar(255) not null,  providerUserId varchar(255),  rank int not null,  displayName varchar(255),  profileUrl varchar(512),  imageUrl varchar(512),  accessToken varchar(255) not null,       secret varchar(255),  refreshToken varchar(255),  expireTime bigint,  primary key (userId, providerId, providerUserId))
    	at org.springframework.jdbc.datasource.init.ResourceDatabasePopulator.executeSqlScript(ResourceDatabasePopulator.java:199)
    	at org.springframework.jdbc.datasource.init.ResourceDatabasePopulator.populate(ResourceDatabasePopulator.java:132)
    	at com.justgoodpeople.mvp2.account.AccountRepositoryJpaImpl.<init>(AccountRepositoryJpaImpl.java:27)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)
    	... 54 more
    Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified key was too long; max key length is 1000 bytes
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    	at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
    I'm using Spring Social version 1.0.2.RELEASE, Spring Framework 3.1.1.RELEASE and MySQL connector 5.1.19.

    When will you have a fix for it? I believe the issue is that the default MyISAM storage engine for MySQL doesn't allow index keys longer than 1000 characters. The solution is to change it to use InnoDb. That being said, I realize that it can be arduous to cover off all different databases, but I think that Spring Social should work on your own cloud infrastructure out-of-the-box.

    Any recommended workaround that doesn't include hacking the Spring Social jar?

    Other than that works great!

  • #2
    The fix is to simply change the schema for the UserConnection table. The existing SQL that comes with Spring Social is intended to serve as a guide (and it works well with *most* databases), but is not intended to be a one-size-fits-all schema. It's convenient when it does work, but clearly not so convenient when it doesn't.

    So, what you'll need to do is go get JdbcUsersConnectionRepository.sql, tweak it to fit the database in question, and use your customized JdbcUsersConnectionRepository.sql instead of the original one.

    Comment


    • #3
      It was late... lol. After sleeping I realized that I control what's executed and when... Thanks for the wake up call/clarification!

      Comment

      Working...
      X