Results 1 to 10 of 10

Thread: UserInterceptor web-app initialization problem integrating 'spring-social-canvas'

  1. #1

    Question UserInterceptor web-app initialization problem integrating 'spring-social-canvas'

    Hi, guys.
    I'm use Spring 3.2.0 + MVC + WebFlow + Security + Spring MongoDb. All works fine, until I'm doing integration spring-social-canvas code example into project.

    I'm trying to integrate spring-social into web app for using as canvas app.
    There are two questions I have but I'll start with first one.

    1.
    'spring-social-canvas' example https://github.com/SpringSource/spri...ki/Quick-Start
    uses code with JDBC access

    Code:
    @Bean
    public UsersConnectionRepository usersConnectionRepository() {
        JdbcUsersConnectionRepository repository = new JdbcUsersConnectionRepository(dataSource, 
            connectionFactoryLocator(), Encryptors.noOpText());
        repository.setConnectionSignUp(new SimpleConnectionSignUp());
    .....
    I'm using mongodb as backend.
    Application consists of two modules: 'common jar module' and 'web-app module'.
    Mongo config, repositories, services are in 'common-module'. EXCEPT TWO REPOSITORY classes !!
    Controllers. Interceptors and other web stuff are in 'web-module'.

    I created 'UserConnection' entity for mongodb and made replacement implementations for classes:

    public class JdbcUsersConnectionRepository implements UsersConnectionRepository {..... {
    class JdbcConnectionRepository implements ConnectionRepository {.....
    they both are used for managing 'UserConnection' entity by JDBC stuff.

    So I have made two replacement classes below.
    I put them inside WEB module as I thought it will help me to work out problem, but that didn't help. So they are still in WEB-add module. I hope that doesn't matter for now.

    Code:
    package com.web.repository;
    public interface UserConnectionRepository extends UsersConnectionRepository {
    // empty interface
    }
    
    
    package com.web.repository;
    public class UserConnectionRepositoryImpl
            extends SimpleMongoRepository<UserConnection, ObjectId> implements UserConnectionRepository {
        private ConnectionFactoryLocator connectionFactoryLocator = null;
        private TextEncryptor textEncryptor = null;
        private ConnectionSignUp connectionSignUp;
        private MongoTemplate template;
    .......
        public UserConnectionRepositoryImpl(MongoTemplate template,
                                            ConnectionFactoryLocator connectionFactoryLocator,
                                            TextEncryptor textEncryptor,
                                            ConnectionSignUp connectionSignUp) {
            super(new MongoRepositoryFactory(template).<UserConnection, 
    ObjectId>getEntityInformation(UserConnection.class), template);
            this.template = template;
    ..............
    }
    
    package com.web.repository;
    public class MongodbConnectionRepository implements ConnectionRepository {
        private final String userId;
        private final MongoTemplate mongoTemplate;
        private final ConnectionFactoryLocator connectionFactoryLocator;
        private final TextEncryptor textEncryptor;
    
        public MongodbConnectionRepository(String userId, 
    MongoTemplate mongoTemplate, ConnectionFactoryLocator connectionFactoryLocator, 
    TextEncryptor textEncryptor) {
         .......
        }
    .....}
    Because of implementing them for mongodb as below:
    Code:
    UserConnectionRepositoryImpl
            extends SimpleMongoRepository<UserConnection, ObjectId> implements UserConnectionRepository.....
    i'm forced to using one or another constructors with calling to super :
    super(new MongoRepositoryFactory(template).<UserConnection,
    ObjectId>getEntityInformation(UserConnection.class ), template)


    My 'common module' java config files look like:
    Code:
    package com.core.config;
    @ImportResource("classpath:db-properties-config.xml")  // it imports 
    // <context:property-placeholder location="classpath*:mongodb.properties"/>
    @EnableMongoRepositories(basePackages = {"com.core.repository"})
    public class MongoDbConfiguration extends AbstractMongoConfiguration {
        @Value("${mongo.host}") private String host;
    .......
        @Override public MongoTemplate mongoTemplate() throws Exception {
    ........
        }
    ......
    }
    
    
    package com.core.repository;
    @Configuration
    @ComponentScan(basePackages = {"com.core.repository"})
    @Import(MongoDbConfiguration.class)
    public class RepositoryConfig {
        @Autowired private MongoDbConfiguration mongoDbConfiguration;
    .......
    }
    
    package com.core.service;
    @ComponentScan(basePackages = {"com.core.service"})
    @Import({RepositoryConfig.class})
    @ImportResource({"classpath:spring-security.xml", "classpath:velocityEmailSender-context.xml"})
    @PropertySource("classpath:mail.properties")
    public class ServiceConfig {
        @Autowired private RepositoryConfig repositoryConfig;
    .........
    }

    The web app module is initialized by java config as well:
    Code:
    package com.web.config;
    @Configuration
    @ComponentScan(basePackages = {.........
    @PropertySource("classpath:social-app-settings.properties")
    public class SocialConfig {
        @Value("${facebook.clientId}:incorrectClientApiId") String facebookClientId;
    .......
        @Autowired private MongoDbConfiguration mongoDbConfiguration;
        @Autowired private MongoTemplate template;
    .....
        @Bean
        public ConnectionFactoryLocator connectionFactoryLocator() {
            ConnectionFactoryRegistry registry = new ConnectionFactoryRegistry();
            registry.addConnectionFactory(new FacebookConnectionFactory(
    .................
        }
        @Bean
        public UsersConnectionRepository usersConnectionRepository() {
            try {
                if (template == null) {
                    template = mongoDbConfiguration.mongoTemplate();
                }
            } catch (Exception e) {............}
            UserConnectionRepository usersConnectionRepository = new UserConnectionRepositoryImpl(
                    template, connectionFactoryLocator(), Encryptors.noOpText(), new SimpleConnectionSignUp());
            return usersConnectionRepository;
         }
    
        @Bean
        @Scope(value="request", proxyMode= ScopedProxyMode.INTERFACES)
        public ConnectionRepository connectionRepository() {
        	    User user = SecurityContext.getCurrentUser();
        	    return usersConnectionRepository().createConnectionRepository(user.getId().toString());
        }
    
        @Bean
        public ProviderSignInController providerSignInController() {
            ProviderSignInController signInController = new ProviderSignInController(connectionFactoryLocator(),
                    usersConnectionRepository(), new SimpleSignInAdapter());
          .............
        }
    The rest usual code from example............
    }
    
    
    package com.web.config;
    @Configuration
    @EnableWebMvc
    @Import({ServiceConfig.class})
    @ImportResource("classpath:/webflow-config.xml")
    public class WebAppConfig extends WebMvcConfigurerAdapter {
        .........
        @Inject private UsersConnectionRepository usersConnectionRepository;
    .............
    
        public void addInterceptors(InterceptorRegistry registry) {
            registry.addInterceptor(localeChangeInterceptor());
            registry.addInterceptor(new UserInterceptor(usersConnectionRepository));
        ........
    The rest code in not important........
    }
    
    The main initialization is started by code:
    package com.web.config;
    public class MainWebAppInitializer implements WebApplicationInitializer {
        public void onStartup(ServletContext servletContext) throws ServletException {
            AnnotationConfigWebApplicationContext rootCtx = createWebAppContext(
                    ServiceConfig.class, RepositoryConfig.class, MongoDbConfiguration.class);
            rootCtx.setId("rootCtx");
    
            AnnotationConfigWebApplicationContext webAppCtx = new AnnotationConfigWebApplicationContext();
            webAppCtx.setParent(rootCtx);
            webAppCtx.setId("wac");
            webAppCtx.register(WebAppConfig.class, SocialConfig.class);
            webAppCtx.setServletContext(servletContext);
            servletContext.addListener(new ContextLoaderListener(webAppCtx));
            registerDispatcherServlet(servletContext, webAppCtx);
            ..............
      }
        /** Utility method 
        private AnnotationConfigWebApplicationContext createWebAppContext(final Class<?>... annotatedClasses) {
            AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
            context.register(annotatedClasses);
            return context;
        }
    The rest is not important....
    }
    UserInterceptor class stays almost the same:
    Code:
    package com.web.social;
    public final class UserInterceptor extends HandlerInterceptorAdapter {
        private UsersConnectionRepository connectionRepository;
        private final UserCookieGenerator userCookieGenerator = new UserCookieGenerator();
        public UserInterceptor(UsersConnectionRepository connectionRepository) {
            this.connectionRepository = connectionRepository;
        }
         ......... the rest is the same.....
    }

    Stay turned, I ran out of lines in forum editor....
    Last edited by blandger; Jan 17th, 2013 at 09:24 AM.
    Best regards.

  2. #2

    Default

    The problem i'm run into following:

    If only I put following dependency code, the web-app stops initialize and fails with stack below.
    Offending code:
    Code:
    public class WebAppConfig extends WebMvcConfigurerAdapter {
        .........
        @Inject private UsersConnectionRepository usersConnectionRepository;
    .............
        public void addInterceptors(InterceptorRegistry registry) {
            registry.addInterceptor(new UserInterceptor(usersConnectionRepository));
    .........
    When I remove it all works fine.

    I'm getting initialization error in Tomcat 7.0.32 x64 Windows 7 x64:
    Code:
    16:09:30.773 [RMI TCP Connection(3)-127.0.0.1] ERROR o.s.web.context.ContextLoader - Context initialization failed
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webAppConfig':
    Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException:
    Could not autowire field: private org.springframework.social.connect.UsersConnectionRepository com.web.config.WebAppConfig.usersConnectionRepository; 
    nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'usersConnectionRepository' defined in class com.web.config.SocialConfig:
    Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: 
    Factory method [public org.springframework.social.connect.UsersConnectionRepository com.web.config.SocialConfig.usersConnectionRepository()] threw exception; 
    nested exception is java.lang.IllegalStateException:
    ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: Root WebApplicationContext: startup date [Thu Jan 17 16:09:25 EET 2013]; root of context hierarchy
    ........
    Caused by: java.lang.IllegalStateException: 
    ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: Root WebApplicationContext: startup date [Thu Jan 17 16:09:25 EET 2013]; root of context hierarchy
    ........
    at org.springframework.data.mongodb.repository.support.MongoRepositoryFactory.getEntityInformation(MongoRepositoryFactory.java:140) ~[spring-data-mongodb-1.1.0.RELEASE.jar:na]
    	at com.web.repository.UserConnectionRepositoryImpl.<init>(UserConnectionRepositoryImpl.java:53) ~[UserConnectionRepositoryImpl.class:na]
    	at com.web.config.SocialConfig.usersConnectionRepository(SocialConfig.java:120) ~[SocialConfig.class:na]
    	at com.web.config.SocialConfig$$EnhancerByCGLIB$$a0abf29b.CGLIB$usersConnectionRepository$0(<generated>) ~[spring-core-3.2.0.RELEASE.jar:na]
    	at com.web.config.SocialConfig$$EnhancerByCGLIB$$a0abf29b$$FastClassByCGLIB$$1dca49b1.invoke(<generated>) ~[spring-core-3.2.0.RELEASE.jar:na]
    ..............
    Errors are point to lines in code:
    Code:
    public class UserConnectionRepositoryImpl
            extends SimpleMongoRepository<UserConnection, ObjectId> implements UserConnectionRepository {
    ...........
        public UserConnectionRepositoryImpl(MongoTemplate template,
                                            ConnectionFactoryLocator connectionFactoryLocator,
                                            TextEncryptor textEncryptor,
                                            ConnectionSignUp connectionSignUp) {
            super(new MongoRepositoryFactory(template).
                    <UserConnection, ObjectId>getEntityInformation(UserConnection.class), template);
    ........
    
    
    
    public class SocialConfig {
    ......
        @Bean
        public UsersConnectionRepository usersConnectionRepository() {
            UserConnectionRepository usersConnectionRepository = new UserConnectionRepositoryImpl(
                    template,
                    connectionFactoryLocator(), Encryptors.noOpText(),
                    new SimpleConnectionSignUp());
            return usersConnectionRepository;
    As I understand I have some dependency (circular?) on my 'two replacement mongodb classes' in web-app that fails initialization. Does it fail because 'repository' classes are not ready yet, but Interceptor wants repository ?

    How can I avoid that error, may be by 'postponing' UserInterceptor initialization on later phase or on 'demand'? How to do that better? What do you suggest to solve the error?

    Thank you,
    Yuriy.
    Last edited by blandger; Jan 17th, 2013 at 09:42 AM. Reason: add lines of code for stack
    Best regards.

  3. #3
    Join Date
    Jan 2006
    Location
    Edmonton, Alberta, Canada
    Posts
    62

    Default

    I remember I had the similar exception with "call 'refresh' before multicasting events via the context" before. After some research, I realized it was the spring jar dependency issue, somehow had multiple versions of spring security.

    And I suggest you separate your MongoDB Repository for your connection data from ConnectionRepository, so you can have a clear design. See my example at Customize Spring Social Connect Framework For MongoDB.

    HTH
    Yuan Ji
    www.jiwhiz.com - Passion for beautiful design

  4. #4

    Default

    Yuan, thanks for the tip.
    It would be great if I had such reason, but I think it's not a case.
    I can run web-app fine without injected dependency
    @Inject private UsersConnectionRepository usersConnectionRepository;

    once I put it into config it fails to start.
    I don't see duplicated jars in build. May be someone else can identify something wrong there?

    Here is my list of jars from /web-app/WEB-INF/lib build by gradle script.
    Code:
    activation-1.1.1.jar
    aopalliance-1.0.jar
    attoparser-1.1.jar
    common-module-0.0.1.jar
    commons-beanutils-1.8.0.jar
    commons-codec-1.6.jar
    commons-collections-3.2.1.jar
    commons-digester-2.0.jar
    commons-lang-2.4.jar
    commons-logging-1.1.1.jar
    gson-2.2.2.jar
    guava-13.0.1.jar
    hibernate-validator-4.3.1.Final.jar
    httpclient-4.2.2.jar
    httpcore-4.2.2.jar
    jackson-core-asl-1.9.9.jar
    jackson-mapper-asl-1.9.9.jar
    javassist-3.16.1-GA.jar
    javax.inject-1.jar
    javax.servlet-api-3.0.1.jar
    jboss-logging-3.1.0.CR2.jar
    jcl-over-slf4j-1.7.1.jar
    joda-time-2.1.jar
    jstl-1.2.jar
    logback-classic-1.0.9.jar
    logback-core-1.0.9.jar
    lombok-0.11.6.jar
    mail-1.4.5.jar
    mongo-java-driver-2.10.1.jar
    ognl-3.0.5.jar
    slf4j-api-1.7.2.jar
    spring-aop-3.2.0.RELEASE.jar
    spring-beans-3.2.0.RELEASE.jar
    spring-binding-2.3.1.RELEASE.jar
    spring-context-3.2.0.RELEASE.jar
    spring-context-support-3.2.0.RELEASE.jar
    spring-core-3.2.0.RELEASE.jar
    spring-data-commons-core-1.4.0.RELEASE.jar
    spring-data-mongodb-1.1.0.RELEASE.jar
    spring-expression-3.2.0.RELEASE.jar
    spring-jdbc-3.0.7.RELEASE.jar
    spring-js-2.3.1.RELEASE.jar
    spring-js-resources-2.3.1.RELEASE.jar
    spring-security-acl-3.1.3.RELEASE.jar
    spring-security-config-3.1.3.RELEASE.jar
    spring-security-core-3.1.3.RELEASE.jar
    spring-security-crypto-3.1.3.RELEASE.jar
    spring-security-taglibs-3.1.3.RELEASE.jar
    spring-security-web-3.1.3.RELEASE.jar
    spring-social-core-1.0.2.RELEASE.jar
    spring-social-facebook-1.0.2.RELEASE.jar
    spring-social-web-1.0.2.RELEASE.jar
    spring-tx-3.1.2.RELEASE.jar
    spring-web-3.2.0.RELEASE.jar
    spring-webflow-2.3.1.RELEASE.jar
    spring-webmvc-3.2.0.RELEASE.jar
    thymeleaf-2.0.15.jar
    thymeleaf-extras-conditionalcomments-2.0.0.jar
    thymeleaf-extras-springsecurity3-2.0.0.jar
    thymeleaf-extras-tiles2-2.0.0.jar
    thymeleaf-spring3-2.0.15.jar
    tiles-api-2.2.2.jar
    tiles-core-2.2.2.jar
    tiles-jsp-2.2.2.jar
    tiles-servlet-2.2.2.jar
    tiles-template-2.2.2.jar
    validation-api-1.0.0.GA.jar
    velocity-1.7.jar
    Best regards.

  5. #5
    Join Date
    Jan 2006
    Location
    Edmonton, Alberta, Canada
    Posts
    62

    Default

    I saw spring-jdbc-3.0.7.RELEASE.jar, which cannot work with spring 3.1.x or 3.2.x.
    Yuan Ji
    www.jiwhiz.com - Passion for beautiful design

  6. #6

    Default

    Quote Originally Posted by yuanji View Post
    I saw spring-jdbc-3.0.7.RELEASE.jar, which cannot work with spring 3.1.x or 3.2.x.
    Thank you pointing out, I didn't know that.
    But it's a little bit odd.

    running gradle command:
    > gradle -q web-app:dependencyInsight --dependency spring-jdbc --configuration compile

    Gives me result.
    Code:
    org.springframework:spring-jdbc:3.0.7.RELEASE
    +--- org.springframework.security:spring-security-web:3.1.3.RELEASE
    |    +--- compile
    |    +--- org.springframework.security:spring-security-taglibs:3.1.3.RELEASE
    |    |    +--- compile
    |    |    \--- MyProject:common-module:0.0.1
    |    |         \--- compile
    |    \--- MyProject:common-module:0.0.1 (*)
    \--- org.springframework.security:spring-security-acl:3.1.3.RELEASE
         \--- org.springframework.security:spring-security-taglibs:3.1.3.RELEASE (*)
    As I see wrong module version comes from:
    org.springframework.security:spring-security-web:3.1.3.RELEASE
    org.springframework.security:spring-security-acl:3.1.3.RELEASE

    that is something odd for me. I'll try to add correct spring-jdbc module version into script explicitly, because I didn't have it and get it implicitly.
    Best regards.

  7. #7

    Question

    I've updated build script by adding :
    compile "org.springframework:spring-jdbc:$springSecurityVersion" // 3.2.0.RELEASE

    Updated libs list:
    Code:
    activation-1.1.1.jar
    aopalliance-1.0.jar
    attoparser-1.1.jar
    common-module-0.0.1.jar
    commons-beanutils-1.8.0.jar
    commons-codec-1.6.jar
    commons-collections-3.2.1.jar
    commons-digester-2.0.jar
    commons-lang-2.4.jar
    commons-logging-1.1.1.jar
    gson-2.2.2.jar
    guava-13.0.1.jar
    hibernate-validator-4.3.1.Final.jar
    httpclient-4.2.2.jar
    httpcore-4.2.2.jar
    jackson-core-asl-1.9.9.jar
    jackson-mapper-asl-1.9.9.jar
    javassist-3.16.1-GA.jar
    javax.inject-1.jar
    javax.servlet-api-3.0.1.jar
    jboss-logging-3.1.0.CR2.jar
    jcl-over-slf4j-1.7.1.jar
    joda-time-2.1.jar
    jstl-1.2.jar
    logback-classic-1.0.9.jar
    logback-core-1.0.9.jar
    lombok-0.11.6.jar
    mail-1.4.5.jar
    mongo-java-driver-2.10.1.jar
    ognl-3.0.5.jar
    slf4j-api-1.7.2.jar
    spring-aop-3.2.0.RELEASE.jar
    spring-beans-3.2.0.RELEASE.jar
    spring-binding-2.3.1.RELEASE.jar
    spring-context-3.2.0.RELEASE.jar
    spring-context-support-3.2.0.RELEASE.jar
    spring-core-3.2.0.RELEASE.jar
    spring-data-commons-core-1.4.0.RELEASE.jar
    spring-data-mongodb-1.1.0.RELEASE.jar
    spring-expression-3.2.0.RELEASE.jar
    spring-jdbc-3.2.0.RELEASE.jar
    spring-js-2.3.1.RELEASE.jar
    spring-js-resources-2.3.1.RELEASE.jar
    spring-security-acl-3.1.3.RELEASE.jar
    spring-security-config-3.1.3.RELEASE.jar
    spring-security-core-3.1.3.RELEASE.jar
    spring-security-crypto-3.1.3.RELEASE.jar
    spring-security-taglibs-3.1.3.RELEASE.jar
    spring-security-web-3.1.3.RELEASE.jar
    spring-social-core-1.0.2.RELEASE.jar
    spring-social-facebook-1.0.2.RELEASE.jar
    spring-social-web-1.0.2.RELEASE.jar
    spring-tx-3.2.0.RELEASE.jar
    spring-web-3.2.0.RELEASE.jar
    spring-webflow-2.3.1.RELEASE.jar
    spring-webmvc-3.2.0.RELEASE.jar
    thymeleaf-2.0.15.jar
    thymeleaf-extras-conditionalcomments-2.0.0.jar
    thymeleaf-extras-springsecurity3-2.0.0.jar
    thymeleaf-extras-tiles2-2.0.0.jar
    thymeleaf-spring3-2.0.15.jar
    tiles-api-2.2.2.jar
    tiles-core-2.2.2.jar
    tiles-jsp-2.2.2.jar
    tiles-servlet-2.2.2.jar
    tiles-template-2.2.2.jar
    validation-api-1.0.0.GA.jar
    velocity-1.7.jar
    Unfortunately I'm getting exactly the same error in the same code lines.
    Best regards.

  8. #8
    Join Date
    Jan 2006
    Location
    Edmonton, Alberta, Canada
    Posts
    62

    Default

    Remove spring-security-crypto-3.1.3.RELEASE.jar as well, because spring-security-core-3.1.3.RELEASE.jar already has all the code.

    If that doesn't help, try to downgrade to spring 3.1.3.RELEASE, which works for me.

    Good luck!
    Yuan Ji
    www.jiwhiz.com - Passion for beautiful design

  9. #9

    Default

    Quote Originally Posted by yuanji View Post
    Remove spring-security-crypto-3.1.3.RELEASE.jar as well, because spring-security-core-3.1.3.RELEASE.jar already has all the code.
    That didn't help - same error

    If that doesn't help, try to downgrade to spring 3.1.3.RELEASE, which works for me.Good luck!
    That didn't help either - same error in same code places. I had to remove mvc tests with: org.springframework.test... imports. They are introduced in 3.2.0
    Code:
    activation-1.1.1.jar
    aopalliance-1.0.jar
    attoparser-1.1.jar
    cglib-nodep-2.2.2.jar
    common-module-0.0.1.jar
    commons-beanutils-1.8.0.jar
    commons-codec-1.6.jar
    commons-collections-3.2.1.jar
    commons-digester-2.0.jar
    commons-lang-2.4.jar
    commons-logging-1.1.1.jar
    gson-2.2.2.jar
    guava-13.0.1.jar
    hibernate-validator-4.3.1.Final.jar
    httpclient-4.2.2.jar
    httpcore-4.2.2.jar
    jackson-core-asl-1.9.9.jar
    jackson-mapper-asl-1.9.9.jar
    javassist-3.16.1-GA.jar
    javax.inject-1.jar
    javax.servlet-api-3.0.1.jar
    jboss-logging-3.1.0.CR2.jar
    jcl-over-slf4j-1.7.1.jar
    joda-time-2.1.jar
    jstl-1.2.jar
    logback-classic-1.0.9.jar
    logback-core-1.0.9.jar
    lombok-0.11.6.jar
    mail-1.4.5.jar
    mongo-java-driver-2.10.1.jar
    ognl-3.0.5.jar
    slf4j-api-1.7.2.jar
    spring-aop-3.1.3.RELEASE.jar
    spring-asm-3.1.3.RELEASE.jar
    spring-beans-3.1.3.RELEASE.jar
    spring-binding-2.3.1.RELEASE.jar
    spring-context-3.1.3.RELEASE.jar
    spring-context-support-3.1.3.RELEASE.jar
    spring-core-3.1.3.RELEASE.jar
    spring-data-commons-core-1.4.0.RELEASE.jar
    spring-data-mongodb-1.1.0.RELEASE.jar
    spring-expression-3.1.3.RELEASE.jar
    spring-jdbc-3.1.3.RELEASE.jar
    spring-js-2.3.1.RELEASE.jar
    spring-js-resources-2.3.1.RELEASE.jar
    spring-security-acl-3.1.3.RELEASE.jar
    spring-security-config-3.1.3.RELEASE.jar
    spring-security-core-3.1.3.RELEASE.jar
    spring-security-taglibs-3.1.3.RELEASE.jar
    spring-security-web-3.1.3.RELEASE.jar
    spring-social-core-1.0.2.RELEASE.jar
    spring-social-facebook-1.0.2.RELEASE.jar
    spring-social-web-1.0.2.RELEASE.jar
    spring-tx-3.1.3.RELEASE.jar
    spring-web-3.1.3.RELEASE.jar
    spring-webflow-2.3.1.RELEASE.jar
    spring-webmvc-3.1.3.RELEASE.jar
    thymeleaf-2.0.15.jar
    thymeleaf-extras-conditionalcomments-2.0.0.jar
    thymeleaf-extras-springsecurity3-2.0.0.jar
    thymeleaf-extras-tiles2-2.0.0.jar
    thymeleaf-spring3-2.0.15.jar
    tiles-api-2.2.2.jar
    tiles-core-2.2.2.jar
    tiles-jsp-2.2.2.jar
    tiles-servlet-2.2.2.jar
    tiles-template-2.2.2.jar
    validation-api-1.0.0.GA.jar
    velocity-1.7.jar
    Best regards.

  10. #10
    Join Date
    Jan 2006
    Location
    Edmonton, Alberta, Canada
    Posts
    62

    Default

    Interesting. I guess it may caused by the way you use SimpleMongoRepository:

    i'm forced to using one or another constructors with calling to super :
    super(new MongoRepositoryFactory(template).<UserConnection,
    ObjectId>getEntityInformation(UserConnection.class ), template)
    The template may not be ready when you call it. You can set a breakpoint to check if it is a proxy or real MongoTemplate object.

    Try change inheritance to composition. Your UserConnectionRepositoryImpl can just implement UserConnectionRepository, and add a member field of type SimpleMongoRepository, but only initialize it when first used.

    HTH
    Yuan Ji
    www.jiwhiz.com - Passion for beautiful design

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •