Tuesday, May 3, 2011

Application Module cannot get principal when you use transaction controller in task flows (Fixed in 11.1.2)

When you use Transaction behavior in Task flows then ApplicationModuleImpl.getUserPrincipalName gives a java.lang.NullPointerException
To reproduce it I have an application module with an exposed method:

public void checkTransaction(){
System.out.println(this.getDBTransaction().getSession().getEnvironment().get("jbo.user.principal"));
System.out.println(this.getUserPrincipalName());
}

I also have 2 ‘isolated’ task flows, StartNewTransaction with ‘Always Begin new Transaction’ and UseExistingTransaction with ‘Use existing transaction if possible’




I have user: ‘user1/welcome1’ and run TestTransactions page and loggin.
In main page checkTransactions works as expected. Yet in other task flows it gives a:

java.lang.NullPointerException
at oracle.jbo.server.ApplicationModuleImpl.getUserPrincipalName(ApplicationModuleImpl.java:8429)
at model.modules.AppModuleImpl.checkTransaction(AppModuleImpl.java:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)


Is this a specific method bug?
Will I have issues with history columns?
Do I loose any other security context?

Test Case:
http://adfbugs.googlecode.com/files/testTransactions.zip

Does not reproduce in jdeveloper 11.1.2

5 comments:

  1. I had to switch to using JDBC Datasource to run your testcase, but then all of these expressions returns "user1" for me in 11.1.1.4 production:
    .
    System.out.println(ADFContext.getCurrent().getSecurityContext().getUserName());
    System.out.println(ADFContext.getCurrent().getSecurityContext().getUserPrincipal().getName());
    System.out.println(this.getUserPrincipalName());

    ReplyDelete
  2. hi Michael

    see also forum thread "ADFContext instead of ApplicationModuleImpl.getUserPrincipalName()"
    at http://forums.oracle.com/forums/thread.jspa?threadID=2217602

    regards
    Jan Vervecken

    ReplyDelete
  3. Thanks for your input

    bug request# 12420139 is logged for my SR

    I will let you know how it turns out

    ReplyDelete
  4. The bug resolution
    bug diagnosis group has updated that they have successfully reproduced your issue in JDeveloper 11.1.1.4.0 / 11.1.1.5.0 (latest available release).
    They also tested this application in JDeveloper 11.1.2.0.0 (yet-to-be-released) and found that the issue does not reproduce

    ReplyDelete