There are only 2 rows in the app_user table, neither of which have a username
or email of test6
I haven't managed to get the debugger working, was hoping to avoid it :-(
Mike.
mraible wrote:
>
> If you're certain the username doesn't already exist - maybe it's the
> e-mail address? That has to be unique as well and can trigger a
> DataIntegrityViolationException. I'd suggest firing up your debugger
> and walking through the code to see what's happening along the way.
>
> Matt
>
> On 8/16/07, mikebgx <[EMAIL PROTECTED]> wrote:
>>
>> My User definitely doesn't exist, I checked with MySQL Query Browser.
>> The exception occurs in UserDaoHibernate.saveOrUpdate().
>> Below is my output after turning up Hibernate logging to DEBUG, I can't
>> see
>> anything wrong, can you?
>>
>> Mike
>>
>> UserDaoHibernate.saveUser(52) | About to call saveOrUpdate()...
>> AbstractSaveEventListener.getEntityState(489) | transient instance of:
>> org.appfuse.model.User
>> DefaultSaveOrUpdateEventListener.entityIsTransient(161) | saving
>> transient
>> instance
>> AbstractSaveEventListener.performSave(152) | saving
>> [org.appfuse.model.User#<null>]
>> AbstractSaveEventListener.performSaveOrReplicate(240) | executing
>> insertions
>> Cascade.cascade(115) | processing cascade ACTION_SAVE_UPDATE for:
>> org.appfuse.model.User
>> Cascade.cascade(150) | done processing cascade ACTION_SAVE_UPDATE for:
>> org.appfuse.model.User
>> Versioning.seed(42) | Seeding: 0
>> JDBCTransaction.rollback(152) | rollback
>> JDBCTransaction.toggleAutoCommit(193) | re-enabling autocommit
>> JDBCTransaction.rollback(163) | rolled back JDBC Connection
>> JDBCContext.afterTransactionCompletion(215) | after transaction
>> completion
>> ConnectionManager.afterTransaction(296) | transaction completed on
>> session
>> with on_close connection release mode; be sure to close the session to
>> release JDBC resources!
>> SessionImpl.afterTransactionCompletion(422) | after transaction
>> completion
>> SessionImpl.setFlushMode(1289) | setting flush mode to: NEVER
>> SessionImpl.disconnect(374) | disconnecting session
>> ConnectionManager.cleanup(374) | performing cleanup
>> ConnectionManager.closeConnection(435) | releasing JDBC connection [
>> (open
>> PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
>> JDBCContext.afterTransactionCompletion(215) | after transaction
>> completion
>> ConnectionManager.afterTransaction(296) | transaction completed on
>> session
>> with on_close connection release mode; be sure to close the session to
>> release JDBC resources!
>> SessionImpl.afterTransactionCompletion(422) | after transaction
>> completion
>> ApplyForm.errMsg(373) | User 'test6' already exists!
>> ApplyForm.cmApprove(202) | User exists so deleting its newly cre'd cons,
>> Id=
>> 132
>>
>>
>>
>>
>> mraible wrote:
>> >
>> > You might turn up Hibernate logging (in log4j.xml) - that way you can
>> > see if the error is happening at the database level. I suspect it is
>> > and your user really does already exist.
>> >
>> > Matt
>> >
>> > On 8/16/07, mikebgx <[EMAIL PROTECTED]> wrote:
>> >>
>> >> I'm having problems creating a User from within my app. It seems to
>> think
>> >> the
>> >> User already exists.
>> >> Any ideas please?
>> >>
>> >> Mike
>> >>
>> >>
>> >> Here's my output:
>> >> (I'm logged in as test hence the msg: Verifying that 'test' can modify
>> >> 'test6')
>> >>
>> >> ApplyForm.cmApprove(133) | User test6 not found, OK, creating cons...
>> >> ApplyForm.cmApprove(150) | Saved cons, email= test6 - its Id= 126
>> >> ApplyForm.cmApprove(180) | About to save user: ...
>> >> UserSecurityAdvice.before(70) | Verifying that 'test' can modify
>> 'test6'
>> >> UserDaoHibernate.saveUser(49) | user's id: null
>> >> ApplyForm.errMsg(373) | User 'test6' already exists!
>> >> ApplyForm.cmApprove(200) | User exists so deleting its newly cre'd
>> cons,
>> >> Id=
>> >> 126
>> >>
>> >>
>> >> And here's the code:
>> >> try {
>> >> User u2= userManager.getUserByUsername(em);
>> >> userExists= true;
>> >> } catch (UsernameNotFoundException e) {
>> >> userExists= false;
>> >> }
>> >> if (userExists) {
>> >> errMsg("Username "+ em+ " already exists");
>> >> return null;
>> >> }
>> >>
>> >> log.debug("User "+ em+ " not found, OK, creating cons...");
>> >> //DBG
>> >> ....
>> >> log.debug("Saved cons, email= "+ em+ " - its Id= "+ consId);
>> >>
>> >> User usr = new User();
>> >> usr.setConsId(consId); // So this user only sees their own
>> cons
>> >> rec.
>> >> usr.setUsername(em);
>> >> usr.setPassword(pwd);
>> >> usr.setConfirmPassword(pwd);
>> >> usr.setEmail(em);
>> >> usr.setFirstName(apply.getForename());
>> >> usr.setLastName(apply.getSurname());
>> >> usr.setPhoneNumber(apply.getPhoneMobile());
>> >> usr.setEnabled(true);
>> >>
>> >> // Encrypt pwd...
>> >> Boolean encrypt = (Boolean)
>> >> getConfiguration().get(Constants.ENCRYPT_PASSWORD);
>> >> if (encrypt != null && encrypt.booleanValue()) {
>> >> String algorithm = (String)
>> >> getConfiguration().get(Constants.ENC_ALGORITHM);
>> >> if (algorithm == null) { // should only happen for test
>> case
>> >> if (log.isDebugEnabled()) {
>> >> log.debug("assuming testcase, setting algorithm to
>> >> 'SHA'");
>> >> }
>> >> algorithm = "SHA";
>> >> }
>> >>
>> usr.setPassword(StringUtil.encodePassword(usr.getPassword(),
>> >> algorithm));
>> >> }
>> >>
>> >> // Set the default user role on this new user
>> >> usr.addRole(roleManager.getRole(Constants.USER_ROLE));
>> >>
>> >> try {
>> >> log.debug("About to save user: "+ usr); //DBG
>> >> 45: userManager.saveUser(usr);
>> >> ....
>> >>
>> >> } catch (UserExistsException e) {
>> >> errMsg(e.getMessage());
>> >> log.debug("User exists so deleting its newly
>> >> cre'd cons, Id= "+ consId);
>> >> consultantManager.removeConsultant(""+
>> consId);
>> >> // redisplay the unencrypted passwords
>> >> usr.setPassword(usr.getConfirmPassword());
>> >> }
>> >>
>> >>
>> >> Line 45 throws UserExistsException
>> >>
>> >>
>> >>
>> >> --
>> >> View this message in context:
>> >> http://www.nabble.com/Signup-tf4279429s2369.html#a12180682
>> >> Sent from the AppFuse - User mailing list archive at Nabble.com.
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> For additional commands, e-mail: [EMAIL PROTECTED]
>> >>
>> >>
>> >
>> >
>> > --
>> > http://raibledesigns.com
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > For additional commands, e-mail: [EMAIL PROTECTED]
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Signup-tf4279429s2369.html#a12184718
>> Sent from the AppFuse - User mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>
> --
> http://raibledesigns.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/Signup-tf4279429s2369.html#a12185069
Sent from the AppFuse - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]