How to use a session bean in another session bean (or an EJB in a session)

JDev 11.1.1.4, WLS 10.3.4, Windows 7 x64
I have a login controller with a session-scoped bean that manages logins.
I have another session-scoped bean that manages menu security.
both modules compile and work fine now I need to share the data from one to another.
I need to reference the login controller in the menu security bean. How do I reference (include) the login bean in the security bean?
I tried an EJB - what a farce - these are supposed to be universal and easy ( basis of the oop in Java).
the bean is defined:
@Stateless(name = "SecurityEJB", mappedName = "ZITASApplication-ZITASModel-SecurityEJB")
I have tried :
ic = new InitialContext();
session = (SecurityEJBLocal)ic.lookup("ZITASApplication-ZITASModel-SecurityEJB#model.security.logic.SecurityEJB");
session = (SecurityEJBLocal)ic.lookup("ZITASApplication-ZITASModel-SecurityEJB#model.security.logic.SecurityEJBLocal");
session = (SecurityEJBLocal)ic.lookup("java:ejb/model.security.logic.SecurityEJB");
session = (SecurityEJBLocal)ic.lookup("java:ejb/SecurityEJB");
session = (SecurityEJBLocal)ic.lookup("java:app/SecurityEJB");
session = (SecurityEJBLocal)ic.lookup("java:module/SecurityEJB");
All return null pointers and claim the name cannot be resolved.
As you can see - I have found various claims to how to do this.
One way says create a sevlet, generate a listener and use the sevlet. Basically one for every EJB - a lot of work to use the EJBs
I would assume that this would be one of the easiest parts of java - as it is the foundation of re-usability and oop.
I can do either in the application - the added complexity of the EJB is less desirable - but better programming?

Hi,
ic.lookup("ZITASApplication-ZITASModel-SecurityEJB#model.security.logic.SecurityEJB");This should work with remote interface. If you want to lookup local interface, you need to register it in web.xml. Quote:
To access the business local interface you need to define ejb local references for your component environment (i.e. from your servlet environment). You can do this by defining references in your web.xml. For example:
<ejb-local-ref>
<ejb-ref-name>ejb/BusinessLogicBean</ejb-ref-name>
<local>packagename.BusinessLogicBean</local>
</ejb-local-ref>
To lookup your local reference from your servlet you need to use the following JNDI reference:
java:comp/env/ejb/BusinessLogicBean Another one
First, declare a local ejb reference in your web.xml file (This will add it to JNDI):
<ejb-local-ref>
<ejb-ref-name>ejb/Foo</ejb-ref-name>
<local>simple.ejb.FooLocal</local>
</ejb-local-ref>
Then it can be looked up from JNDI:
InitialContext ctx = new InitialContext();
FooLocal foo = ctx.lookup("java:comp/env/ejb/Foo");Hope this helps.
Pedja
Helpful links (judging from your first post, you are probably sick of these :) )
How to lookup local EJB in Oracle Weblogic 10.3
http://m-button.blogspot.com/2008/07/reminder-on-how-to-use-ejb3-with.html
http://www.coderanch.com/t/451012/EJB-JEE/java/EJB-Local-Lookup-not-working

