Not sure why the presense of the overrideMe() method would change things. When Tapestry instantiates a bean (such as a User, here) it always finds the constructor with the *most* parameters. Here it is trying to instantiate a User instance by injecting a User instance (into your copy-constructor).
This has come up in other contexts. What's needed in an annotation to tell Tapestry which constructor to use, when it has a choice. In any case, you can handle this by contributing a ApplicationStateContribution for type User to the ApplicationStateManager service. This contribution defines the strategy and creator for an Application State Object. The only built in strategy is named "session", and the ApplicationStateCreator interface has a single method: create(). Thus: public void contributeApplicationStateManager(MappedConfiguration<Class,ApplicationStateContribution> configuration) { ApplicationStateCreator creator = new ApplicatonStateCreator() { public Object create() { return new User(); } }; configuration.add(User.class, new ApplicationStateContribution("session", creator)); } On Wed, Mar 26, 2008 at 4:00 PM, petros <[EMAIL PROTECTED]> wrote: > > I have a LayoutCmpnt.java with the following annotation and everything works > fine > @ApplicationState > private User currentPrincipal; > > When I add the method overrideMe(User user) to the User POJO I am getting > the following exception. Removing the overrideMe(User user) fixes the > problem. Any ideas as to what I am doing wrong ? > > Caused by: org.apache.tapestry.ioc.internal.util.TapestryException: Error > invoking constructor com.cypoz.ebooking.ui.model.user.User(User) (at > User.java:34) (for service 'ApplicationStateManager'): No service implements > the interface com.cypoz.ebooking.ui.model.user.User. [at > classpath:com/cypoz/ebooking/ui/components/LayoutCmpnt.tml, line 17, column > 37] > > > > > > > > > > > > > > > > public class User implements org.acegisecurity.userdetails.UserDetails > { > private Long id = new Long(0); > private String username = ""; // required > private String firstName = ""; // required > private String lastName = ""; // required > private Set<Role> roles = new HashSet<Role>(); > private ContactDetails contactDetails = new ContactDetails(); > private Address address = new Address(); > private String password = ""; > private boolean enabled = true; > > public User(){...} > public User(User user){...} > public void overrideMe(User user){...} > public ContactDetails getContactDetails(){...} > public void setContactDetails(ContactDetails contactDetails){...} > public Address getAddress(){...} > public void setAddress(Address addressDetails){...} > public Long getId(){...} > public Set<Role> getRoles(){...} > public void addRole(Role role){...} > public User(String username){...} > public String getUsername(){...} > public String getFirstName(){...} > public String getLastName(){...} > public String getFullName(){...} > public void setId(Long id){...} > public void setUsername(String username){...} > public void setFirstName(String firstName){...} > public void setLastName(String lastName){...} > public void setRoles(Set<Role> roleDetails){...} > public List<Role> getRolesAsList(){...} > public void setRolesAsList(List<Role> rolesAsList){...} > public boolean equals(Object o){...} > public int hashCode(){...} > public String toString(){...} > public GrantedAuthority[] getAuthorities(){...} > public List<String> getRoleNames(){...} > public String getRoleNamesAsOneString(){...} > public String getPassword(){...} > public void setPassword(String password){...} > public boolean isAccountNonExpired() {...} > public boolean isAccountNonLocked() {...} > public boolean isCredentialsNonExpired() {...} > public boolean isEnabled() {...} > public void setEnabled(boolean enabled){...} > } > > > -- > View this message in context: > http://www.nabble.com/ApplicationStateManager-exception-tp16318510p16318510.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]