Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8740665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:10:14+00:00 2026-06-13T11:10:14+00:00

I am trying to port to YABE in play1.2.4 to play 2.0.4 Java. For

  • 0

I am trying to port to YABE in play1.2.4 to play 2.0.4 Java. For that I created a initial-data.yml and tried to load it with Global.java

#Users
users:
    - !!models.User
        email:      bob@gmail.com
        password:   secret
        fullname:   Bob
        isAdmin:    true
#Posts

posts:

    - !!models.Post
        id:         1
        title:      About the model layer
        postedAt:   2009-06-14
        author:     
            - !!models.User
                email: bob@gmail.com
        content:    >
                    The model has a central position in a Play! application. Cut....   

My Global.java is below

public void onStart(Application app) {
        InitialData.insert(app);
    }

    static class InitialData {
        public static void insert(Application app) {
            if(Ebean.find(User.class).findRowCount() == 0) {
                Map<String, List<Object>> all = (Map<String, List<Object>>)Yaml.load("initial-data.yml");
                Ebean.save(all.get("users"));
                Ebean.save(all.get("posts"));
                Ebean.save(all.get("comments"));
            }
        }
    }

While loading I am getting following errors

ConstructorException: null; Can’t construct a java object for tag:yaml.org,2002:models.Post; exception=Cannot create property=author for JavaBean=models.Post@1; No suitable constructor with 3 arguments found for class models.User

org.yaml.snakeyaml.constructor.ConstructorException: null; Can't construct a java object for tag:yaml.org,2002:models.Post; exception=Cannot create property=author for JavaBean=models.Post@1; No suitable constructor with 3 arguments found for class models.User

     org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:333)

     org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:183)

     org.yaml.snakeyaml.constructor.BaseConstructor.constructSequenceStep2(BaseConstructor.java:277)

     org.yaml.snakeyaml.constructor.BaseConstructor.constructSequence(BaseConstructor.java:248)

     org.yaml.snakeyaml.constructor.SafeConstructor$ConstructYamlSeq.construct(SafeConstructor.java:440)

     org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:183)

     org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping2ndStep(BaseConstructor.java:326)

     org.yaml.snakeyaml.constructor.SafeConstructor.constructMapping2ndStep(SafeConstructor.java:143)

     org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping(BaseConstructor.java:307)

     org.yaml.snakeyaml.constructor.SafeConstructor$ConstructYamlMap.construct(SafeConstructor.java:459)

     org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:183)

     org.yaml.snakeyaml.constructor.BaseConstructor.constructDocument(BaseConstructor.java:142)

     org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:128)

     org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:480)

     org.yaml.snakeyaml.Yaml.load(Yaml.java:411)

Any Idea why this happens?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:10:15+00:00Added an answer on June 13, 2026 at 11:10 am

    Manuel, Thanks for the help.

    When I slightly modified the YAML i got it working, I just removed the “-“, which is in front of the “model.class”

    #Users
    users:
        - !!models.User
            email:      bob@gmail.com
            password:   secret
            fullname:   Bob
            isAdmin:    true
    #Posts
    
    posts:
    
        - !!models.Post
            id:         1
            title:      About the model layer
            postedAt:   2009-06-14
            author: !!models.User
                    email: bob@gmail.com
            content:    >
                        The model has a central position in a Play! application. Cut....   
    

    Any idea what “-” stands for?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to port some code form java do F# that generates a
I'm busy trying to port Java code that looks like this Cipher rsa =
I am trying to port some of my WebDriver tests from JAVA to C#.
i'm trying to port code that compiles ok with visual studio and on linux
I'm trying to port a program/game that was developed in linux/g++ so that it
i'm trying to port some Java stuff to C#. I'm just wondering if the
Trying to port java code to C++ I've stumbled over some weird behaviour. I
I am trying to port a project (from linux) that uses Semaphores to Mac
I am trying to port some java code to scala. The code uses annotations
I'm trying to port an iPhone application from using SQLite to Core Data. Is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.