What role can ejb Session Beans  play  jsp session tracking

 

          I am also looking for a way to use JSP as ejb client with WLS5.1. i would appreciate any help.
          -Girish
          Prasad Peddada <[email protected]> wrote:
          >David,
          >     The beans which are refered in jsp specs are java beans and not EJB.
          >
          >Prasad
          >
          >David Levy wrote:
          >>
          >> Hello,
          >>
          >> We are using Jsp/Servlets which will hold session state and subsequently
          >> call ejb Session Beans for transaction/persistence coordination . We are
          >> not sure if we are using the correct techniques to control object memory.
          >>
          >> Summary of what we have:
          >>
          >> A jsp with the "useBean" directive:
          >> <jsp:useBean id="MySession" class="com....MySession"
          >> scope="session"></jsp:useBean>
          >>
          >> The class MySession holds other classes ( all serializable).
          >> The class MySession is NOT an ejb Session Bean
          >>
          >> Questions:
          >> We are considering making class MySession an ejb Session Bean so (via it's
          >> passivate/activate feature) we can control instances in memory as more web
          >> clients start the session from the jsp page. I.E. all web clients will have
          >> their own HttpSession instance which holds on to an ejb Session Bean object
          >> "MySession"( or a passivated representation of it)
          >>
          >> 1) Is this a sufficient approach or will there be other memory concerns?
          >> I.E. What about all the HttpSession objects out there? Do they need to be
          >> passivated as well?
          >>
          >> 2) If its a good idea to passivate the HttpSessions as well, then what
          >> mechanism should be used ( servlet session persistence)? Also, if we are
          >> passivating the HttpSession (which holds on to the MySession object graph)
          >> , then why bother with the SessionBean for passivation
          >>
          >> 3) Currently, we only have a single instance of a servlet handling all
          >> requests. Will multiple instances buy us anything?
          >>
          >> 4) How does clustering relate to this topic?
          >>
          >> 5) Can we change the "jsp:useBean" directive so MySession is an ejb Session
          >> Bean or do we have to do the "home.create()" within a jsp script?
          >>
          >> thanks,
          >> dave
          

