Session geting null in AM Impl class

All,
In my root AM IMPL class i am setting the session variables as follows
        if(pAccountNumber!=null) getSession().getUserData().put("accountNumber",  pAccountNumber);
        System.out.println("User Account Number from Session is : " + getSession().getUserData().get("accountNumber")); //this value is getting printed
        if(pBranch!=null) getSession().getUserData().put("branch", pBranch);
        if(pItem!=null) getSession().getUserData().put("item", pItem);
        if(pOrganizationCode!=null) getSession().getUserData().put("organizationCode", pOrganizationCode);
        if(pCustomerId!=null) getSession().getUserData().put("customerId", pCustomerId);
        if(pCustomerName!=null) getSession().getUserData().put("customerName", pCustomerName);In my AM impl class extending the root Ampl class i am calling the getSession() like this
        ViewObjectImpl itemStockVo = getItemStock();
        _logger.fine("Account Number from Session : " + getSession().getUserData().get("accountNumber")); //this is printing as nullPlease advice what is wrong here ?
thnks
jdev 11.1.1.5

Yes can be but as i have not disabled the AM pooling and the account name is coming null evne in the first go, i sense that may not be the issue (I may be wrong here).
For your second part Timo, i am setting the session value as the default activity when the taskflow loads and i am trying to get it in the next view activity

