You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Daniel Henze <dh...@googlemail.com> on 2010/03/22 16:58:42 UTC

Failure writing parameter 'value' of component core/PropertyEditBlocks:textfield

Hi there, I am a newbie with Tapestry (and JAVA) and maybe missing 
something obvious while trying to save the value of an embedded class.

Scenario is as follows. User class has embedded property ContactInfo 
that stores address, email, website and so on. I managed to embed the 
email field into a grid and the corresponding UserEdit page. But as soon 
as I try to save/update I get an exception "Failure writing parameter 
'value' of component core/PropertyEditBlocks:textfield: 
org.apache.tapestry5.ioc.internal.util.TapestryException".

Any hints are welcome. I paste part of the code below. I use Tapestry 
5.1.0.5 on Google App Engine. If more information is required, please 
let me know.

Regards
Daniel

------------------------------------
User.java
...
@Embedded
@Persistent(defaultFetchGroup = "true")
private ContactInfo contactInfo;
...
setter & getter
...
------------------------------------
BaseDAOImpl.java
public BaseDAOImpl() {
         try {
             _class = 
Class.forName(getClass().getGenericSuperclass().toString().split("[<>]")[1]);
         } catch (ClassNotFoundException e) {
             log.error(e.getMessage(), e);
             throw new RuntimeException(e.getMessage());
         }
     }
...
@Override
     public void save(T obj) {
         getPersistenceManager();
         try {
             pm.makePersistent(obj);
         } finally {
             pm.close();
         }
     }
...
------------------------------------
UserEdit.java
...
public BeanModel<User> getModel() {
         BeanModel<User> model = 
beanModelSource.createEditModel(User.class, resources);
         model.add("email", propertyConduitSource.create(User.class, 
"contactInfo.email")).dataType("text");
         return model;
}
...
------------------------------------
userEdit.tml
...
<t:beaneditform t:id="form" t:object="user" model="model">
</t:beaneditform>
...

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Failure writing parameter 'value' of component core/PropertyEditBlocks:textfield

Posted by Josh Canfield <jo...@gmail.com>.
> try {
>            _class =
> Class.forName(getClass().getGenericSuperclass().toString().split("[<>]")[1]);
>        } catch (ClassNotFoundException e) {
>            log.error(e.getMessage(), e);
>            throw new RuntimeException(e.getMessage());
>        }
>    }

This really doesn't have anything to do with your problem, but you can
grab the type arguments like this:

private Class<T> persistentClass;

this.persistentClass = (Class<T>) ((ParameterizedType) getClass()
                .getGenericSuperclass()).getActualTypeArguments()[0];

You didn't provide enough of the stack trace to really tell what's
going on. My random guess is that you're getting a
NullPointerException. I can't make a more educated guess without more
info though. Can we see the rest of the stack trace?

Josh

On Mon, Mar 22, 2010 at 8:58 AM, Daniel Henze <dh...@googlemail.com> wrote:
> Hi there, I am a newbie with Tapestry (and JAVA) and maybe missing something
> obvious while trying to save the value of an embedded class.
>
> Scenario is as follows. User class has embedded property ContactInfo that
> stores address, email, website and so on. I managed to embed the email field
> into a grid and the corresponding UserEdit page. But as soon as I try to
> save/update I get an exception "Failure writing parameter 'value' of
> component core/PropertyEditBlocks:textfield:
> org.apache.tapestry5.ioc.internal.util.TapestryException".
>
> Any hints are welcome. I paste part of the code below. I use Tapestry
> 5.1.0.5 on Google App Engine. If more information is required, please let me
> know.
>
> Regards
> Daniel
>
> ------------------------------------
> User.java
> ...
> @Embedded
> @Persistent(defaultFetchGroup = "true")
> private ContactInfo contactInfo;
> ...
> setter & getter
> ...
> ------------------------------------
> BaseDAOImpl.java
> public BaseDAOImpl() {
>        try {
>            _class =
> Class.forName(getClass().getGenericSuperclass().toString().split("[<>]")[1]);
>        } catch (ClassNotFoundException e) {
>            log.error(e.getMessage(), e);
>            throw new RuntimeException(e.getMessage());
>        }
>    }
> ...
> @Override
>    public void save(T obj) {
>        getPersistenceManager();
>        try {
>            pm.makePersistent(obj);
>        } finally {
>            pm.close();
>        }
>    }
> ...
> ------------------------------------
> UserEdit.java
> ...
> public BeanModel<User> getModel() {
>        BeanModel<User> model = beanModelSource.createEditModel(User.class,
> resources);
>        model.add("email", propertyConduitSource.create(User.class,
> "contactInfo.email")).dataType("text");
>        return model;
> }
> ...
> ------------------------------------
> userEdit.tml
> ...
> <t:beaneditform t:id="form" t:object="user" model="model">
> </t:beaneditform>
> ...
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
--
http://www.bodylabgym.com - a private, by appointment only, one-on-one
health and fitness facility.
--
http://www.ectransition.com - Quality Electronic Cigarettes at a
reasonable price!
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org