Similar Messages

  • Document about how to use each BI Bean

    Anyone know whether there is any document on how to use each BI Beans besides Bean's javadoc?

    I would recommend downloading the latest BI10g samples from the BI Beans website. Click here for downloads, demos and documentation for BI Beans 10.1.2.0.0.
    For the graph there is a lot of really good information located on the Reports OTN page. This explains how to use many of the features of the BI Beans graph and contains some really good examples of how to format a graph.
    http://www.oracle.com/technology/products/reports/htdocs/faq/Graph_FAQ_with_style.html
    I would recommend reviewing the OU course on the BI Beans Query Model as this explains the basics of how to construct and manage queries:
    Oracle9i JDeveloper: Explore the BI Beans Query Model (Development Tools)
    http://education.oracle.com/pls/web_prod-plq-dad/show_desc.redirect?dc=D18655&p_org_id=1001&lang=US&source_call=
    The BI Beans query model supports powerful and flexible query techniques for analytic applications. This course explores this query model, both from an API perspective and a user interface perspective, with the goal of illustrating advanced query techniques for custom business intelligence applications.
    BI Beans 10g provides a lot of new features. We have a viewlet that explains in detail how to use one of the key new features: JSP list tags. This viewlet demonstrates a number of list tags, such as:
    * DimensionMember
    * CascadingDimensionMember
    * AWProgram
    * Navigation
    This viewlet can be viewed directly from the link on OTN:
    http://www.oracle.com/technology/products/bib/1012/viewlets/MS%20Developing%20Executive%20Insight.html
    There are OBEs posted on OTN:
    Develop Business Intelligence Objects using OracleBI Beans
    http://www.oracle.com/technology/obe/obe_bi/bibeans/bibeans_1012/developolapobjects/lessonlist.html
    Create business intelligence objects using BI Beans. These analytic objects, such as crosstabs, graphs, and calculations, can be used in either HTML-client or Java-client applications.
    Develop Business Intelligence Applications using OracleBI Beans
    http://www.oracle.com/technology/obe/obe_bi/bibeans/bibeans_1012/buildbibeansapps/lessonlist.html
    Create BI Beans HTML-client (JSP) applications and Java-client applications.
    For more information on using BI Beans graphs with non-OLAP data sources please refer to the following JDeveloper tutorial:
    Adding a BI Beans Graph in an ADF Business Components/JSP/Struts Application
    http://www.oracle.com/technology/obe/obe9051jdev/BIBeansOBE/BIBeansOBE.htm
    Hope this helps
    Oracle Business Intelligence Beans Product Management Team
    Oracle Corporation

  • How to use setters and getters in another program by using bean

    how to use the setters and getters methods using database connection by bean

    Say again?And so he did:
    http://forum.java.sun.com/thread.jspa?threadID=750645
    kind regards,
    Jos ;-)And again
    http://forum.java.sun.com/thread.jspa?threadID=750643&tstart=0
    No, that's his class mate I guess; it must be national getter and setter
    day somewhere today ;-)
    kind regards,
    Jos

  • How to use the same bean from Jsp and Servlet

    I want to use the same bean instance from both the servlet and jsp.
    for eg. if a create a bean using the jsp:useBean in servlet and if a modify some values, that values should be reflected while i access the same bean from the servlet. But instead of that the servlet is creating a new instance of the bean.
    is it possible?
    Thanks in advance

    Hi,
    When you call jsp:useBean you inform a scope (session, request, page...)
    This means the bean instance will be stored in that scope.
    So, if the informed scope is session, then, in the servlet you could get the bean instance back from the session, this way:
    HttpSession session = request.getSession();
    Bean b = (Bean) session.getAttribute("bean_id");
    Regards,
    Filipe Fedalto

  • How to use one query results in another query

    hi,
    in help.sap I have founded that using variable type replacement path I can use one query results in another query. It is wrote there that I have to choose query name results I want to get in variable definition but I do not know where.
    How I can do this?
    Result I want to get is:
    In one query I have material prices in another material quantities. I want to calculate inventory value (price * quantity). Moreover prices are on plant level, quantities on storage type level. Plant is atribute of storage type.
    Can I do this?
    Regards,
    Andrzej

    Hi Andrzej,
    please check out this thread: Set parameters values depending on other parameters
    I had a discussion about query results as input for another query in there.
    For creating a workbook, just click on the save button after you ran your query in the bex.
    Siggi
    Message was edited by: Siegfried Szameitat

  • How to use one hash table inside another hash table

    Hi everyone,
    Any example of hash table inside another hash table.
    Can one here help me how to write one hash table inside another with repeating keys for the first hash table.
    Thanks,
    kanty.

    Do you mean you want the 'value' entries in a hash table to themselves be hash tables? Easy but this often indicates a design flaw.
    Hashtable<String,<Hashtable<String,Value>> fred = new Hashtable<String,<Hashtable<String,Value>> ();But what do you mean by "with repeating keys for the first hash table"?
    Edited by: sabre150 on Jul 2, 2010 10:11 PM
    Looks like you have already handled the declaration side in your other thread. I suspect you should be writing your own beans that hold the information and these beans would then be stored in a Map. The problem I have is that your description is too vague so I can't be certain.

  • How to use a session, created in a jsp page, in a php page

    Hello, forgive me for the newbie question.
    Here is my problem:
    I want to have a jsp page create a session, set some session variables and then redirect to a php page which will access those same session variables.
    I have the redirection worked out, but I can't seem to find out how to use the jsp session in my php script.
    Is this possible at all, and if so, how does it work?

    Note that javascript runs on the client side, and JSP runs on the server. JSP and the session objects are NOT available to javascript in reaction to the user.
    If this function is called only when the page is first created, not when the user interacts with the page, or if you want that value to be constant with respect to the javascript, then you can do this:
    <%
      String someValue = (String)session.getAttribute("theAttributeName");
    %>
    <script type="text/javascript">
         Calendar.setup({inputField:"f_date_dfFirstPmtDate",
                                              button:"f_trigger_dfFirstPmtDate",
                                             singleClick:true,
                                              ifFormat:<%=someVale%>});
    </script>

  • How to use/configure JAVA beans file in Forms10g?

    Hi!
    I'm using Forms10g. I need to use few java beans file in my forms. How do i call it and configure it. So, that i can access all the features of this file in Forms.
    Regards.
    Satyaki De.

    Hello,
    Java Beans Integration
    http://forms.pjc.bean.over-blog.com/article-4018331.html
    Hope it helps,
    Jose.

  • How to use remote managed bean and JPA in JSF

    Hi All,
    I am familiar with referencing backing-beans and JPA properties where Glassfish and MySQL is running locally. However, is it possible to lookup these same properties using JNDI if they reside on remote servers? If so, what change is needed?
    I would like to distribute the J2EE 5 application load including database by running Glassfish, MySQL on separate servers. This will put on the JSF (presentation-tier) components on it's own server while a secondary system will handle the middle tier processing and leaving the database activities to be carried out on another server. Not sure whether this is the right approach though. These hardware would run on both Solaris and Windows platforms.
    Unfortunately, buying faster hardware is not an option.
    Any assistance would be appreciated,
    Jack

    Hi Faissal,
    Is your suggestion below:
    //Lookup an EJB and use it
       YourRemoteBean bean = (YourRemoteBean ) ServiceLocator.findRemoteObject(jndiName); // ServiceLocator is a class that lookup
                                                                                                                                           //  the remote objectis equivalent to the following lines:
    Properties props = new Properties();
        props.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory");
                props.setProperty("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
                props.setProperty("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
                // optional.  Defaults to localhost.  Only needed if web server is running
                // on a different host than the appserver   
                // props.setProperty("org.omg.CORBA.ORBInitialHost", "localhost");
                props.setProperty("org.omg.CORBA.ORBInitialHost", "remoteServer");
                // optional.  Defaults to 3700.  Only needed if target orb port is not 3700.
                // props.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
                InitialContext jndiContext = new InitialContext(props);     
                InitialContext jndiContext = new InitialContext();
                YourRemoteBean bean =  (YourRemoteBean) jndiContext.lookup("ejb.YourRemoteBean");Thanks,
    Jack

  • How to use the session id provided by fuego.papi.ProcessServiceSession

    Hi, I'm wondering how to reuse the session id provided by the ProcessServiceSession in the Oracle BPM 10g Process API (PAPI)...
    After the processService.createSession(passport, "localhost") call, I get an ProcessServiceSession instance, wich has an getId() method, so... the question is:
    Is there a way to reuse this sessionId in another call to the processServiceSession's methods?, something like: I have this sessionId "userName321321321321321", so I want to reuse it to avoid passing the username and password in another moment of the application...
    Moment 1: The user does the log in step and obtains a sessionId, then, the user exits the application... (I'm not going to execute the close() of the ProcessServiceSession, so, I keep the session alive)
    Moment 2: The user goes back to the application and does some other things, so, with the generated session id in moment 1, I'd like to retrieve that session (by the session id) and accept him as valid user, without ask him the password again and allow him to do PAPI stuff.
    Is this doable?
    Edited by: user11204803 on 09/11/2010 11:41

    hi
    yes , you can get SQL_ID from v$session and also you can join it for v$SQL also it get another details ......
    CHeers

  • How to use an Object Type from Another Database

    Hi,
    I have this requirement that I need to call a stored procedure from another DB (db1) but I am having a problem with this because one of the input parameters uses an object type defined in that DB (db1). Is it possible to use an object type from another database? TIA!

    Sven W. wrote:
    At least for queries, but I think also for procedure arguments..You (both) probably missed my post?
    We can't use a remote type as procedure argument, even with the same OID.
    It's OK for query on a remote object column though :
    SQL> conn remote_user@remote_db
    Entrez le mot de passe :
    Connecté.
    SQL> create type mytype oid '19A57209ECB73F91E03400400B40BBE3'
      2  as object (att1 number);
      3  /
    Type créé.
    SQL> create table mytable (col1 mytype);
    Table créée.
    SQL> insert into mytable values (mytype(777));
    1 ligne créée.
    SQL> create or replace function myfunc (p_in in mytype) return number
      2  is
      3  begin
      4   return p_in.att1;
      5  end;
      6  /
    Fonction créée.
    SQL> disconn
    Déconnecté de Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL>
    SQL>
    SQL>
    SQL>
    SQL>
    SQL> conn my_user@local_db
    Entrez le mot de passe :
    Connecté.
    SQL> create type mytype oid '19A57209ECB73F91E03400400B40BBE3'
      2  as object (att1 number);
      3  /
    Type créé.
    SQL> select * from mytable@test_dbl;
    COL1(ATT1)
    MYTYPE(777)
    SQL> declare
      2   res number;
      3  begin
      4   res := myfunc@test_dbl(mytype@test_dbl(777));
      5  end;
      6  /
    res := myfunc@test_dbl(mytype@test_dbl(777));
    ERREUR à la ligne 4 :
    ORA-06550: Ligne 4, colonne 26 :
    PLS-00331: référence non valide à REMOTE_USER.MYTYPE@TEST_DBL.WORLD
    ORA-06550: Ligne 4, colonne 2 :
    PL/SQL: Statement ignored
    SQL> declare
      2   res number;
      3  begin
      4   res := myfunc@test_dbl(mytype(777));
      5  end;
      6  /
    res := myfunc@test_dbl(mytype(777));
    ERREUR à la ligne 4 :
    ORA-06550: Ligne 4, colonne 9 :
    PLS-00306: numéro ou types d'arguments erronés dans appel à 'MYFUNC'
    ORA-06550: Ligne 4, colonne 2 :
    PL/SQL: Statement ignored

  • How to use the Table Valueset in another Table Valuset

    Hi Friends ,
    I have one requirement let me explain you the scenario.
    in one segment of the Keyflex filed i need to get the all the grades of the business. which i did using the table valueset.
    now in another segment of the kff, i need to get all the grade steps depending on the selected grade.
    like if i have a grades say G1,G2,G3,G4...........
    and grade steps
    for G1-steps(1,2,3,4,5,6)
    for G2-steps(1,2,3,4)
    for G3-steps(1,2,3)
    for G4-(1,2,)
    etc.
    Now my requirement is if the user select the grade G1 from the valueset. then in the next filed of the segment should come only those steps which are valid for that grade.
    i hope i have given clear pic of my requirement can anyone please help me out, how to proceed for this.
    thanks in advance.

    Well, I know what you're talking about, but this is something that is usually done in different ways depending on the front end interface being used.
    Are you referring to Oracle Forms? Apex? .NET? Java? or what???
    This forum is for SQL and PL/SQL questions, so doesn't relate to a particular interface. SQL and PL/SQL do not have key flex fields, so, either ask your question in the correct sub-forum or give us more details as to your requirements.

  • How to use one button to drive another button click

    I'm trying to figure out a way to fix a bug in my application.  The simple fix would be to have a single button that drives a MouseCLICK event on another button everytime the PlayBar in my application reaches the end of the screen and returns to its origin.
    How would I achieve this?  I have made a lot of headway since I last posted a question in the ActionScript 3 forum, which was only yesterday evening.
    Thanks in advance,
    markerline

    The application is an audio application.  It is like a drum machine sort of.
    Currently there is a grid and whenever active cells get hitTest'ed by the PlayBar they become deactivated, the PlayBar returns to the origin, and when you relaunch the Play functionality the deactivated cells no longer play a sound.
    I have a button which reactivates the sounds.
    I also have a button which has a bug in it that loops the sounds. 
    To go around the looper button that has a bug in it I would like to use a Button "Z" which automatically clicks the "reactivate the sounds" button every time the PlayBar returns to the origin and the PlayBar will then continue to play and return to the origin in a looping fashion.  If the Button Z is in an active state this looping will continue.  To stop looping, click the Button Z until it is no longer in an active state and the PlayBar will then remain at the origin.

  • How to use a session variable in Conditional Format?

    Hi Gurus,
    I created a session variable , called Actual_date,
    using the following SELECT:
    SELECT SYSDATE FROM DUAL
    In a report title the following expression worked fine:
    @{biServer.variables['NQ_SESSION.Actual_date']}
    I red in a reply in this forum, under the
    "Oracle BI EE Variables Overview"
    that we can use the above format in Cond.Format.
    However I got an error:
    "The value entered msut date and Time..."
    Any tips?
    Thanks
    Laszlo

    It's because when you fired
    SELECT SYSDATE FROM DUALYour variable have a LONGVARCHAR type (if I remember)
    Check here how to find the data type.
    http://gerardnico.com/wiki/dat/obiee/obi_server_variable_find_value
    If you just need to get the current date, you can try the system presentation variable current time as :
    @{system.currentTime} Good luck
    Nico

  • How to use a Session object in a Javascript function

    I have an object that I have set in my session.
    On my jsp I want to pull it out of my session and use it as a parameter for a javascript function. But I am not sure how to do that... the function call is below... I want to assign a value to ifFormat (last variable in function) But I am not sure what to use inside javascript.
    <script type="text/javascript">
         Calendar.setup({inputField:"f_date_dfFirstPmtDate",
                                              button:"f_trigger_dfFirstPmtDate",
                                             singleClick:true,
                                              ifFormat:XXXXX});
    </script>

    Note that javascript runs on the client side, and JSP runs on the server. JSP and the session objects are NOT available to javascript in reaction to the user.
    If this function is called only when the page is first created, not when the user interacts with the page, or if you want that value to be constant with respect to the javascript, then you can do this:
    <%
      String someValue = (String)session.getAttribute("theAttributeName");
    %>
    <script type="text/javascript">
         Calendar.setup({inputField:"f_date_dfFirstPmtDate",
                                              button:"f_trigger_dfFirstPmtDate",
                                             singleClick:true,
                                              ifFormat:<%=someVale%>});
    </script>

Maybe you are looking for

  • Can the B520 be used as an external monitor for a macbook via the HDMI in?

    Hi, I'm very happy with the Lenovo, but it looks like our family will be acquiring a macbook in the near future.  Can I use HDMI in on the Lenovo B520 so that it becomes an external display for an apple computer? Thanks for the help.

  • Open Item Management status on G/L

    Hi Everyone, One of the GL account is not allowing to change its status to Open Item Management. We tried to convert this, but the process could not be completed because the sum of the transactions did not equal the balance (by 448.69). It appears th

  • Column contains only space(s)

    I have a problem using bind variables with Method 4 out of Pro*C/C++ Precompiler Programmer's Guide Release 8.1.5. I've pretty much taken the sample code and customized it. Everything else works fine; however, when I want to select where colum = :s a

  • Service (consulting) contract in sd,automatic create SO from interface

    Hi I need to create a service contract like consulting (UOM is Hour) in sd and the do pricing whihc include surcharge,commision,discount. 2. How to create sales order automatically when we receive the file for third party interface. Please let me kno

  • Renaming image files & years question

    hello how do i change the name of image files? i know how to change the title, but can i change the actual name of the file? when i transferred my photos from a previous computer, iPhoto sorted them into years. how does iPhoto sort them...is it by da