Life time of session bean

I read in Ed Roman's book
Life time of session bean is rough equivalent to life time of session or "life time of client code that is calling the session."
"clients session duration could be as long as browser window is open" page 81
How does the server know lifetime of client code.

Greetings,
I read in Ed Roman's book
Life time of session bean is rough equivalent to life
time of session or "life time of client code that is
calling the session."The real point is that a Session Bean's life is relatively short since it is closely linked to the life of the client - as compared to the relatively long life of an Entity Bean which is closely linked to that of the resource's data. As an Entity Bean's identity comes from the primary key of the data to which it maps, a Session Bean's identity comes from the session id for the client which created it. When the client's session is "terminated", so is the Session Bean. The semantics of session termination, however, is dependent upon several factors...
"clients session duration could be as long as browser
window is open" page 81This is a little misleading. The browser (window) itself does not establish a connection to a Session Bean (or any EJB for that matter). However, an Applet embedded in the page which the browser is displaying might, as well as might a Servlet to which the browser is "connected". In either case, how long the Session Bean remains "alive" depends on the life of the component connecting to it. For an Applet it would generally be until the Applet's destroy() method is called. For a Servlet it would be until the client's HttpSession object is invalidated (assuming the bean reference is stored there; otherwise it's when the current service thread terminates ':-o ).
How does the server know lifetime of client code.By virtue of the fact that a connection to a Session (or Entity) Bean is synchronous - meaning there's an underlying socket connection between the client's reference (a "stub") and the bean proxy. If the client code terminates the connection terminates with it...
I hope this helps.
Regards,
Tony "Vee Schade" Cook