Similar Messages

  • Create session bean using interfaces, not implementation classes

    Hi,
    I'm using interfaces and session beans for my persistence/data layer in my adf application.
    I've created a data control for my session bean and during creation of this data control, javabean.xml files are created for the different interfaces that are used in my session bean.
    If I create bindings on these methods, interfaces in jspx-documents I will get errors because he can't find the impl-classes that implement these interfaces.
    When using interfaces in your session bean (as return values or parameters) instead of classes you need to manually create javabean.xml files for the implementation classes.
    It's required by the databindings/datacontrol that the implementation-classes are described in a javabean-format as well? Is this a spec we need to adhere to?
    Could someone verify that you need to create javabean.xml-files for as well the interfaces as the classes when you're working with interfaces in your session beans?
    regards,
    Nathalie

    A patch was released by Oracle to be able to work with Interfaces and so it's not required to work with implementation-classes.
    Patch for 5726754(Base bug 5657179)

  • The unitofwork giving null [uow.readObject(Casedetails.class)] Urgent Need

    In bean Class I am calling delegator method and I am passing object of that bean itself to method.
    Delegator delegator=new Delegator();
    delegator.insertCase(this);
    In delegator I am calling to EJBSessionBean Method:
    public String insertCase(CaseDetailBean caseDetailBean){
    try {
    final Context context = getInitialContext();
    CaseSessionEJB caseSessionEJB = (CaseSessionEJB)context.lookup("CaseSessionEJB");
    // Call any of the Remote methods below to access the EJB
    // caseSessionEJB.mergeEntity( entity );
    caseSessionEJB.persistEntity(caseDetailBean);
    // caseSessionEJB.refreshEntity( entity );
    // caseSessionEJB.removeEntity( entity );
    System.out.println( caseSessionEJB.findAllTmojArchCasedetails( ) );
    } catch (Exception ex) {
    ex.printStackTrace();
    return null;
    and In EJBSessionBean Class I amusing this Method for inserting detail of case but in this uow.readObject(TmojArchCasedetails.class) I am getting null.
    public Object persistEntity(Object entity) {
    System.out.println(" Inside sessionEJB 111 ");
    CaseDetailBean dataBean=( CaseDetailBean)entity;
    System.out.println(" Inside sessionEJB we Got Sessionn factory " + sessionFactory);
    session = getSessionFactory().acquireSession();
    UnitOfWork uow = session.getActiveUnitOfWork();
    if (uow == null) {
    uow = getSessionFactory().acquireUnitOfWork();
    System.out.println(" CaseserialNo SessionBean 1"+dataBean.getCaseserialNo());
    System.out.println(" Inside sessionEJB we Got Sessionn factory read uow " +uow.readObject(TmojArchCasedetails.class) );
    TmojArchCasedetails employee = (TmojArchCasedetails) uow.readObject(TmojArchCasedetails.class);
    TmojArchCasedetails petClone = (TmojArchCasedetails) uow.registerObject(employee);
    petClone.setCCaseSerialNum(dataBean.getCaseserialNo());
    petClone.setCSysCaseNum(dataBean.getCaseserialNo());
    petClone.setCArchivalStatus(dataBean.getCasestatus());
    petClone.setCCaseCategory(dataBean.getCaseCategory());
    petClone.setCCaseCourtCd(dataBean.getCasecode());
    petClone.setCProceedingTypeCd(dataBean.getCaseserialNo());
    petClone.setCCaseYear(10);
    petClone.setCCaseStateCd(dataBean.getCasecode());
    petClone.setCCreatedBy(dataBean.getCreatedby());
    petClone.setCCreatedDt(dataBean.getRegdate());
    petClone.setCCaseRegDt(dataBean.getRegdate());
    WriteObjectQuery writeQuery = new WriteObjectQuery();
    writeQuery.setObject(petClone);
    session.executeQuery(writeQuery);
    return null;
    }

    Your code seems very confused.
    To persist an object you should access the activeUnitOfWork and either call registerObject, registerNewObject, or mergeClone.
    readObject(Class) will just return you the first instance of the class in the database, or null if the table is empty. Perhaps you mean to query an object with the same id as your dataBean. In this case use an Expression for the id, or create an instance of the TmojArchCasedetails, set the id and use the instance in the readObject(Object) call.
    Do not use the WriteObjectQuery, the UnitOfWork will write the object when it is committed (when the JTA transaction commits).
    -- James : http://www.eclipselink.org

  • Unable to load impl class error after WAR file rebuilt

    Hi
    I have the source code for a working WAR file. I wanted to make a small change to the code and rebuilt the WAR. Now the previous WAR version works but even when I rebuild the WAR from the unedited code I get the error "unable to load impl class"
    and ClassNotFoundException: Class bytes found but defineClass() failed for ...
    Does anyone know what kind of changes in my environment would cause this problem?
    Thanks
    J Armstrong

    This was caused by using jdk1.6.0_02 to compile the java files where jdk1.50_06 was required

  • Accessing Managed Bean Variables in Entity Impl Class

    How can I access managed bean variables in the entity Impl class .
    While inserting a new record in DB , i want to set few entity properties values . The values of those properties are available in the managed bean .
    How can i access those values from Managed Bean and set them the entity Impl class to override the create method.
    Or is there any better recommended approaches ?
    Jdev - 11.1.1.5

    >
    While inserting a new record in DB , i want to set few entity properties values .
    >
    you can user CreateWithparams
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/13-create-with-params-169140.pdf
    http://andrejusb.blogspot.com/2011/02/createwithparams-operation-for-oracle.html

  • Calling Stored Procedure outside of ADF BC 'impl' classes

    Hello
    What is the best way to execute a Stored Procedure outside of the ADF BC 'impl' classes?
    I have a java class that performs batch inserts (using view objects). I am looking for a way to call a Stored Proc from here (How can I get a handle to the getDBTransaction() or is there another way to call the createCallableStatement()?
    Thanks for your help!

    Hi,
    you should be able to get a reference to the AM via your view objects. getDBTransaction is a public method so you should be able to call it from your class.
    You could also consider creating a method to call the stored procedure within your AM which you then expose and call from your java class via the AM's client interface. This would better encapsulate your business process.
    Brenden

  • How to call a method in IMPL class from one context node

    Hi, I´ve been only study the posibility to access a method in the IMPL class  from one context node class...CN## without using events, is there a way to call it ??? I don´t have it as requierement just learning thanks !.

    Hi,
    Try this by following this you can get the custom controller instacne in the view context nodes, for your requirement you can keep the view implementation class instance instead of cuco..
    To get the custom controller instance in Context node getter/setter method:
    1. Declare Cuco instance reference variable in ctxt class..
    2. Set this cuco ref. in the Create context node method of ctxt class:
    try.
    gr_cucoadminh ?= owner->get_custom_controller( 'ICCMP_BTSHEAD/cucoadminh' ). "#EC NOTEXT
    catch cx_root.
    endtry.
    you can avoid this step as this is not needed in case of view isntance
    3. Assign this instance to the respective context node Create method using:
    BTStatusH->gr_cuco ?= gr_cucoadminh.  " here assign the view implementation ref. " me" instead of gr_cucoadminh
    Here gr_cuco is the ref. variable of custom controller in the respective context node for eg. BtstatusH
    Sample implementation of this can be found in
    ICCMP_BTSHEAD/BTSHeader ->context node BTACTIVITYH-> attr ->GR_CUCO(instance of cuco)
    Cheers,
    Sumit Mittal

  • Global Attribute Usage in IMPL class

    Hi,
    Can I declare an attirbute in the IMPL class and use it in two different context nodes of the same component?
    Actually, my requirement is to retrieve the value of an attribute in CN1 and use it in the GET_I_ method of an attribute in CN2.
    The approach that I'm following is to retrieve the value of attib1, pass it into the global attribute, and then use this global attribute in GET_I_ method of attrib2 in CN2.
    Is this feasible?
    Any pointers to this would be highly appreciated.
    TIA.
    Regards,
    Richa

    Your approach is feasible !
    Thanks
    Allot points if this helps!

  • Instance of IMPL class in custom controller

    Hi,
    I have a requirement where i need a instance of view controller class(impl) in custom controller class. When i am trying to create an instance attribute of impl class in cuco and trying to use in one of the cuco methods  then it is not getting initialized. Let me know how to do achieve this.
    Thanks a lot.
    Regards,
    Lisha

    Hi Lisha,
    This would be because the corresponding view is in viewset which in turn is in the window.
    In that case you will have to drill down the viewset and then get the view.
    Sample code :
    DATA:
        lr_window TYPE REF TO cl_bsp_wd_window,
        lr_viewset      TYPE REF TO cl_bsp_wd_view_controller,
        lr_bpexcp_view         TYPE REF TO CL_BP_EXCEP_BPEXCPTNRESUL_IMPL.
    lr_window ?= me->get_subcontroller_by_viewname( 'BPExceptionSearch.MainWindow' ).
      if  lr_window IS BOUND.
        lr_viewset ?= lr_window->get_subcontroller_by_viewname( 'BP_EXCEPTION/BPExcptnSearchViewSet' ).
        if lr_viewset IS BOUND.
          lr_bpexcp_view  ?= lr_viewset->get_subcontroller_by_viewname( 'BP_EXCEPTION/BPExcptnResult' ).
          if lr_bpexcp_view  IS BOUND.
            TRY.
                lr_bpexcp_view->GV_IS_NEW_CONTRACT = ABAP_TRUE. "#EC NOTEXT
              CATCH cx_sy_dyn_call_error.
                RETURN.
            ENDTRY.
          endif.
        endif.
      endif.
    Regards
    Leon
    Edited by: Leon Limson on Jan 10, 2012 4:54 PM

  • Session becoming NULL

    I am working on struts application.
    When we restart Tomcat, it's working fine.
    After few days, session becoming null in particular area of the application. Otherthan that area, application is working fine. If we restart Tomcat, then it's works fine.
    There is no problem with database (MySQL). Previously, we started db with max_allowed_packets=50M as default.
    struts-config.xml contains the following content:
    <data-sources>
          <data-source key = "jdbc/RFS">
             <set-property property = "password" value = "rfs" />
             <set-property property = "minCount" value = "1" />
             <set-property property = "maxCount" value = "50" />
             <set-property property = "user" value = "rfs" />
             <set-property property = "driverClass" value = "com.mysql.jdbc.Driver" />
             <set-property property = "description" value = "" />
             <set-property property = "url" value = "jdbc:mysql://172.23.7.64:3306/rfs" />
             <set-property property = "readOnly" value = "false" />
             <set-property property = "autoCommit" value = "true" />
             <set-property property = "loginTimeout" value = "" />
          </data-source>
          </data-sources>Please let me know the usage of loginTimeout.

    Hi,
    Session Create Code in Login file
    HttpSession hs = req.getSession( true );
    hs.setAttribute( "user", lb.getUsername() ); // username() is ur unique id
    Session Tracking code in all file
                   HttpSession hs=request.getSession();
                   if ( hs == null || hs.getAttribute( "user" ) == null )
                        response.sendRedirect ( "./index.jsp" );
    Logout code
    HttpSession hs=req.getSession(false);
                   hs.setAttribute( "user", null );
                   hs.invalidate();
                   res.sendRedirect ( "./index.jsp" );
    // I hope this snippet will help u..

  • Overriding VO Impl class methods to populate parent-child VO

    Hi All,
    I need to populate parent child VOs by giving webservice calls from respective impl classes.
    Scenario : Lets say suppose i have 2 VOs as DepartmentVO and Employee VO with a viewLink on departmentId. Taking a particular instance, in Department table there are 2 rows and for each parent row we have 2 child rows in Employee.
    Webservice Structure : I have a parent Object and inside that parent object i have list of child objects
    e.g : public class DepartmentDTO{
    private List<EmployeeDTO> employeeList;
    After that i have extended Impl classes for both VOs and overriden method i.e. "executeQueryForCollection" to give a webservice call and get back response of DepartmentDTO[] with List<EmployeeDTO> inside it.
    In DepartmenntVOImpl class i have overriden "createRowFromResultSet" which populates the parent VO with the number of parent records returned from webservice.
    Code for Department impl class is :
    protected ViewRowImpl createRowFromResultSet(Object qc,
    ResultSet resultSet) {
    Iterator deptIter= getPackageClassIterator(qc);
    ViewRowImpl r = createNewRowForCollection(qc);
    DepartmentDTO curDTO = (DepartmentDTO )deptIter.next();
    populateAttributeForRow(r,
    findAttributeDef("DeptId").getIndex(),
    curDTO.geDeptId() );
    populateAttributeForRow(r,
    findAttributeDef("DeptName").getIndex(),
    curDTO.getDeptName() );
    return r;
    Similarly i have overridden "createRowFromResultSet" method in EmployeeVOImpl to populate the child VO(this need to be populated from the list object inside parent object reponse)
    Code as follows :
    protected ViewRowImpl createRowFromResultSet(Object qc,
    ResultSet resultSet) {
    Iterator empItr= getPackageClassIterator(qc);
    ViewRowImpl r = createNewRowForCollection(qc);
    DepartmentDTO curDTO1 = (DepartmentDTO )empItr.next();
    List<EmployeeDTO> list = curDTO1.getEmployeesList();
    for (EmployeeDTO curDTO : list) {
    populateAttributeForRow(r,
    findAttributeDef("EmpId").getIndex(),
    curDTO.getEmpId());
    populateAttributeForRow(r,
    findAttributeDef("EmpName").getIndex(),
    curDTO.getEmpName() );
    populateAttributeForRow(r,
    findAttributeDef("EmpLastName").getIndex(),
    curDTO.getEmpLastName() );
    populateAttributeForRow(r,
    findAttributeDef("DeptId").getIndex(),
    curDTO.getDeptId());
    return r;
    Though the code looks simple and correct but the child records are not getting populated correctly. Am not sure if the code implementation to populate parent child VOs from webservcie is correct or not.
    Would appreciate for Help or valuable Suggestions.
    -Sanjeeb

    Hi Ray,
    Go for custom BADIs in this case. In fact, that is exactly the functionality you are looking for !
    Just go through this excellent five part blog on Enhancement framework by Thomas Weiss.
    What the New Enhancement Framework Is For – Its Basic Structure and Elements For Beginners
    The new Enhancement Framework Part 2 - What Else You Need to Know Before Building an Enhancement
    How To Define a New BAdI Within the Enhancement Framework - Part 3 of the Series
    How to implement a BAdI And How to Use a Filter - Part 4 of the Series on the New Enhancement Framework
    Source Code Enhancements - Part 5 of the Series on the New Enhancement Framework
    Cheers,
    Mahesh

  • Get Object Type in Impl-Class

    Hi Experts,
    I have the requirement to show a warning that the user shall maintain a Partner "Enduser" in the Assignmentblock "Partners" when creating an Opportunity. The code for the warning is implemented in the Impl-Class of the View BTPARTNER/Partner (my Assignmentblock "Partners"). The problem is, that the Assignment Block  is also used in other Scenarios, but the Waring shall only appear in the Opportunity View.
    How can I check the current Scenario? I thought of getting the Object Type BT111_OPPT and check it.
    Anyone know how to get the Object Type or any other solution for the problem?
    Thanks and regards,
    Sebastian

    Hi,
    I think using the Object_type to display warning message in your case is fine and it should work. Now as you are looking how to get object_type here..my suggestion would be  in View BTPARTNER/Partner  you have a context node called 'BTPartnerSet' after getting the current entity (by using get_current() ) you can get the parent which would be BTAdminH and in this entity you have object_type as a attribute so you can easily call get_property or get_property_by_string () and can put your check.
    Regards
    Ajay

  • Accessing impl class attribute

    Hi Experts,
    if i declare one variable in controller class of a view and how can access the variable in contex naode .

    Hi srinivas.yangal,
    You can access the View implementation Class Attributes in Context.
    1] Go to Context Node Implementation Class
    2] Create a attribute GV_VIEW_CONTROLLER in Impl class of Context Node.
    DATA : GV_VIEW_CONTROLLER TYPE REF TO CL_BSP_WD_VIEW_CONTROLLER .
    3] Go to INIT method of Context Node.
    4] Assign instance LV_VIEW_CONTROLLER to GV_VIEW_CONTROLLER of Context Node Impl. Class.
    GV_VIEW_CONTROLLER = LV_VIEW_CONTROLLER.
    Then you can access your Instance attributes defined in View Impl. class inside the context node through GV_VIEW_CONTROLLER attribute as follows.
    ABC = GV_VIEW_CONTROLLER->XYZ.
    Reward points if useful.
    Kind Regards,
    Dhananjay.
    Edited by: Dhananjay SAP CRM on Nov 24, 2011 12:56 PM

  • Gettting the session value in doDML() of Impl.java

    I'm using ADF BC, struts, JSP.
    I have the logged in user in my session variable and I want to store that in the database in the timestampfields.
    I am 'overriding' doDML' method in my Impl.java. In the 'insert' operation, I want to get the session value. How do you do that. I tried setCreatedBy(session.getAttribute("user")), but it says HttpSession object/class not found.
    How do you get the session value in your Impl.java.
    Thanks.

    Hi,
    You don't need to add any library or overwrite prepareSession() method. You may add values to BC session in any time and in any method in business components e.g in Application Module:
    private void addToMySession(Integer currUser){
    Hashtable userdata = getDBTransaction().getSession().getUserData();
    if (userdata == null) {
    userdata = new Hashtable();
    userdata.put("CurrentUser", currUser);
    Then you may get this value in any businnes component e.g. in EO:
    protected void doDML(int operation, TransactionEvent e) {
    if (operation == DML_INSERT) {
    Hashtable userdata = getDBTransaction().getSession().getUserData();
    Integer currUser = userdata.get("CurrentUser");
    setUserId(currUser);
    super.doDML(operation, e);
    I hope that explained clearly :) and it helps.
    Regards
    Kuba

  • Values from a jsp page are null in an Action class

    hi, i am working on an application...i have a jsp page with several inputs (type=text) and when a submit the form to to my action class all values received are null.
    Here is a part of code:
    the jsp file: letter.jsp
    <form target="_self" action="/Test/editLetter.do" name="letterTF">
    <table>
    <tbody>
    <tr>
    <th>
    No of objects
    </th>
    <th>
    Weight
    </th>
    <th>
    Description
    </th>
    </tr>
    <tr>
    <td>
    Package
    <input name="package" id="package" type="checkbox">
    </td>
    <td>
    <input name="package_No" type="text" value="<%=currentBean.getPackageNo() %>"> <%-- from session...have to edit some date from a data base--%>
    </td>
    <td>
    <input name="package_weight" type="text" value="<%=currentBean.geWeight()%>">
    </td>
    <td>
    <input name="description" type="text" value="<%=currentBean.Description()%>"
    </td></tr>
    <tr>
    ..................................................... <%-- It's a big form --%>
    </tr>
    <tr>
    <input type="submit" name="send" value="Send">
    </tr>
    </tbody>
    </table>
    </form>
    struts-config.xml:
    <form-bean
    name="letterTF"
    type="Test.LetterForm">
    </form-bean>
    <action path="/editLetter"
    type="Test.LetterAction"
    name="scrisoareTF"
    input="/letter.jsp"
    scope="request"
    validate="false">
    <forward name="success" path="/index_orders.jsp"/>
    </action>
    The ActionForm class:
    public class LetterForm extends ActionForm{
    private String package;
    private String package_No;
    private String package_weight;
    public void setPackage(String package){
    this.package = package
    public String getPackage(){
    return package;
    The action class:
    public class LetterAction extends Action{
    public ActionForward execute(
    ActionMapping mapping,
    ActionForm form,
    HttpServletRequest request,
    HttpServletResponse response)
    throws Exception{
    String package;
    String package_No;
    String package_weight;
    LetterForm letterTF = (LetterForm) form;
    package = letterTF.getPackage();
    package_No = letterTF.getPackageNo()
    package_weight = letterTF.getPackageWeight();
    System.out.println("Package: "+package);//it will print Package: null
    System.out.println("Weight: "+weight);//it will print Weight: null
    System.out.println("Description "+description) //it will print Description: null
    As I observed its not making the set methods from LetterForm.java
    I am dealing with this bug for a couple of days an i didn't managed to break it. If anyone has an idea or a solution would he be so kind to share it with me
    Thanks in advance,
    David

    Basically your form beans are the place holders or containers for your jsp attributes. It has to be mapped in such a way that when the form is submitted the user entered values get populated on to your form bean.
    For Eg:
    JSP
    <html:form action="accountSearchResults.do">
    <html:text property="myName" size="15"/>
    //USE ONLY STRUTS TAGS IN JSP's. U CAN REFER TO
    //http://struts.apache.org/1.x/struts-taglib/tlddoc/index.html
    //THE PROPERTY NAME "myName" SHOULD BE DEFINED IN
    //YOUR FORMBEAN WITH getMyName AND setMyName
    //METHODS DEFINED
    </html:form>
    struts-config.xml
    <form-beans>
         <form-bean name="addEditAccount" type="org.apache.struts.validator.LazyValidatorForm">
              <form-property name="myName" type="java.lang.String">
              </form-property>
         </form-bean>
    </form-beans>
    <action-mappings>
         <action path="/accountSearchResults" type="com.zzz.AccountSearchResultAction" name="addEditAccount" scope="request">
              <forward name="success" path="NextPage.jsp">
              </forward>
         </action>
    </action-mappings>
    Action Class
    Since we have defined the form bean as a lazyvalidator instance you can use:
    PropertyUtils.copyProperties(targetBean, form);to fetch the values entered by the user. Try to use struts tags in your jsp's and map the properties to your form bean variables. Hope that helps.
    SirG

Maybe you are looking for

  • How Do I Create a Screen Saver That Uses Shared Photos??

    I have a pretty simple request here, or at least I think it should be pretty simple. My family uses a shared photo stream so that we can all see what everybody is up to without sending a bunch of individual messages. I'm going to use a screen saver t

  • Connecting ipod touch to talktalk wifi connection

    I know there's lots of questions around connection to wifi but I still can't get my ipod touch connected. I tried several times and typed in the password for the network when asked but keep getting an unable to join message. I am typing in the correc

  • 11" MBA - want to point iTunes to EX HD

    I just purchased an 11" MBA and am trying to point iTunes to a collection of music files stored on an external hard drive but have not been successful after trying a few tips found on the internet.  I have never stored music files on the MBA HD.  Any

  • Directory proxy virtual transformation - help

    I have a web app that queries Active Directory for user authentication based on a users DN. (DN: cn=First Last,ou=. . . in my case.) It assumes a flat directory such that users are in a single user container: OU=Users,dc=ad,dc=domain,dc=com This prev

  • What does the "Develop" do in the menu bar in Safari

    Just upgraded to Mountain Lion - trying to get to grips with the Develop tag in the Menu bar? only found it under preferences in Safari when trying to remove cashe - can anyone give me an idea where I can get more information on the use of the "Devel