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

  • SEARCH
  • Home
  • 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 7186669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:40:50+00:00 2026-05-28T18:40:50+00:00

I have a structure with the following domain classes: class Service{ static hasMany=[serviceRequirements:ServiceRequirement]} And

  • 0

I have a structure with the following domain classes:

class Service{ static hasMany=[serviceRequirements:ServiceRequirement]}

And of course a bunch of member variables…
Problem occurs when I’m trying to set the properties in the controller like this:

service.properties = params

I get the following error:

Executing action [update] of controller [se.hb.eme.DeveloperController] caused exception: Invalid property 'serviceRequirements[0]' of bean class [se.hb.eme.Service]: Index of out of bounds in property path 'serviceRequirements[0]'; nested exception is java.lang.IndexOutOfBoundsException: Index: 0, Size: 0

There’s pretty much no documentation on grails.org about this and I really can’t figure out the problem…

The .gsp is pretty simple. (I removed some fields…)

<g:form action="create">
<g:textField name="header" />
<g:textField name="serviceRequirements[0].header" /> 
<g:submitButton value="Create" />

  • 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-05-28T18:40:51+00:00Added an answer on May 28, 2026 at 6:40 pm

    If I understand it correctly that’s because the code is trying to set element 0 of a list, which has no elements in it, thus throwing an index out of bounds exception.

    Try this in your domain class:

    class Service{
      List<ServiceRequirement> serviceRequirements = ListUtils.lazyList(new ArrayList(), {new ServiceRequirement()} as org.apache.commons.collections.Factory)
      static hasMany = [serviceRequirements:ServiceRequirement]
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following structure: <div class=parent> <div id=child1>Content here</div> <div class=child2>Content here</div> </div>
I have the following structure: class User include Mongoid::Document end class Resource include Mongoid::Document
I have the following structure: Model public class EventEntry : LogEntry { public EventType
I have the following structure. <ul id=browser class=filetree> <li><span class=folder>Folder 1</span> <ul> <li><span class=file>Item
I have the following structure: class foo(object): class bar(object): def __init__(self, parent): self._parent=parent #this
I have the following structure: template <class T> struct Array{ int lenght; T *
I have the following project structure using a Domain Model, StructureMap and Fluent NHibernate:
I have the following structure in my web solution: Domain DataAccess ApplicationServices Web Tests
I have got following folder structure for my domain (domain.com): /data/images (it´s subdomain name,
In Structure map I have the following line working with domain events: public void

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.