How to rebind a bean object programmatically in EJB 3.0

hi,
There is a bean object (EJB 3.0) which i want to rebind. How can I do it through another application running under same netweaver server.
For eg, 
      one session bean object is bound to "java:comp/env/Converter" jndi name by one application. Here, i need to modify this object and rebind to the same jndi name. so i used as follows,
   context.rebind("java:comp/env/converter", beanobj );
   //'beanobj' is the modified bean (modified attribute's value)
it was bound successfully, but when i look up the bean object, i got the ClassCastException,
like "java.lang.ClassCastException : $Proxy5_1001 at ......"
can anybody help me?
regards,
Panneer.

@Vladimir Pavlov
I did not understand what you are trying to convey...
Whenever an attribute of this bean is modified we want to access that latest value.... Is there any way to know, when the attribute is modified? Just with get/set we can not know, when it is modified... am i right?
We want to achieve this without modifying the existing source code of the EJB....
@ Ivo Simeonov
As of my knowledge, to use interceptors we need to modify the EJB source code, but we do not want to touch the source code....
All this has to be achieved dynamically when the application is deployed in the production.... is it possible???

Similar Messages

  • How to use bean objects in java script

    function insertRow()
              var row=1;
              var tbl = document.all("TAU");
         var tr = tbl.rows(row);
         var td = tr.cells(0);
         var td2 = tr.cells(1);
         var td3 = tr.cells(2);
         row++;
         tr = tbl.insertRow();
         tr.setAttribute(false);
         td = tr.insertCell();
         td2 = tr.insertCell();
         td3 = tr.insertCell();
         td.innerHTML = "<html:text property='unit' value ='02' />";
         td2.innerHTML = "<html:text property='unit Id' />" ;
         td3.innerHTML = "<html:text property='unit Type' />" ;
    this is my code, it is basicaly add row at run time thru java scripts. i want to set property of beans with this script , in this code i foun error ie. "can not found bean in nay scope" so plz anybody can tell me how can i pass bean object to java script !!!!!!

    mmmh i'm not understanding so much....
    well... as i told before i'm working in oracle database environment and i'm developing a java procedure.
    now, i have this object
    CREATE OR REPLACE
    TYPE REPORT.FATTURA_OBJ AS OBJECT (
    POD VARCHAR2(1000),
    ID_FATTURA NUMBER,
    ID_FILE NUMBER,
    COERENZA_EA_F VARCHAR2(1000),
    COERENZA_ER_F VARCHAR2(1000),
    COERENZA_EA_M VARCHAR2(1000),
    COERENZA_EF_M VARCHAR2(1000),
    ANOMALIA VARCHAR2(1000),
    MOTIVO_INVALIDAZIONE VARCHAR2(1000),
    MATRICOLA_CONTATORE VARCHAR2(1000),
    POTENZA_DISPONIBILE VARCHAR2(1000),
    MEMBER PROCEDURE pulisci
    /and i need to work with it inside this procedure:
    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED REPORT."Manage_Excel_ASMBS" AS
    import java.io.*;
    import java.io.IOException;
    import java.io.StringWriter;
    public class Manage_Excel_ASMBS
    public static void read_Excel(String inputFile,int var_Id_Caricamento, int var_Id_Distributore, String var_Distributore) throws SQLException, IOException
              **here i need to put what i'm reading inside the excel file into oracle objects**
    /can you please give me a sample ?
    thanks

  • How to display List of objects in jsp?

    Hi,
    I have a list containing Collection of bean objects.
    Now I want to display the values in the list of objects in a jsp using JSTL.
    Any body help me how to retrieve the bean objects from the List and how can i display that values in the jsp.
    Advanced Thanks,
    Mahendra

    Have you tried to use <:forEach></c:forEach> tag available in jstl?

  • Invoking COM objects from Weblogic EJB

    Hi,
    I am searching the BEA site on how best to call COM objects from
    a EJB deployed in Weblogic. I find rmi over iiop, articles on ObjectBridge
    which are confusing. Is there a sample where a COM method is called
    from EJB server ( I only see example the other way round)
    Thanks,
    Harish.

    http://www.weblogic.com/docs51/examples/com/examples.com.ServerSideDLLClient.html
    This shows use the WebLogic COM compiler to generate and RMI wrapper
    around a COM DLL and invoking it remotely. Unfortunately, the example
    appears to be a little out-of-date (e.g., it is using the old RMI Naming
    style of doing the lookup)...
    Be forewarned, WebLogic COM is not supported in WebLogic 6.0 (due to the
    inavailability of a Microsoft 1.3 JVM implementation).
    Harish wrote:
    JIntegra is fine, but I want to know if anybody tried WebLogic-COM.
    (Is this the right forum?)
    Actually I tried out the 'beeper' sample but still have many doubts.
    Robert Patrick <[email protected]> wrote:
    JIntegra by Linar (http://www.linar.com).
    Harish wrote:
    Hi,
    I am searching the BEA site on how best to call COMobjects from
    a EJB deployed in Weblogic. I find rmi over iiop, articleson ObjectBridge
    which are confusing. Is there a sample where a COM methodis called
    from EJB server ( I only see example the other way round)
    Thanks,
    Harish.

  • How to construct a new complete view object programmatically

    HI,
    I want to construct a new complete view object programmatically. I have a result set based on the rows returned from this query i need to build the new vo and show it n a form. Please tell me the complete procedure to do this or else provide me any links.
    Thanks
    Satya

    Hi,
    have a look how dynamic tables are created (using af:forEach to iterate the attribute Defs for generating columns). Your approach is similar except that you not only need to know about attributes but also the rows to fecth
    1. create a tree binding for the view object
    2. create the binding with one hierarchy
    3. ensure all attributes are deleted for the tree binding (you do this manually in the PageDef)
    4. when executing the query for a new SQL, call clearForRecreate() on the DCIteratorBinding instance
    5. On the page, use af:forEach to create the form fields and labels for each row. Like for dynamic tables, you first need to determine the attributes to render (its a nested loop you are going for
    6. Updates of the form fields must be through a managed bean
    Frank

  • How to get the UserTransaction object in  stateless session bean

    Hi, I am using jboss server and jdk5 version and using EJB.
    My Application flow :
    JSP à Action(Struts) à Service Locator à Session bean à Entity Bean(cmp) à DB.
    I tried to get the UserTransaction object in my Action. Its my code.
    InitialContext ctx = new InitialContext();
    UserTransaction uTrans = (UserTransaction) ctx.lookup("java:comp/UserTransaction");
    After used uTrans.begin(),uTrans.commit() and uTrans. rollback () also.
    Its working fine .
    But, I used the the same code inside in my session bean its not working.
    Stateless Session Manager Bean code :
    public class SampleManagerBean implements SessionBean {
    public void ejbCreate() throws CreateException {  }
    public void ejbRemove() {  }
    public void ejbActivate() {   }
    public void ejbPassivate() {   }
    public void setSessionContext(SessionContext sessionContext) {
    this.sessionContext = sessionContext;
         public void createSample() throws EJBException
         try{
                   InitialContext ctx = new InitialContext();
                   UserTransaction ut = (UserTransaction) ctx.lookup("java:comp/UserTransaction");
              }catch(Exception e) {
              System.out.println(“ Exception === > “+e)
    Its throws the error ie: javax.naming.NameNotFoundException: UserTransaction not bound
    How to get the UserTransaction object in my session bean. Kindly give solution the above errors.
    - Thendral

    first of all, you could just use sessionContext.getUserTransaction(). however, that would only work if your bean is using bean-managed transactions. the default is container-managed transaction, in which case you cannot get a UserTransaction object. if you want to manage transactions, you need to add the TransactionManagementType.BEAN annotation to your ejb.

  • How to set different view parameter programmatically in the same task flow

    Hello everyone,
    I have a view activity A that calls another view activity B with a link. In this link the action is set to a method (I use JSFUtils class: http://jdeveloper-adf.googlecode.com/svn/trunk/TGPrototype2/ViewController/src/com/tgslc/defaultManagement/utils/JSFUtils.java):
    public String goToB() {
    String paramToPass = "someParameterTakenInSomeWay";
    JSFUtils.setExpressionValue("#{pathToViewB_pageBPageDef.paramName}",paramToPass);
    return "openActivityB";
    where openActivityB is the control flow case to call B.
    In the B pageDef file I have set a parameter "paramName" without any value:
    <?xml version="1.0" encoding="UTF-8" ?>
    <pageDefinition xmlns="http://xmlns.oracle.com/adfm/uimodel"
    version="11.1.1.59.23" id="pageBPageDef">
    <parameters>
    <parameter id="paramName"
    value=""/>
    </parameters>
    <executables/>
    <bindings/>
    </pageDefinition>
    But at running time I have a oracle.jbo.expr.JIEvalException:
    JBO-25077: Name paramName not found in the specified object: pathToViewB_pageBPageDef.
    The question is: how can I set the parameter programmatically from the view activity A?
    Note that I use this method to set the parameter because in the real application I have many "view activity A" that will call B, but all of these have to set this parameter.
    I use JDeveloper 11.1.1.4.
    Thanks in advance,
    Baduel

    Hi,
    this is because PageDef B represents a binding container that is not active to the time you try to call it. The binding container becomes available when navigating to the page but not before. Instead:
    1. define a managed bean in pageFlowScope and expose a setter/getter method to hold the value to pass on
    2. Reference the managed bean in pageFlowScope from the attributebinding NDValue property using EL
    3. Set the managed bean value before navigating to view B
    Frank

  • How to update ADF VO object to refresh the data in ADF Pivot table

    I need to know how to update the View object so that the date in pivot table is refreshed/updated/filtered.
    here are the steps I performed to create ADF pivot table application using VO at design time.
    1) created a collection in a Data Control (ViewObject in an ApplicationModule) that provides the values I wanted to use for row and column labels as well the cell values (Used the SQL query)
    2) Dragged this collection to the page in which wanted to create the pivot table
    3) In the pivot table data binding editor specified the characteristics of the rows (which attribute(s) should be displayed in header), the columns (likewise) and the cells.
    Now, I have a requirement to update/filter the data in pivot table on click of check box and my question is how to I update the View object so that the date in pivot table is refreshed/updated/filtered.
    I have got this solution from one of the contact in which a WHERE clause on an underlying VO is updated based upon input from a Slider control. In essence, the value of the control is sent to a backing bean, and then the backing bean uses this input to call the "filterVO" method on the corresponding AppModule:
    but, I'm getting "operationBinding" object as NULL in following code. Please let me know what's wrong.
    here is the code
    Our slider component will look like
    <af:selectBooleanCheckbox label="Unit" value="#{PivotTableBean.dataValue}"
    autoSubmit="true" />
    The setDataValue() method in the backing bean will get a handle to AM and will execute the "filterVO" method in that, which takes the NumberRange as the input parameter.
    public void setDataValue(boolean value) {
    DataValue = value;
    BindingContainer bindings = getBindings();
    OperationBinding operationBinding = (OperationBinding)bindings.getOperationBinding("filterVO");
    Object result = operationBinding.execute();
    The filterVO method in the AMImpl.java will get the true or false and set the where Clause for the VO query to show values.
    public void filterVO(boolean value) {
    if (value != null) {
    ViewObjectImpl ibVO = getVO1();
    ibVO.setWhereClause("PRODUCT_TOTAL_REVENUE(+) where rownum < 10");
    ibVO.executeQuery();
    }

    Did you define a filterVO action in your pagedef.xml file?
    You might want to read on how to access service method from a JSF Web Application in the ADF Developer Guide for 10.1.3 chapter 8.5

  • How do I display AS3 Object in only one state?

    I created a AS3 object from a SWFLoader class as an animation, which I then place in a Flex stage.  I need to display the object programmatically in only one state but there is no "includeIn()" method to include it in just one state.
    Right now, it is showing up on all of the flex states.  I add this object at different times and positions in the state.  Everything is fine except it displays in all the states.
    How do I display a AS3 object in only one state?
    Thank you.

    When i use visible property as you suggested, it works, but only on one object.  I am generating more than one of these objects, so there could be 3 or 4, etc of these objects displaying concurrently at different x y positions in the state.
    Is there a way to grab all of the objects created by this AS3 class at once and apply the visible property?
    thanx

  • How do you create beans using NetBeans 5.5?

    I am referring to http://java.sun.com/docs/books/tutorial/javabeans/nb/index.html and I'm sorry but I can't follow any of this!
    I have NetBeans IDE 5.5 and I am trying to learn how to write beans using NetBeans, and the lessons involve things I can't find or understand, for example:
    re: http://java.sun.com/docs/books/tutorial/javabeans/writingbean/index.html
    <blockquote>
    Load the JAR file. Use the NetBeans IDE GUI Builder to load the jar file as follows:
    1. Start NetBeans.
    2. From the File menu select "New Project" to create a new application for your bean. You can use "Open Project" to add your bean to an existing application.
    3. Create a new application using the New Project Wizard.
    4. Select a newly created project in the List of Projects, expand the Source Packages node, and select the Default Package element.
    5. Click the right mouse button and select New|JFrameForm from the pop-up menu.
    6. Select the newly created Form node in the Project Tree. A blank form opens in the GUI Builder view of an Editor tab.
    7. Open the Palette Manager for Swing/AWT components by selecting Palette Manager in the Tools menu.
    8. In the Palette Manager window select the beans components in the Palette tree and press the "Add from JAR" button.
    9. Specify a location for your SimpleBean JAR file and follow the Add from JAR Wizard instructions.
    10. Select the Palette and Properties options from the Windows menu.
    11. Expand the beans group in the Palette window. The SimpleBean object appears. Drag the SimpleBean object to the GUI Builder panel.
    </blockquote>
    Sorry, you lost me literally after "Start NetBeans", the rest is Hungarian. I can't find "New Project Wizard"; I can't find "List of Projects", I can't find anything they are talking about nor do I know if any of this is relevant toward my learning how to write beans.
    Re: http://java.sun.com/docs/books/tutorial/javabeans/properties/properties.html
    "Inspecting Properties" seems impossible to do because the Inspector Window only shows a closed folder and nothing else ever. I can't figure out this part of the tutorial either.
    Can someone please explain this 3rd-grade-level to me: How to create a bean using NetBeans?
    Thanx
    Phil

    Phil,
    Before you embark on another very frustrating advanture using NetBeans, please go t hrough the NetBeans tutorial. The "New Project Wizard" is just select from the menu options -- "New Project". The "Hungarian" as you put it will not get better until you spend some time learning NetBeans. Learning something new, like beans, is frustrating enough, but to try to do it and use a tool that is not familiar may be beyond many individuals frustration level.
    Les

  • How to display 'List' of objects in table format

    I am trying to display bunch of records in the table format.
    I have the List of bean object populated with table datas.
    Currently the code is working fine ,if I tend to display one record.I am wondering how to display all the records.
    I know theres a 'Fieldloop'.If thats the one please explain with example.

    iterate the object list using field loop. eg. is given below
    [      <Field name='MatchTable'>
    <Display class='SimpleTable'>
    <Property name='columns'>
    <List>
    <String>title</String>
    </List>
    </Property>
    </Display>
         <FieldLoop for='name' in='userlist'>
    <Field name='username'>
    <Display class='Label'>
    <Property name='labels'>
    <ref>name</ref>
    </Property>
    </Display>
    </Field>
         <FieldLoop>
         </Field>

  • ADF Faces: RichTable - How to create a RichTable object

    Hi. How to create a RichTable object to put in a JSF page ? I need to make a method that receive a list of name of columns and a list of list of data. This code that I have writing don't work. What's my error?
            public RichTable getADFTable(
            List<String> lstCols, List< List<String> > lstLstData
            RichColumn adfCol = null;
            List<RichColumn> lstRichCols = new ArrayList<RichColumn>();
            int cont = 0;
            for( String col : lstCols ){
                adfCol = new RichColumn();
                adfCol.setDisplayIndex(cont++);
                adfCol.setHeaderText( col );
                adfCol.setMinimumWidth( "60" );
                lstRichCols.add( adfCol );
            int contCols = 0;
            RichOutputText text = null;
            RichTable AdfTab = new RichTable();
            for( List<String> lstData : lstLstData){
                for( String data : lstData ){
                    text = new RichOutputText();
                    text.setValue(data);
                    lstRichCols.get( contCols ).getChildren().add( text );
                    contCols++;
                contCols = 0;
            AdfTab.setRows(this.lstEntit.size());
            cont = 0;
            for( RichColumn col : lstRichCols ){
                AdfTab.getChildren().add( col );
            return AdfTab;
        }

    I was searching for an example and i found it but whit errors, finally i fixed and it works.
    You just have to generate the data from your webservices and "put" into this structure.
    The java file (Bean)
    package view;
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.List;
    import java.util.Map;
    import org.apache.myfaces.trinidad.model.CollectionModel;
    import org.apache.myfaces.trinidad.model.SortableModel;
    public class DynamicTable {
        private SortableModel model;
        private List<String> columnNames;
        public DynamicTable() {
            columnNames = new ArrayList<String>();
            columnNames.add("Col-1");
            columnNames.add("Col-2");
            generateColumnModel();
        public void generateColumnModel() {
            this.model = new SortableModel(createRows(columnNames));
        private List<Map> createRows(List<String> columnNames) {
            int i = 0;
            List<Map> mapListforRows = new ArrayList<Map>();
            for (String name : columnNames) {
                Map newRow = new HashMap();
                mapListforRows.add(newRow);
                for (String col : columnNames) {
                    newRow.put(col, "data");
            return mapListforRows;
        // Get table model
        public CollectionModel getCollectionModel() {
            return model;
        public void setColumnNames(List<String> columnNames) {
            this.columnNames = columnNames;
        public List<String> getColumnNames() {
            return columnNames;
    }The jspx file (page)
               <af:table varStatus="rowStat" summary="table"
                            value="#{pageFlowScope.DynamicTable.collectionModel}"
                            rows="#{pageFlowScope.DynamicTable.collectionModel.rowCount}"
                            rowSelection="none" contentDelivery="immediate"
                            var="row" rendered="true" id="t1">
                    <af:forEach items="#{pageFlowScope.DynamicTable.columnNames}"
                                var="name">
                      <af:column sortable="true" sortProperty="#{name}"
                                 rowHeader="unstyled" headerText="#{name}"
                                 inlineStyle="width:100px;" id="c1">
                        <af:activeOutputText value="#{row[name]}" id="aot1"/>
                      </af:column>
                    </af:forEach>
                  </af:table>

  • How to call the bean in jspdyn component?

    Hi,
    i created  jspdyn component in that bean and bussiness logic class in NWDS.i created a method() in that businesslogic class.i called that method in bean class.i created both in same package,there is no error occur while creating the object of that class.but the bean class not recognize the business class method which i created. What is the cause? and also tell me how to call the bean in jsppage also.and also give me textfields,button and syntax of event handling in HTMLB,iam new to this area.so,give me one example step by step.

    Hi,
         Please check on these links for a good start.
    Java development methodologies (Part II)
    Bean usage in JSPDynPage
    jspDynPage portalapp.xml
    Regards,
    Harini S
    Please avoid giving personal mail id(s). That may prevent others from getting the same information when needed.

  • How to pass arraylist of object from action class to jsp and display in jsp

    I need to do the following using struts
    I have input jsp, action class and action form associated to that. In the action class I will generate the sql based on the input from jsp page/action form, create a result set. The result set is stored as java objects in a ArrayList object.
    Now I need to pass the arraylist object to another jsp to display. Can I put the ArrayList object in the request object and pass to the success page defined for the action? If this approach is not apprpriate, please let me know correct approach.
    if this method is okay, how can I access the objects from arraylist in jsp and display their property in jsp. This java object is a java bean ( getter and setter methods on it).
    ( need jsp code)
    Can I do like this:
    <% ArrayList objList = (ArrayList)request.getattribute("lookupdata"): %> in jsp
    (***I have done request.setattribute("lookupdata", arraylistobj); in action class. ***)
    Assuming the java object has two properties, can I do the following
    <% for (iint i=0. i<objList.size;I++){ %>
    <td> what should i do here to get the first property of the object </td>
    <td> what should i do here to get the first property of the object </td>
    <% }
    %>
    if this approach is not proper, how can I pass the list of objects and parse in jsp?
    I am not sure what will be the name of the object. I can find out how many are there but i am not sure I can find out the name
    thanks a lot

    Double post:
    http://forum.java.sun.com/thread.jspa?threadID=5233144&tstart=0

  • Encrypt xml bean object

    Hi Folks,
    can we encrypt and decrypt a xml bean object .
    i have a xml bean encoded file which contains all questions and now user need to take a exam ,problem here is user can see that xml file in text editor in readble format.
    Now how can i encrypt xml file and decrypt it back when application starts.
    Thanks in Advance

    lakshmiindia wrote:
    Hi Folks,
    can we encrypt and decrypt a xml bean object .
    i have a xml bean encoded file which contains all questions and now user need to take a exam ,problem here is user can see that xml file in text editor in readble format.
    Now how can i encrypt xml file and decrypt it back when application starts.
    You can't do this securely since any decryption key needed by the application must be available to the application and therefore easy to get at by a knowledgeable attacker. On this basis and since you have a fairly big learning curve to implement any encryption, why not simple Base64 encode the whole file. Easy for anyone in the know to decode but it might be good enough for a school/college/university project.

Maybe you are looking for

  • My Trash folder is no longer visible on mail sidebar

    Only my inbox is visible on the Mail sidebar.  I no longer can find by Trash, Juck, and Archive folders.

  • Map Request DTD has syntax-errors

    I checked the Map Request DTD with xmlspy and get syntax errors. The error positions are: <!ELEMENT jdbc_query (#PCDATA, hidden_info?)> <!ELEMENT legend column+ > <!ELEMENT column entry+ > Who can help me? From where can i get a correct Map Request D

  • How to update many tables using the same code

    <%@ page language = "java" import = "java.sql.*" %> <%@ page import = "java.sql.*" %> <%@ page import = "java.text.*" %> <% String custname1=request.getParameter("custname"); session.setAttribute("custname",custname1); String custtin1=request.getPara

  • Users with ensoniq samplers

    what is the deal with the count-off? i can't seem to get my sequencers to line up. i have started using the asr-10 a different way. using the sequencer on the asr-10 and then putting the audio into logic. i like this workflow for what i am doing, but

  • Same country different tax codes

    In Japan there are 2 company codes.One company code is using tax code V1=7%. The other company code is using tax code  V2=7%. Although the percentages are same the tax codes are different for the same country.Is there any option of maintaining this.