Similar Messages

  • How long is the life time of process scope variable ?

    Hi All,
    How long is the life time of process scope variable befoer it expires ?
    Is it the same with the life time of session scope ?
    How can we set the value in OAS when deployment ?
    Thank you,
    xtanto

    Hi,
    http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/jsf/doc/devguide/communicatingBetweenPages.html
    " Finally, processScope never empties itself; the only way to clear processScope is to manually force it to clear:
    AdfFacesContext afContext = AdfFacesContext.getCurrentInstance();
    afContext.getProcessScope().clear();
    Otherwise the variable lives for the duration of the window process. The referenced document above also shows how to set a variable to process scope
    Frank

  • Stateful vs. stateless session bean

    Hi,
    I am following the pattern of accessing entity beans with a session bean wrapper. I am just wondering if it's more efficient to make it a stateful session bean by keeping references to the home interfaces or make it stateless and do a lookup every time the session bean is created/activated?
    I suppose the number of entity beans I want to access might make a difference. If so, is there a rough number when one way becomes better than the other?
    Thanks for any help in advance.
    Jeff

    - It is far better to use a stateless session bean when implementing the session-facade pattern.
    - Keeping a home interface on the object won't make him stateful.
    - with the stateless beans, you do not decide when they're created. The container does.
    - The number of entity beans is not so important. The only thing important is to have a remote methode in your stateless(es) for each atomic transaction ("atomic" meaning here "you cannot cut").
    /Stephane

  • Stateful Session Beans are not passivated / serialized when cache idle time

    Technology: Sun Application Server version 7.0.0_01; JDK 1.4.1; developed on Windows 2000; Tested on Sun Solaris.
    Initial error on Sun Solaris:
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr: Exception in thread "service-j2ee-25" org.omg.CORBA.OBJ_ADAPTER: vmcid: SUN minor code: 1015 completed: No
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.ee.internal.POA.GenericPOAServerSC.preinvoke(GenericPOAServerSC.java:389)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.ee.internal.POA.ServantCachePOAClientSC.initServant(ServantCachePOAClientSC.java:112)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.ee.internal.POA.ServantCachePOAClientSC.setOrb(ServantCachePOAClientSC.java:95)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.ee.internal.iiop.CDRInputStream_1_0.createDelegate(CDRInputStream_1_0.java:760)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.ee.internal.iiop.CDRInputStream_1_0.internalIORToObject(CDRInputStream_1_0.java:750)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.ee.internal.iiop.CDRInputStream_1_0.read_Object(CDRInputStream_1_0.java:669)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.ee.internal.iiop.CDRInputStream_1_0.read_abstract_interface(CDRInputStream_1_0.java:890)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.ee.internal.iiop.CDRInputStream_1_0.read_abstract_interface(CDRInputStream_1_0.java:884)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.ee.internal.iiop.CDRInputStream.read_abstract_interface(CDRInputStream.java:307)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.se.internal.io.IIOPInputStream.readObjectDelegate(IIOPInputStream.java:228)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.se.internal.io.IIOPInputStream.readObjectOverride(IIOPInputStream.java:381)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:318)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.enterprise.iiop.IIOPHandleDelegate.getStub(IIOPHandleDelegate.java:58)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.enterprise.iiop.IIOPHandleDelegate.readEJBObject(IIOPHandleDelegate.java:38)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.ejb.portable.HandleImpl.readObject(HandleImpl.java:91)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.se.internal.io.IIOPInputStream.readObject(Native Method)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.se.internal.io.IIOPInputStream.invokeObjectReader(IIOPInputStream.java:1298)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.se.internal.io.IIOPInputStream.inputObject(IIOPInputStream.java:908)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.se.internal.io.IIOPInputStream.simpleReadObject(IIOPInputStream.java:261)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.se.internal.io.ValueHandlerImpl.readValueInternal(ValueHandlerImpl.java:247)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.se.internal.io.ValueHandlerImpl.readValue(ValueHandlerImpl.java:209)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.ee.internal.iiop.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:981)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.ee.internal.iiop.CDRInputStream.read_value(CDRInputStream.java:287)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.sun.corba.ee.internal.javax.rmi.CORBA.Util.copyObject(Util.java:598)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at javax.rmi.CORBA.Util.copyObject(Util.java:314)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.telstra.nodeman.ejb._NodeMaint_Stub.getHandle(Unknown Source)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.telstra.nodeman.arch.NMAViewBeanProxy.checkBeans(NMAViewBeanProxy.java:631)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.telstra.nodeman.view.html.NMAStandardButton.handleRequest(NMAStandardButton.java:143)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.telstra.nodeman.arch.NMAViewBeanBase.handleRequest(NMAViewBeanBase.java:1573)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.iplanet.jato.view.ViewBeanBase.dispatchInvocation(ViewBeanBase.java:824)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.iplanet.jato.view.ViewBeanBase.invokeRequestHandlerInternal(ViewBeanBase.java:637)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.iplanet.jato.view.ViewBeanBase.invokeRequestHandler(ViewBeanBase.java:595)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.iplanet.jato.ApplicationServletBase.dispatchRequest(ApplicationServletBase.java:772)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.iplanet.jato.ApplicationServletBase.processRequest(ApplicationServletBase.java:446)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.iplanet.jato.ApplicationServletBase.doPost(ApplicationServletBase.java:324)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.telstra.nodeman.view.ViewServlet.doPost(ViewServlet.java:243)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:720)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at org.apache.catalina.core.StandardWrapperValve.access$000(StandardWrapperValve.java:118)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at org.apache.catalina.core.StandardWrapperValve$1.run(StandardWrapperValve.java:278)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at java.security.AccessController.doPrivileged(Native Method)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:274)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:203)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:158)
    [10/Aug/2004:08:04:57] WARNING (17227): CORE3283: stderr:      at com.iplanet.ias.web.WebContainer.service(WebContainer.java:598)
    The above error caused the server to use all available memory and required a reboot to proceed.
    Subsequent testing against the Sun Appliucation Server 7 on Windows 2000 dev environment using the Sun Studio IDE for debugging and trace statements inserted in the code indicate that the Application Server is removing the Stateful Session Beans when they time out without an ejbPassivate event and without serializing the beans to the data-store. cache-idle-timeout-in-seconds set to 180 and removal-timeout-in-seconds set to 1800.
    The server.log indicates that the beans are timing out:
    [19/Aug/2004:18:15:10] WARNING ( 1664): [NRU-com.telstra.nodeman.ejb.AddressMaintBean]: IdleBeanCleanerTask finished after removing 2 idle beans
    Trace statements inserted in ejbPassivate do not appear in the log.
    It is my understanding that the above timeout should have caused an ejbPasssivate and serialization of the beans.
    The beans have been validated using Sun Java Studio Enterprise 6 with 'EJB validate'.
    My reading of the problem is that the beans are not being serialized and the error occurs when the application attempts to reference (getHandle) the bean after timeout.
    Any suggestions would be appreciated.

    Thanks Thorick.
    I am using NRU caching. WL 7.0 SP2.
    I have not defined idle-timeout-seconds in my weblogic-ejb-jar.xml. As I understand
    the default value for this is 600secs. So the ejbs should be removed after this
    time. Below is the
    weblogic-ejb-jar.xml that I am using.
    <!DOCTYPE weblogic-ejb-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic 7.0.0 EJB//EN'
    'http://www.bea.com/servers/wls700/dtd/weblogic-ejb-jar.dtd'>
    <!-- Generated XML! -->
    <weblogic-ejb-jar>
    <weblogic-enterprise-bean>
    <ejb-name>Cart</ejb-name>
    <stateful-session-descriptor>
    <stateful-session-clustering>
    <home-is-clusterable>true</home-is-clusterable>
    <replication-type>InMemory</replication-type>
    </stateful-session-clustering>
    </stateful-session-descriptor>
    <transaction-descriptor>
         <trans-timeout-seconds>
              60
         </trans-timeout-seconds>
    </transaction-descriptor>
    <jndi-name>CartHome</jndi-name>
    </weblogic-enterprise-bean>
    </weblogic-ejb-jar>
    "thorick" <[email protected]> wrote:
    >
    The idle-timeout-seconds property controls the timeout/removal behavior.
    which stateful session cache type are you using ? LRUCache or NRUCache

  • Session bean takes too much time with multiple clients

    Hi ,
    We have a problem in our system.
    we have a session bean on Weblogic 6.0 which internally accesses a DAO
    to get data from an Oracle Database .The sessionbean does a bit of
    heavy processing with the data and then returns an Arraylist of
    required objects .
    with a single client running on the system the whole thing takes about
    3 seconds but if three clients access the same functionality the total
    time taken rises up to a big 50 seconds for all the clients .
    we do not have a problem with the connection pool, all connections
    are closed properly .
    anyone who has faced the same problem ??
    what could be the reason for this anormous increase in time??
    Thanks
    Amol Godbole

    Hi ,
    narrowed down the problem to resultset looping taking too much time .!!!
    any ideas why this might be happening ?
    Thanks
    Amol Godbole
    [email protected] (Amol Godbole) wrote in message news:<[email protected]>...
    Hi ,
    We have a problem in our system.
    we have a session bean on Weblogic 6.0 which internally accesses a DAO
    to get data from an Oracle Database .The sessionbean does a bit of
    heavy processing with the data and then returns an Arraylist of
    required objects .
    with a single client running on the system the whole thing takes about
    3 seconds but if three clients access the same functionality the total
    time taken rises up to a big 50 seconds for all the clients .
    we do not have a problem with the connection pool, all connections
    are closed properly .
    anyone who has faced the same problem ??
    what could be the reason for this anormous increase in time??
    Thanks
    Amol Godbole

  • Stateful session bean time out

    How to specify a stateful session beans's time out value?
    Thanks,
    Jack

    Bear in mind that setting a timeout for a stateful session bean will
    typically have no more effect than setting a maximum number of beans. As
    with garbage collection in Java, beans become eligible for passivation or
    removal when their timeout expires and there are more beans than the
    maximum, but they will only be removed or passivated when the server runs
    low on memory.
    Dave
    "jack" <[email protected]> wrote in message
    news:[email protected]..
    >
    How to specify a stateful session beans's time out value?
    Thanks,
    Jack

  • Run time error while running Session Bean sample

    Hi,
    I am new to EJB. When I try to run one sample session bean, I am getting following exeception.
    javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:255)
         at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:292)
         at javax.naming.InitialContext.lookup(InitialContext.java:359)
         at RunEJB.main(RunEJB.java:31)
    Exception in thread "main"
    This exception is thrown by client project. naming.jar file is already include in the class for Client project as well.
    I am testing this sample on WSAD.
    The code on the client is as follows.
              Context initial = new InitialContext();
              Context myEnv = (Context)initial.lookup("java:comp/env");
              Object objref = myEnv.lookup("ejb/MyTestBeanHome");
              MyTestBeanHome home =
                (MyTestBeanHome) PortableRemoteObject.narrow(objref, MyTestBeanHome.class);
              MyTestBean firstBean = home.create(); 
              firstBean.testMessage();
              firstBean.remove();

    Hi Vikas,
    The fact that this client is coded to use java:comp/env means it's a J2EE Application Client component. Application Clients are full-fledged J2EE components that run within an Application Client container. You'll need to consult the documentation for your J2EE implementation to see how to invoke its Application Client container.
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Default account assignment values during the life time of the session

    Hi Experts,
    In SRM7.0 default account assignment values in 'Change Personal Default Settings' has to be retained in the life time of the user login.
    Eg. A user enters into SRM7.0 web screen(NWBC) and will go to 'Change Personal Default Settings' and enters the values and saves the values and he will do other activities like creating SC and other things, when user logoff from the web screen (NWBC), the values should wipe off and when he logs in again, there shouldnt be any values in account assignment in 'Change Personal Default Settings'.
    Thanks
    SR

    Sam,
    our client's requirement is, those values has to be cleared when user logsoff from NWBC portal, when again he logsin, values should be blank and user can enter the values according to his/her  requirement.
    we tried to capture the action under 'Logoff' button, but, as this button is written in HTML/Java Script, we couldnt able to capture in SRM and I am not Java known person.
    thanks
    SR

  • Statful Session bean and its life

    Hi,
    I don't know how long a Stateful session bean lives in the memory. What keeps
    the stateful bean around?
    I do have a Stateful session bean in my application creating some problem. When
    the user first uses the stateful session bean, the bean remote reference is stored
    in the user session object. Even though the user session is active and not invalidated,
    stateful session bean is getting timed-out. I am using weblogic 6.1 with SP2.
    Please help. Thanks.
    Below is the exception stack trace:
    weblogic.ejb20.locks.LockTimedOutException: The lock request from EJB:SearchList
    HandlerBean with primary key:10,085,579,643,420,691 timed-out after waiting 0
    ms
    . The transaction or thread requesting the lock was:Thread[ExecuteThread: '10'
    f
    or queue: 'default',5,Thread Group for Queue: 'default'].
    at weblogic.ejb20.locks.ExclusiveLockManager$LockBucket.lock(ExclusiveLo
    ckManager.java:448)
    at weblogic.ejb20.locks.ExclusiveLockManager.lock(ExclusiveLockManager.j
    ava:258)
    at weblogic.ejb20.manager.StatefulSessionManager.acquireLock(StatefulSes
    sionManager.java:226)
    at weblogic.ejb20.manager.StatefulSessionManager.acquireLock(StatefulSes
    sionManager.java:216)
    at weblogic.ejb20.manager.StatefulSessionManager.preInvoke(StatefulSessi
    onManager.java:310)
    at weblogic.ejb20.internal.BaseEJBObject.preInvoke(BaseEJBObject.java:11
    7)
    at weblogic.ejb20.internal.StatefulEJBObject.preInvoke(StatefulEJBObject
    .java:170)
    at com.sherwin.sweep.services.common.SearchListHandlerBean_w4ccs4_EOImpl
    .getSize(SearchListHandlerBean_w4ccs4_EOImpl.java:234)

    The usual cause is a user loads a page, the request takes a while so
    they hit stop and reload. There's other possibilities like frames etc.
    -- Rob
    Sai S Prasad wrote:
    Thanks Rob for the response. Every instance of the sfsb is tied to a particular
    user web session. I am not sure how the concurrent calls take place. I am almost
    certain that I am not calling any methods in sfsb concurrently. Thanks again.
    Rob Woollen <[email protected]> wrote:
    The sfsb hasn't timed out. This is the EJB lock manager that's
    complaining. I suspect you are trying to make concurrent calls on a
    sfsb instance.
    -- Rob
    Sai S Prasad wrote:
    Hi,
    I don't know how long a Stateful session bean lives in the memory.What keeps
    the stateful bean around?
    I do have a Stateful session bean in my application creating some problem.When
    the user first uses the stateful session bean, the bean remote referenceis stored
    in the user session object. Even though the user session is activeand not invalidated,
    stateful session bean is getting timed-out. I am using weblogic 6.1with SP2.
    Please help. Thanks.
    Below is the exception stack trace:
    weblogic.ejb20.locks.LockTimedOutException: The lock request from EJB:SearchList
    HandlerBean with primary key:10,085,579,643,420,691 timed-out afterwaiting 0
    ms
    The transaction or thread requesting the lock was:Thread[ExecuteThread:'10'
    f
    or queue: 'default',5,Thread Group for Queue: 'default'].
    at weblogic.ejb20.locks.ExclusiveLockManager$LockBucket.lock(ExclusiveLo
    ckManager.java:448)
    at weblogic.ejb20.locks.ExclusiveLockManager.lock(ExclusiveLockManager.j
    ava:258)
    at weblogic.ejb20.manager.StatefulSessionManager.acquireLock(StatefulSes
    sionManager.java:226)
    at weblogic.ejb20.manager.StatefulSessionManager.acquireLock(StatefulSes
    sionManager.java:216)
    at weblogic.ejb20.manager.StatefulSessionManager.preInvoke(StatefulSessi
    onManager.java:310)
    at weblogic.ejb20.internal.BaseEJBObject.preInvoke(BaseEJBObject.java:11
    7)
    at weblogic.ejb20.internal.StatefulEJBObject.preInvoke(StatefulEJBObject
    java:170)
    at com.sherwin.sweep.services.common.SearchListHandlerBean_w4ccs4_EOImpl
    getSize(SearchListHandlerBean_w4ccs4_EOImpl.java:234)

  • EJB 3.0 - Communicate an Applet with a Session Bean

    Hello
    I'm developing an EJB 3.0 app (eclipse and glassfish tools bundle), and I have an applet that has to use remote session beans.
    QUESTION: Is it possible for the applet to connect to EJB?
    QUESTION: By creating a J2EE application client project, can I use @EJB annotations to inject the session bean directly to the applet, avoiding the JNDI lookup?
    (since I imagine that the anwser to the second one is NO, I do the following consideration)
    Given an application client project, I imagine that this application can run remotely on a client machine/JRE. Then this application can use Annotations/injection facilities whenever it runs on a J2EE client container (which I assume consists of a set of libraries provided by the application server vendor, Glassfish in that case). Could this application be deployed using Java Web Start? If so, why can't it be deployed as an applet? (both options run in a client JRE, don't they?).
    QUESTION: In either case (applet or JWS), how do I have to package the JAR file (using Eclipse) so that it contains the needed libraries for accessing the EJB? Which are those libraries?
    At the time being, I'm trying to implement a sample application that follows the "Applet doing JNDI lookup" approach. I have:
    - an EAR project
    - an EJB project (containing an Entity Bean and a Stateless Session Bean with a @Remote interface)
    @Remote
    public interface HelloRemote {
         public String hello(String name);
    @Stateless
    public class Hello implements HelloRemote {
         @Override
         public String hello(String name) {
              return "Hello "+name+"!!";
    }- an Application Client project (containing the applet code):
    public class ClientApplet extends JApplet {
         public void init(){     
              try {
                   Context jndiContext = getInitialContext( );
                   HelloRemote server = (HelloRemote) jndiContext.lookup(HelloRemote.class.getName());
                   setContentPane(new JLabel(server.hello("Gerard")));
              } catch (NamingException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
         private Context getInitialContext() throws NamingException{
              Properties props = new Properties();
              props.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory");
              props.setProperty("org.omg.CORBA.ORBInitialHost", "myhost");
              props.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
              return new InitialContext(props);
    }- a static web project (with a sample web page that contains the applet object the corresponding applet JAR file)
    I tried to export the Application Client project as an "application client JAR", in the hope that the java EE libraries bundled with glassfish (listed as libraries of this project) would be packaged too.
    No success, so now I'll try to copy all the JAR files (one by one) into the +\WebContent\+ folder of the Web Project, and add references to each of them in the archive="" attribute of the +<applet>+ HTML tag. Although this might work, I suspect that I am missing the good/easy way of doing it. Any suggestions?
    Thanks in advance,
    Gerard
    Edited by: gsoldevila on May 6, 2009 7:09 AM

    An Applet can communicate with an EJB via JNDI lookup but I would (personally) use an intermediate Servlet to handle this. Client to Servlet communication is http whereas to ejb is iiop - which might be blocked.
    Injection only works in managed classes (EJB, Servlet, Listeners..) and an Application Client main class. So yes you could use an app client for handling resource injection.
    m

  • 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

  • How can I set a Session bean timeout

    Hello !
    How can I set a Session bean to time out eg. 48 hours ?
    Thanks
    Uiloq Slettemark

    For stateful session beans you can use the timeout attribute in the orion-ejb-jar e.g.
    <session-deployment timeout=1800 ..>
    this is specified in seconds and Default Value: 30 (minutes)
    regards
    Debu

  • EJB 3.0 Stateful session bean shared between Servlet's

    Hello
    I have a bit of a noob question regarding Stateful sessions beans.
    I am wanting to know if there is a way that I can share an instance of a session bean between multiple HttpServlet instances?
    I am sending XML messages from a mobile J2ME application, there will be several http POST's made from the mobile client to the server. I would like these multiple POST's to be passed from the handling servlet instance to the same uniquely identified single stateful session bean instance (i can then @Remove the stateful bean when I have finished my several requests).
    I would greatly appreciate any tips anyone could give me.

    If not, your only option is to maintain the
    association yourself by creating a unique id for
    each
    conversation and storing that id along with the SFSB
    reference in the ServletContext. Then you'll
    need to pass the id in along with each invocation to
    retrieve the appropriate SFSB reference.Thanks for your reply.
    Will I always be presented with the same ServletContext instance? Even if the time between requests might be many minutes? Where can I learn more about how to use the ServletContext?
    Thanks!

  • Problem Calling Remote Session Bean Method

    Need help. I am trying to call a method in a remote stateless session bean in an EJB in my web application from a stateless session bean in a different EJB in the web application. I am getting a run-time error that says,
    "java.lang.NoClassDefFoundError: dtpitb.common.sb.reports.CommonReportsHome"
    ref = ctx.lookup( jndiName );
    // Cast to Local Home Interface using RMI-IIOP
    commonReportsHome = (CommonReportsHome)
    PortableRemoteObject.narrow(ref, CommonReportsHome.class);
    If while in a session bean of an EJB, I want to call a public method in the session bean of a totally different EJB, is there something in particular I am missing. I can make the call from the web application code. I can make a remote call from this session bean to itself in the exact same fashion. I just can't call a session bean in another EJB. All thoughts are welcome.
    Thanks,
    Pete

    Thanks for replying. That could very well be the case I suppose. I'm using JBuilder and WebLogic, and JBuilder pretty much does all of the deployment descriptor code for me. However, maybe this is something I need to incorporate manually.
    One EJB is in the same project as the web application code. The other EJB (common_ejb) is in another project. The calling session bean is in the project with the web app, and the remote session bean method that I'm targeting is in the common EJB session bean. Both EJBs are included in the web app's WEB-INF\lib dir and in the war file.
    So theoretically, this isn't an unconventional practice I assume?
    Thanks,
    Pete

  • Problem While calling a session bean (J2EE)

    Hi!!
    Please see my client-side code..where I am calling a session bean (J2EE Server)
    It's correct or not?????
    InitialContext ctx = new InitialContext();
    Object objref = ctx.lookup("SecDbSecRoleJndi");
    SecBusSecRoleHome home =(SecBusSecRoleHome)PortableRemoteObject.narrow(objref,SecBusSecRoleHome.class);
    SecBusSecRoleRemote remote =(SecBusSecRoleRemote)PortableRemoteObject.narrow(home.create(),SecBusSecRoleRemote.class);
    Here I am getting the error at 3rd line
    java.lang.ClassCastException
    at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:296)
    at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
    at TestServlet.init(TestServlet.java:22)
    Please do the favor to me..reply me back.
    Bhumika

    Hello,
    Hope you are bale to sole the problem by this time. Iam using the follwing code and its working fine for me. i'm using the weblogic application server.
    <%@ page import="javax.naming.*, java.rmi.*, javax.ejb.*, java.util.*,java.rmi.server.*,java.net.*,javax.rmi.PortableRemoteObject,com.hmp.webcasting.services.ejb.*"%>
    <%
    try{             
    Properties prop = new Properties();
    prop.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
              System.out.println("Hello......3333333333Test");
              prop.put(Context.PROVIDER_URL, "t3://pani:7001");
              InitialContext ctx = new InitialContext(prop);
    Object home = ctx.lookup("personMgr");
              KeywordsMgrHome roleHome = (KeywordsMgrHome) javax.rmi.PortableRemoteObject.narrow(home, KeywordsMgrHome.class);
              KeywordsMgr kmgr=roleHome.create();
              //KeywordsMgrHome roleHome = (KeywordsMgrHome) ctx.lookup("personMgr");;
              System.out.println(roleHome);
              System.out.println(kmgr);
              }catch(Exception e){
              e.printStackTrace();
              %>
    Try using this.
    Genrally calss cast exception occurs if you are using classes out of a shared library directory instead of within the webapp, or if you are somehow maintaining references to object instances created with the old class and trying to use them after the reload. So try to delete the old file files and deploy the bean once again . Hope this may help you. Anyway if you can give the full code i will check by deploying it.([email protected])

Maybe you are looking for

  • How to install windows 7 in dual boot on Satellite M840?

    Hi, I got this M-840 Notebook a week ago pre-installed with windows 8. I cannot replace the OS with windows 7 as most of my applications are Win 8 incompatible. I tired clean install - doesn't work. I created a NTFS partition and tried installing win

  • I can no longer create a simple bookmark . . . w/ same vers. I've had no problems with before (3.6.10)

    With vers. 3.6.10, which I've used without incident thus far . . . . I all of a sudden cannot create a bookmark. When I right-click to open the choices to save a link in "Bookmarks" . . . . either nothing happens (most of the time), meaning no window

  • Can i have tow HttpService in the same application???

    I try to use tow HttpService (one for delete row in a table and the other for read the table): <mx:HTTPService id="listcls" url=" http://127.0.0.1:32000/affcls.php" useProxy="false" method="POST"> <mx:request xmlns=""> <clsci>{clsci.text}</clsci><cls

  • MY HP OFFICEJET 8500a910a , SCAN,PRINT PROBLEMS

    I can print from my laptop but when i try to scan it isn't picking up any information paper comes out blank when i scan manually or from laptop.  when i try to manually copy only a blank page will come out as well. ANY HELP.  I JUST SET UP MY PRINTER

  • VC Bi Integration wizard -

    Dear gurus, I saw another post which has a similar problem, but unfortunately it didnot answer my question, so i am opening a new one here. I am trying to create a model for displaying BI data in the portal. I am able to see the queries in VC and eve