grouper-dev - RE: [grouper-dev] 2.1.2 hook writer not writing?
Subject: Grouper Developers Forum
List archive
- From: Chris Hyzer <>
- To: Jim Fox <>
- Cc: Grouper Dev <>
- Subject: RE: [grouper-dev] 2.1.2 hook writer not writing?
- Date: Wed, 12 Dec 2012 13:10:05 +0000
- Accept-language: en-US
##############
ok, I installed postgres on windows, created a user, and a database (public
schema), initted the registry... I took out the commit:
//status = HibernateSession.bySqlStatic().executeSql( "commit");
//log.debug("hook commit status: " + status);
I made sure there is no autocommit grouper.hibernate.properties:
hibernate.connection.autocommit = false
##############
I created a table:
CREATE TABLE uw_activity
(
"time" bigint,
action character varying(1000),
group_id character varying(1000),
data character varying(1000),
actors character varying
)
WITH (
OIDS=FALSE
);
ALTER TABLE uw_activity
OWNER TO grouper_v2_1;
##############
I enabled p6spy
grouper.hibernate.properties:
hibernate.connection.driver_class = com.p6spy.engine.spy.P6SpyDriver
spy.properties:
logfile=c\:\\temp\\grouperSpy.log
#############
I created a group:
gsh 0% grouperSession = GrouperSession.startRootSession();
edu.internet2.middleware.grouper.GrouperSession:
e4e7f2459c054b479ae56acf6b4338e8,'GrouperSystem','application'
gsh 1% addGroup("test", "testGroup2", "testGroup2");
2012-12-12 07:53:14,995: [main] DEBUG UWHooksWriter.writeActivity(109) - -
hook writer pg status: 1
2012-12-12 07:53:15,002: [main] DEBUG UWHooksWriter.writeActivity(87) - -
hook writer pg status: 1
2012-12-12 07:53:15,013: [main] DEBUG UWHooksWriter.writeActivity(87) - -
hook writer pg status: 1
2012-12-12 07:53:15,018: [main] DEBUG UWHooksWriter.writeActivity(87) - -
hook writer pg status: 1
group: name='test:testGroup2' displayName='test:testGroup2'
uuid='d5899271a82d46058164f8d531a212a4'
gsh 2%
#############
I see that Grouper automatically commits this in the grouperSpy.log:
2012/12/12 07:53:15:017, 1ms, statement: Method.java.invoke() line 597,
GrouperUtil.java.invokeMethod() line 3895,
GrouperHooksUtils.java.executeHook() line 494,
GrouperHooksUtils.java.access$0() line 470, GrouperHooksUtils.java.callback()
line 436, GrouperHooksUtils.java.afterCompletion() line 427,
Stem.java.internal_addChildGroup() line 1991,
Stem.java.internal_addChildGroup() line 1964,
Stem.java.internal_addChildGroup() line 1939, Stem.java.addChildGroup() line
471, addGroup.java.invoke() line 66, ShellHelper.java.eval() line 63,
GrouperShell.java.run() line 428, GrouperShell.java.grouperShellHelper() line
232, GrouperShell.java.main() line 162
insert into uw_activity (time, action, group_id, data, actors) values
(1355316795016, 'pg', 'd5899271a82d46058164f8d531a212a4', 'g:isa
EveryEntity', 'b4547cee098f48069c4b686a71795776')
2012/12/12 07:53:15:019, 1ms, commit
#############
Also, I see data in the table, see attached.
So... I dont know why you arent seeing commits... hmmm
Since it is a postcommit hook, I dont see a reason why you cant just
explicitly commit, though I bet if you run tests there is something else in
the registry that will not work if non-explicit commits arent committed by
the grouper DB framework... want to try gsh -test -all on an empty registry
with default config? :)
Thanks,
Chris
________________________________________
From: Jim Fox
[]
Sent: Tuesday, December 11, 2012 6:15 PM
To: Chris Hyzer
Subject: RE: [grouper-dev] 2.1.2 hook writer not writing?
Attached are grouper properties and the hook sources.
Jim
On Tue, 11 Dec 2012, Chris Hyzer wrote:
> Date: Tue, 11 Dec 2012 13:48:01 -0800
> From: Chris Hyzer
> <>
> To: Jim Fox
> <>
> Cc: Grouper Dev
> <>
> Subject: RE: [grouper-dev] 2.1.2 hook writer not writing?
>
> You shouldn't have to do either... can you send me your hook code and
> configuration and how you are calling it and any other any other stuff and
> I can try it out?
>
> Thanks,
> Chris
>
>
> -----Original Message-----
> From: Jim Fox
> [mailto:]
> Sent: Tuesday, December 11, 2012 2:54 PM
> To: Chris Hyzer
> Cc: Grouper Dev
> Subject: RE: [grouper-dev] 2.1.2 hook writer not writing?
>
>
> Also,
>
> Adding an executeSql("commit") after the insert or delete,
> and turning off autocommit also works.
>
> Jim
>
>
>
> On Tue, 11 Dec 2012, Jim Fox wrote:
>
>> Date: Tue, 11 Dec 2012 11:24:14 -0800
>> From: Jim Fox
>> <>
>> To: Chris Hyzer
>> <>
>> Cc: Grouper Dev
>> <>
>> Subject: RE: [grouper-dev] 2.1.2 hook writer not writing?
>>
>>
>> Possibly saving you some time,
>>
>> I turned on
>>
>> hibernate.connection.autocommit = true
>>
>> and now get the database updates. However, the updates worked
>> just fine on 1.6 with autocommit off.
>>
>> What's the effect of autocommit (aside from this working)?
>> Is there a way for me to issue commit from the hook instead?
>>
>> Jim
>>
>>
>>
>> On Tue, 11 Dec 2012, Chris Hyzer wrote:
>>
>>> Date: Tue, 11 Dec 2012 10:59:57 -0800
>>> From: Chris Hyzer
>>> <>
>>> To: Jim Fox
>>> <>,
>>> Grouper Dev
>>> <>
>>> Subject: RE: [grouper-dev] 2.1.2 hook writer not writing?
>>>
>>> Can you send me your full hook (or sanitized or whatever)... more info,
>>> grouper.properties entry, etc and I will try to reproduce
>>>
>>> Also, what are you running? UI? GSH? Make sure your hook java and
>>> grouper.properties is correct in that env... it should work :)
>>>
>>> Thanks,
>>> Chris
>>>
>>> -----Original Message-----
>>> From:
>>>
>>> [mailto:]
>>> On Behalf Of Jim Fox
>>> Sent: Tuesday, December 11, 2012 1:55 PM
>>> To: Grouper Dev
>>> Subject: [grouper-dev] 2.1.2 hook writer not writing?
>>>
>>>
>>>
>>>
>>> I'm working on an upgrade to grouper 2.1.2. I have some hooks that
>>> do this operation:
>>>
>>> int status = HibernateSession.bySqlStatic().executeSql(
>>> "insert into uw_activity (time, action, group_id, data, actors)
>>> values
>>> (?, ?, ?, ?, ?)",
>>> GrouperUtil.toList((Object)now.getTime(), (Object) action,
>>> (Object) groupId, (Object) data, (Object) userIds));
>>> log.debug("hook writer " + action + " status: " + status);
>>> // try very simple insert as well
>>> status = HibernateSession.bySqlStatic().executeSql("insert into xxx
>>> values ('abcd','efgh','z')");
>>> log.debug("hook extra status: " + status);
>>>
>>>
>>>
>>> On 1.6 this always wrote a record to the 'uw_activity' table. Now I never
>>> see anything show up in 'uw_activity'.
>>> The log shows the status return to be '1'.
>>> Nothing in the 'xxx' table either. It also returns status=1
>>>
>>>
>>> Grouper debug shows the hook running:
>>>
>>> GrouperHooksUtils.executeHook(490) - START: Hook
>>> UWMembershipHooks.membershipPostCommitAddMember id: RKVM6ID7
>>> HibernateSession.<init>(151) - Not using nested transactions, converting
>>> transaction type to: READ_WRITE_NEW
>>> HibernateSession.<init>(151) - Not using nested transactions, converting
>>> transaction type to: READ_WRITE_NEW
>>> GrouperHooksUtils.executeHook(496) - END (normal): Hook
>>> UWMembershipHooks.membershipPostCommitAddMember id: RKVM6ID7 (4ms)
>>>
>>> Is there something else I need to do now to get the hooks to write
>>> to the DB?
>>>
>>> Jim
>>>
>>>
>>>
>>>
>>>
>>
>
Attachment:
pg.jpg
Description: pg.jpg
- [grouper-dev] 2.1.2 hook writer not writing?, Jim Fox, 12/11/2012
- RE: [grouper-dev] 2.1.2 hook writer not writing?, Chris Hyzer, 12/11/2012
- RE: [grouper-dev] 2.1.2 hook writer not writing?, Jim Fox, 12/11/2012
- Message not available
- RE: [grouper-dev] 2.1.2 hook writer not writing?, Jim Fox, 12/11/2012
- RE: [grouper-dev] 2.1.2 hook writer not writing?, Chris Hyzer, 12/11/2012
- Message not available
- RE: [grouper-dev] 2.1.2 hook writer not writing?, Chris Hyzer, 12/12/2012
- RE: [grouper-dev] 2.1.2 hook writer not writing?, Jim Fox, 12/12/2012
- RE: [grouper-dev] 2.1.2 hook writer not writing?, Chris Hyzer, 12/12/2012
- RE: [grouper-dev] 2.1.2 hook writer not writing?, Jim Fox, 12/12/2012
- RE: [grouper-dev] 2.1.2 hook writer not writing?, Jim Fox, 12/12/2012
- RE: [grouper-dev] 2.1.2 hook writer not writing?, Jim Fox, 12/13/2012
- Message not available
- RE: [grouper-dev] 2.1.2 hook writer not writing?, Jim Fox, 12/13/2012
- RE: [grouper-dev] 2.1.2 hook writer not writing?, Chris Hyzer, 12/15/2012
- Re: [grouper-dev] 2.1.2 hook writer not writing?, Jim Fox, 12/15/2012
- RE: [grouper-dev] 2.1.2 hook writer not writing?, Chris Hyzer, 12/16/2012
- RE: [grouper-dev] 2.1.2 hook writer not writing?, Chris Hyzer, 12/12/2012
- Message not available
- RE: [grouper-dev] 2.1.2 hook writer not writing?, Chris Hyzer, 12/11/2012
- RE: [grouper-dev] 2.1.2 hook writer not writing?, Jim Fox, 12/11/2012
- RE: [grouper-dev] 2.1.2 hook writer not writing?, Chris Hyzer, 12/11/2012
Archive powered by MHonArc 2.6.16.