Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 35

Thread: PoC for Roo Security Addon - User Registration, Forgot Password, Change Password, DB

  1. #11
    Join Date
    Aug 2008
    Posts
    3

    Default

    Hi

    I'm getting this error when trying to test on tomcat, any idea why?

    [INFO] Preparing tomcat:run
    [INFO] [aspectj:compile {execution: default}]
    [ERROR] The method setActivationDate(Date) is undefined for the type UserModel
    [ERROR] The method setActivationDate(null) is undefined for the type UserModel
    [WARNING] advice defined in org.springframework.mock.staticmock.AnnotationDriv enStaticEntityMockingControl has not been applied [Xlint:adviceDidNotMatch]
    [WARNING] advice defined in org.springframework.mock.staticmock.AbstractMethod MockingControl has not been applied [Xlint:adviceDidNotMatch]
    [WARNING] advice defined in org.springframework.scheduling.aspectj.AbstractAsy ncExecutionAspect has not been applied [Xlint:adviceDidNotMatch]
    [INFO] ------------------------------------------------------------------------
    [ERROR] BUILD ERROR
    [INFO] ------------------------------------------------------------------------
    [INFO] Compiler errors :
    error at userModel.setActivationDate(new Date());
    ^^^^^^^
    /mydir/web/SignUpController.java:57:0::0 The method setActivationDate(Date) is undefined for the type UserModel
    error at userModel.setActivationDate(null);
    ^^^^
    /mydir/src/main/java/org/fingerprintsoft/community/web/SignUpController.java:79:0::0 The method setActivationDate(null) is undefined for the type UserModel

  2. #12
    Join Date
    May 2010
    Posts
    8

    Default

    run the following from roo

    entity -class ~.model.UserModel
    field date --fieldName activationDate --type java.util.Date

    and rerun the test

  3. #13
    Join Date
    Aug 2008
    Posts
    3

    Default

    Quote Originally Posted by ahsin01 View Post
    run the following from roo

    entity -class ~.model.UserModel
    field date --fieldName activationDate --type java.util.Date

    and rerun the test

    Thanks.

    The only other thing I had to do was to remove the following lines from
    ForgotPasswordController and SignUpController
    @Autowired
    private transient SimpleMailMessage simpleMailMessage;

    public void sendMessage(String mailTo, String message) {
    simpleMailMessage.setTo(mailTo);
    simpleMailMessage.setText(message);
    mailSender.send(simpleMailMessage);
    }

    It seems to be working now as expected.

    I also checked out the latest files and built the jar locally.

  4. #14
    Join Date
    Jan 2011
    Posts
    2

    Default

    Hi naeem.ally,

    i am working on fixing the bug/error in code,

    i am not able to produce that error ,so can you please provide me steps to reproduce that bug.

    Regards
    Piyush

  5. #15
    Join Date
    Aug 2008
    Posts
    3

    Default

    Quote Originally Posted by piyushpalod View Post
    Hi naeem.ally,

    i am working on fixing the bug/error in code,

    i am not able to produce that error ,so can you please provide me steps to reproduce that bug.

    Regards
    Piyush
    Hi

    I installed the latest STS sts-2.5.2.RELEASE with roo 1.1.1
    I then followed the steps in your guide.
    The only change was that I compiled your jar locally (no changes from my side)
    osgi start --url file:///tmp/security/spring-roo-addon-typical-security-read-only/target/com.xsoftwarelabs.spring.roo.addon.typicalsecurity-0.1.3.BUILD-SNAPSHOT.jar

    I then got the error

    error at userModel.setActivationDate(new Date());
    ^^^^^^^
    /mydir/web/SignUpController.java:57:0::0 The method setActivationDate(Date) is undefined for the type UserModel
    error at userModel.setActivationDate(null);
    ^^^^
    /mydir/src/main/java/org/fingerprintsoft/community/web/SignUpController.java:79:0::0 The method setActivationDate(null) is undefined for the type UserModel

    which was resolved by
    entity -class ~.model.UserModel
    field date --fieldName activationDate --type java.util.Date

    I then got the error

    ERROR org.springframework.web.servlet.DispatcherServlet - Context initialization failed
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'forgotPasswordController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Could not autowire field: private transient org.springframework.mail.SimpleMailMessage org.fingerprintsoft.community.web.ForgotPasswordCo ntroller.simpleMailMessage; nested exception is org.springframework.beans.factory.NoSuchBeanDefini tionException: No matching bean of type [org.springframework.mail.SimpleMailMessage] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Aut owired(required=true)}

    I resolved this by removing

    @Autowired
    private transient SimpleMailMessage simpleMailMessage;

    as it didn't seemed to be used anywhere.

  6. #16
    Join Date
    May 2010
    Posts
    8

    Default

    add

    <bean class="org.springframework.mail.SimpleMailMessage" id="simpleMailMessage" />

    into applicationContext.xml

    then you won't get the errors

  7. #17
    Join Date
    Jan 2011
    Posts
    2

    Default

    Thank you ashin01 for giving solution

    yes the problem of "naeem.ally"s is reproducible in spring roo 1.1.1

    what you need to do is

    run this command in roo shell

    entity -class ~.model.UserModel
    field date --fieldName activationDate --type java.util.Date

    and add

    <bean class="org.springframework.mail.SimpleMailMessage" id="simpleMailMessage" />

    into applicationContext.xml file

    run the test...it works fine.

    mean time we are looking into this problem and get back to guys soon.

  8. #18
    Join Date
    Mar 2008
    Location
    Sydney, AU
    Posts
    974

    Default

    Rohit,

    Great work!

    I took a brief look at your video and noticed you use the email setup command internally. Since email sending can be slow, this will block the UI thread for that time with your current solution.

    If you want this to go away please open a Jira ticket so I can look into adding Spring's @Async for email operations. This will then internally use a future to send the email and the UI thread will not be affected.

    -Stefan
    Stefan Schmidt
    Software Engineer, Spring Roo
    SpringSource - a division of VMware
    twitter @schmidtstefan

  9. #19
    Join Date
    May 2010
    Posts
    8

    Default

    This is a very useful information. I am looking forward for the feature.

  10. #20
    Join Date
    Mar 2008
    Location
    Sydney, AU
    Posts
    974

    Default

    Just to let you know I have implemented support for Springs @Async (https://jira.springsource.org/browse/ROO-1995) so the 'field email' command now takes an optional --async attribute which enables this feature.

    I would recommend for you to use this.
    Stefan Schmidt
    Software Engineer, Spring Roo
    SpringSource - a division of VMware
    twitter @schmidtstefan

Tags for this Thread

Posting Permissions

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