Similar Messages

  • Calling Session Beans in JSP ?

    Hi Folks,
    I am new to EJB3, I am doing simple applicatuions.
    Can any one please tell me how to call session beans in jsp page.
    for example my case is.. iam entering two diffrent data, lets say user name and password in jsp page and this should go in data base thru JPA (entity beans)
    Iam able to enter data from JPA in data base but if the same i have to fetch from JSP page.. iam not getting..!
    I would really appretiate for your help i need it urgent...!
    thanks in advance.

    abishek1983 wrote:
    Hi Folks,
    I am new to EJB3, I am doing simple applicatuions.
    Can any one please tell me how to call session beans in jsp page.
    Not. You can, technically, but you shouldn't. JSP should be for display purposes only, containing no Java code whatsoever.
    for example my case is.. iam entering two diffrent data,Wrong. You cannot possibly have "2 data", the very concept is impossible.
    You can have "2 data items" which is probably what you intended to say?
    lets say user name and password in jsp page and this should go in data base thru JPA (entity beans)
    Iam able to enter data from JPA in data base but if the same i have to fetch from JSP page.. iam not getting..!
    Same way you insert them. Of course JPA entities are distinctly different from entity beans. The very concept of entity beans no longer exists in the context of JPA, it's solely used to mean EJB 2.1 or earlier entity beans.
    I would really appretiate for your help i need it urgent...!
    It's not urgent.

  • Looking up a EJB 3.0 Session Bean in JSP Scriptlet

    Hello There,
    Somebody please enlighten me. I have a bean named
    a.b.MyBeanextending local interface
    a.b.MyLocalNow I want to use this bean in a JSP (Maybe just for fun, but the point is I am not using resource injection).
    So the question is, What is the default JNDI name of the session bean with only a local interface, which I can use to look-it-up in jsp scriptlet code.
    Cheers. Am trying for last hour, nothings turned up
    Bye

    It's the classname under the initial context or a.b.MyLocal in your case.
         <% MyLocal intf = null;
              try {
                   InitialContext context = new InitialContext();
                   intf = (MyLocal) context.lookup(MyLocal.class.getName());
              } catch (Exception ex) {
                   System.err.println("Error looking up MyLocal: " + ex.getMessage());
              } %>

  • 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

  • Using session bean in JSP

    Dear All
    I write a BorrowList session bean and tested OK in console mode. I can't use it in the JSP, Dose any body tell me How can I create this bean in the JSP and when should I place the bean classes(Home, Bean and Remote).
    I'm now using the BEA Weblogic 7.0
    I'm appreicate if anybody can help me.
    Best Regards
    YU

    U may be used the code similar to following :
    Context context = new InitialContext.();
    Object obj = (Object)context.lookup("Your JNDI name");
    YourHome home = (YourHome)obj.portableRemoteObject.narrow(obj,
    YourHome.class);
    YourRemote remote = home.create();
    System.out.println("your Business methods : "+remote.businessMethod1());
    Put this code or whatever code used in ur console client in JSP and invoke the businessMethods using remote object.
    I worked with BEAWeblogic 5.1, I think similar case may be there with BEA Weblogic7 also.
    First, make a jar file with ome.Remote and Bean by using the deploymenttool, then compile with ejb compiler, the new Jar is the complete deployable file. Take this file and register in weblogic.properties file that is specify the path of the Jar file in the weblogic.properties file. and put the JSP in public-html directory and start the server. if the bean is deployed successfully, open JSP file in a browser then it will work.... if the bean is not deployed you won't get any result.
    I can say, just placing the initialContext part of code on the JSP and running the JSP. I think, this may helps u...
    Ramana

  • Problem with Session Beans in JSP

    Hi,
              I'm testing Weblogic for our company's IT department and just ran into a
              strange error. I wrote a simple JSP script to use a bean that works fine
              except when trying to set the bean scope to session. I looked at the the log
              file and the only exception recorded was a ClassCastException. Could anyone
              please clarify this to me? Is this a current bug in Weblogic?
              Thank you for your attention,
              Paul Visan
              

              classcastexception are generally due to bad classpaths...
              can you provide more information like what is the code trying to do..stack trace etc..
              "Paul Visan" <[email protected]> wrote:
              >Hi,
              >
              >I'm testing Weblogic for our company's IT department and just ran into a
              >strange error. I wrote a simple JSP script to use a bean that works fine
              >except when trying to set the bean scope to session. I looked at the the log
              >file and the only exception recorded was a ClassCastException. Could anyone
              >please clarify this to me? Is this a current bug in Weblogic?
              >
              >Thank you for your attention,
              >Paul Visan
              >
              >
              

  • What devices can i download and play itunes with

    My daughter inherited a very old laptop of mine, which is barely working.  All she essentially wants it for is to play her itunes through.  I want to buy her a new device but do not want to buy an actual laptop, as they are pretty expensive.  Ideally, I'd like to spend less than $200.  What devices can she play itunes through, besides her phone and ipod.  Any suggestions for what I could buy in my price range.  I was considering a chromebook but don't think that itunes supports that.  Also, was considering a kindle...but i don't know if that's supported either.

    Hi Stacy,
    The requirements for running iTunes on a computer can be found here -
    Apple - iTunes - Download iTunes Now
    http://www.apple.com/itunes/download/
    For a PC those requirements are -
    PC with a 1GHz Intel or AMD processor and 512MB of RAM
    Windows XP Service Pack 2 or later, 32-bit editions of Windows Vista, Windows 7, or Windows 8
    64-bit editions of Windows Vista, Windows 7, or Windows 8 require the iTunes 64-bit installer
    400MB of available disk space
    Broadband Internet connection to use the iTunes Store
    For a Mac -
    Mac computer with an Intel Core processor
    OS X version 10.6.8 or later
    400MB of available disk space
    Broadband Internet connection to use the iTunes Store
    As a Chromebook fits neither of these using it would not be supported. iTunes is also not supported on a Kindle.
    Thanks for using Apple Support Communities.
    Best,
    Brett L

  • HttpSession vs. Stateful Session Bean ---- when State Session is large

    I hope most of the people come across with this issue where to put the state
    for the internet/intranet based applications when they are using
    servlet/jsps calling session beans. Weblogic 4.5.1 does support httpsession
    in-memory replication for the servlets but the stateful session beans are
    not replicated in clustered environment. Plus with stateful bean u get
    activation/passivation overhead too. So one tempts to use stateless session
    beans and store state in httpsession?
    Then what is the upper limit for the session state one can put in
    HttpSession with the weblogic? Is there any way to configure it?
    One way to overcome the httpsession size limitation is to use database for
    storing state and just store some unique Ids for the session info in
    httpSession. But then there will be overhead for database connection?(jdbc
    connection pool can provide some help here). So what is the recommended way
    for doing this provided few thousand concurrent clients with session size
    say exceeding 4kb per client?
    Thanks
    Usmani

    There are no special setting in sun-ejb-jar.xml regarding cache settings. The default settings from server.xml are used:
        <jdbc-connection-pool steady-pool-size="8" max-pool-size="32" max-wait-time-in-millis="60000" pool-resize-quantity="2" idle-timeout-in-seconds="300" is-isolation-level-guaranteed="false" is-connection-validation-required="false" connection-validation-method="auto-commit" fail-all-connections="false" datasource-classname="oracle.jdbc.pool.OracleDataSource" name="ebs">
          <property value="jdbc:oracle:thin:@myebsdbsserver:1521:ebsdevdb" name="url"/>
          <property value="ebs" name="user"/>
          <property value="ebs" name="password"/>
        </jdbc-connection-pool>
      <ejb-container steady-pool-size="32" pool-resize-quantity="16" max-pool-size="64" cache-resize-quantity="32" max-cache-size="512" pool-idle-timeout-in-seconds="600" cache-idle-timeout-in-seconds="600" removal-timeout-in-seconds="5400" victim-selection-policy="nru" commit-option="B" monitoring-enabled="true">
         </ejb-container>The Session Bean uses Container Managed Transaction. Is it possible in this case, that the bean isn't 'idle enough' in order to set into passivated?

  • What videos can an ipod classic play?

    so i just tried downloading some video podcasts and it seems i can only download certain ones. i would like to know if i rent or buy some movies through itunes will i be able to watch them on my classic? i dont want to pay for something and not be able to watch it.

    From here: http://www.apple.com/ipodclassic/specs.html
    Video
    H.264 video, up to 1.5 Mbps, 640 by 480 pixels, 30 frames per second, Low-Complexity version of the H.264 Baseline Profile with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats; H.264 video, up to 2.5 Mbps, 640 by 480 pixels, 30 frames per second, Baseline Profile up to Level 3.0 with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats; MPEG-4 video, up to 2.5 Mbps, 640 by 480 pixels, 30 frames per second, Simple Profile with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats
    B-rock

  • How does session bean contain in the JSP page

    May i know how session bean contains in the JSP page
    If the situation is like the following ...
    if i dont want to put the session bean in the session
    like this :
    session.setAttribute("UserBean",userBean);
    the way i get the session bean is only
    session.getAttribute("UserBean");
    Does have the other way to get the Session bean during the JSP
    if i dont want to use this kind of way,
    what else i can do for?
    may i know the solution with detailed
    and please attach the solution of code to me if you know...
    thanks...

    Hi,
    I am not clear with ur query..
    What I understood from ur query is that, u are trying to put the session ejb in the HttpSession Object for some use ahead in future?
    If this is the case, then I think are approach is not correct.
    StatefulSession beans are meant for this purpose, i.e they will be maintaining the client session. So use the same using the JndiLookup of the HomeInterface and the getting the Home reference and calling the businessmethods
    sameer

  • Local session bean lookup in another local session bean in EJB 3.0

    Hi,
    I am doing JNDI lookup of a local session bean in a session bean. ( I do not want to use EJB dependency injection).
    Lookup of local interface from session bean is successful. But, when the calling session bean is a local session in another session bean, the lookup fails.
    Here is an example:
    @Stateless
    @EJBs({@EJB(name="EJB2Local", beanInterface=EJB2Local.class),
    @EJB(name="EJB3Local", beanInterface=EJB3Local.class)})
    public class EJB1 implements EJB1Remote, EJB1Local{
    public void findEJB3Local(){
    //1. JNDI lookup for EJB3Local ----
    //2. EJB3Local.someFunction()
    @Stateless
    @EJB(name="EJB1Local", beanInterface=EJB1Local.class)
    public class EJB2 implements EJB2Remote, EJB2Local{
    public void findEJB1Local(){
    //1. JNDI lookup EJB1Local
    // 2. Call EJB1Local.findEJB1Local method
    //THIS METHOD CALL WILL FAIL.
    public void findEJB1Remote(){
    //1. JNDI lookup EJB1
    / 2. Call EJB1Local.findEJB1 method
    @Stateless
    public class EJB3 implements EJB3Remote, EJB3Local{
    public void someFunction(){}
    This setup was working in EJB 2.1, as we had clear ejb-local-ref definitions in our ejb-jar.xml file.
    I am suspecting that EJB 3.0 has special annotation to use when lookup is made from another local session bean.
    Any comments will be appreciated.
    Thanks,
    Mohan

    From a private component environment perspective, declaring @EJB in a bean class is equivalent
    to using ejb-ref or ejb-local-ref for that same bean in ejb-jar.xml. In each case, the EJB dependency
    is declared for that bean. Each EJB component has its own private component environment, so
    code running within invocations on different EJBs can not see the component environment of the
    components that made the invocations.
    What exact error are you getting? Please post the stack trace if possible.
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Using a Statefull Session Bean with RMI on Multiple JSP pages

    Heya all,
    i have a JBoss server running with a statefull bean on it. I want to use it on my JSP pages. But every time I start my JSP-page a NEW INSTANTION of the bean is created! For each user using my page, I want ONE bean.
    Is there anyway to do this? ANything with the sessioncontext?
    I can do it with local beans, using the simple tags in the JSP-page, but they do not work for Remote Beans.
    (I use JNDI)

    hi,
    statefull session beans are client session specific. the instance will exists if client session exits.
    now since u are loading the jsp page again in the other browser, a new instance will be associated with the current session.
    hope it will work.
    sameer

  • Error in updating secondary stateful session bean

              Hi all,
              I have set up a cluster of 2 managed servers with WebLogic 6.1. I have a
              stateful session bean and several stateless session beans. the stateful
              session bean keeps user info and limited cached objects, all are
              serializable. it seems working fine, even after killing any one of the
              servers, as long as one is alive. a java application client creates a
              stateful session bean first, then calls stateless session beans with the
              remote interface of the stateful bean as a method parameter. No problem
              when stateful session bean is created. However, each stateless bean method
              generates the following error message if I turn the debug on (level 64). No
              exception stack traces, and all methods execute successfully.
              <Error> <EJB> <Failed to update the secondary copy of a stateful session
              bean from home:clientsession>
              I wonder what causes the error, and why it tries to update the stateful
              session bean. in all stateless session beans, only read into the stateful
              bean.
              Thank you,
              Fujin
              

    This has been fixed in WLS 6.1 SP2.
              jagdip Talla wrote:
              > Hi Fujin,
              > please let me know, if u were able to solve the problem..
              >
              > hi guys,
              > appreciate if you could give me some clues
              > how to solve this problem ?
              >
              > i hv 2 WLS instances in a cluster,
              > when one server instance is shut down, i keep getting these errors ?
              > is it normal ?
              > <Feb 19, 2002 2:57:53 PM SGT> <Error> <EJB> <Failed to update the secondary copy of a stateful session bean from home:ejb/xyzrel1_2/xxxxHome>
              >
              > appreciate if u can let me know, if u could solve it..?
              >
              > thanks n regads
              > jagdip
              Rajesh Mirchandani
              Developer Relations Engineer
              BEA Support
              

  • Help!!! Stateful session bean clustering

              I posted this message on interest.clustering.in-memory-replication. But there is
              no answer at all. Could anyone give me
              some hints? Thanks a lot. I am a student and this work is part of my course project.
              It is due soon.
              =================================================================
              I have a big problem to get stateful session bean in-memory replication run on
              clustering. I have three server instances on three nodes and there is always errors
              from the server instance like this when I run the client to invoke the bean methods:
              <Jan 4, 2002 6:47:31 PM EST> <Error> <EJB> <Failed to update the secondary copy
              of a stateful session bean from home:stateful.ejb.AgentSTF>
              Besides, the load balancing can not work probably too. Below is what I get.
              Statistics for different servers:
              "myserver" processed 160 (12%) of 1311 invocations "ejbperf-3" processed 1151
              (88%) of 1311 invocations
              End Client...
              Load balancing works fine with stateless and entity bean.
              Any comments are greatly appreciated.
              Jenny
              

    Hi Jenny,
              Please could you open a case to the customer support ([email protected]) There is a Cr
              on this issue CR059046
              Description of the CR
              WLS 6.1SP1 - Accessing Stateful Session Bean from Stateless Session Bean in a
              cluster fails with errors
              <Oct 5, 2001 5:08:25 PM GMT+00:00> <Error> <EJB> <Failed to update the
              secondary copy of a stateful session bean from home:UserState>
              Regards
              Stephane
              Jenny Liu wrote:
              > I posted this message on interest.clustering.in-memory-replication. But there is
              > no answer at all. Could anyone give me
              > some hints? Thanks a lot. I am a student and this work is part of my course project.
              > It is due soon.
              >
              > =================================================================
              >
              > I have a big problem to get stateful session bean in-memory replication run on
              > clustering. I have three server instances on three nodes and there is always errors
              > from the server instance like this when I run the client to invoke the bean methods:
              >
              > <Jan 4, 2002 6:47:31 PM EST> <Error> <EJB> <Failed to update the secondary copy
              > of a stateful session bean from home:stateful.ejb.AgentSTF>
              >
              > Besides, the load balancing can not work probably too. Below is what I get.
              >
              > Statistics for different servers:
              > "myserver" processed 160 (12%) of 1311 invocations "ejbperf-3" processed 1151
              > (88%) of 1311 invocations
              > End Client...
              >
              > Load balancing works fine with stateless and entity bean.
              >
              > Any comments are greatly appreciated.
              >
              > Jenny
              >
              Regards,
              Stephane Kergozien
              BEA Support
              

  • Parallel Processing in Session Beans?

    Hi,
    I'm trying to do a simple use case of processing (saving 1000s) of records. Essentially, MY session bean calls another session bean synchronously which does the saving. I'm iterating over 1000s of records and one by one calling the second session bean - which I feel is very inefficient. I'd like to break up the 1000 records into chunks of 200 records - hence thought of starting 5 worker threads to save these records in parallel. All the 1000 records have to be in a single transaction and hence I can't use MDBs. And I know I can't start Threads in EJBs.Any suggestions?

    Titan1978 wrote:
    Hi,
    I'm trying to do a simple use case of processing (saving 1000s) of records. Essentially, MY session bean calls another session bean synchronously which does the saving. I'm iterating over 1000s of records and one by one calling the second session bean - which I feel is very inefficient. I'd like to break up the 1000 records into chunks of 200 records - hence thought of starting 5 worker threads to save these records in parallel. All the 1000 records have to be in a single transaction and hence I can't use MDBs. And I know I can't start Threads in EJBs.Any suggestions?As long as the second EJB shares the same transaction as the first one, its not inefficient.

Maybe you are looking for

  • AE CS5 Hanging up on start up

    I have a reoccuring problem with AE hanging up on startup.  It seems to stop right when the program is going through the various folders that it is scanning and freezes up right when it gets to "Scanning Folder: 32_64bit".  I have installed the Mac O

  • Archivelog errors...EVERYTHING CHECKS OUT!?

    10.2.0 HPUX I don't know if anyone has ever come across this before. But I was receiving errors that archiving couldn't find valid locations ORA-16014: log 1 sequence# 18959 not archived, no available destinations ORA-00312: online log 1 thread 1: '/

  • Re: DW CC The usual choices for the Workspace Layout are missing. How can I restore them?

    The usual choices for the Workspace Layout are missing. How can I restore them?The usual choices for the Workspace Layout are missing. How can I restore them?

  • ACR 6.7 Won't install

    I've tried to install ACR 6.7 on my Mac (running Snow Leopard). All the installer gives is "installation failed". I've searched the forums, and tried deleting the old plug-in looking in the package for the correct file to copy to no avail. Also, I'm

  • Quick Time 7.0.3 Updates

    When checking for Quick Time updates, I continue to get the following response. "A Connection with the Quick Time software server could not be established. This computer may be having trouble accessing the internet or the server may be off-line." I h