Session Bean - Seesion client

what is the main use session bean - session client?
please can one explain.

thanks for the link.
But am struggling . in the following please help me.
first watch out the example.
eg : select starting_number from tablename1;
starting_number // field name
1000 // user defined.
after saving the data. perform increment operation.
starting number // field name
1001 //auto increment takes by with help of code.
Most often peoples using sequence number for generating unique number.
My idea is :
i will define the start number as 1000 and perform increment operation .does not mention end number(i.e) it will be infinity.
this starting number field is in defined in a table. while am commit the data in the UI . unique number must be generated.(number generation based on the field what it contains)
how to handle this?
but i tried in the following manner:
In SessionEJBClient - In the main function
table_ name b; //b - object of that table;
String str1 = b.getNextnum(); // getting number from the table
int num = Integer.parseInt(str1); // convert it.
num = num+1; // increment one by one
String str2 = new Integer(num).toString();
b.setProsNextId(str2); // assign to the table
by using
tx.commit // update the newly generated number to corresponding table.
it's working .
but it unable to show in user interface.
how can i communicate Session Client - UI. Is it Possible to do this.
how to show the generated number in UI. if any one know.please guide that will be great.

Similar Messages

  • How call session bean from Client side

    Hi
    calling session bean from client side it gives Lookup erroe, it gives JNDI error
    how we know session bean is working. in Admin tree bean statis is reb Flaf, and ID is "Down" how we activate it..
    null

    If you can make a connection using sess_sh, then you know that you have configured your database and listener properly. If it is not working, read the manuals that you can download from technet. They are pretty good, and if you follow the directions, you should see success.
    Good Luck!
    Brad

  • EJB 3.0 Session Bean Remote Client

    Hi,
    I am planning to migrate my EJB 2.1 to EJB 3.0. My old session bean is accessed by a remote java client. I just have to include this piece of code:
    Hashtable props = new  Hashtable();
    props.put("java.naming.factory.initial", com.sun.jndi.cosnaming.CNCtxFactory");
    props.put("java.naming.provider.url", "iiop://" + host_ + ":" + port_);I also have to generate rmistubs for the ejb. I have deployed my EJB 3.0 in a Sun Appserver, checking the "Generate RMIStubs" box but I couldn't find the client jar file. In EJB 3.0, should I use the same approach as the 2.1? Or should I use the @EJB annotation? How will I access a remote EJB 3.0 using the @EJB annotation? Thanks in advance.
    Regards,
    Andrew
    Message was edited by:
    bashdrew

    EJB 3.0 remote business interfaces are do not have the same interoperability requirements as the EJB 2.x Home/Remote view. If you need access to your EJB 3.0 bean from a legacy client, you can add a 2.x-style Home/Remote view to your bean by either using the <home>/<remote> elements in ejb-jar.xml or the @RemoteHome annotation. Note that the 2.x-style Home/Remote interfaces are completely separate from the 3.0 Remote Business interface.
    Also, in SUN's implementation if your EJB 3.0 bean has both a 3.0 Remote business and a 2.x Home/Remote interface there is no default global JNDI name for the bean. You'll need to assign it explicitly using the @Stateless/@Stateful mappedName() attribute or sun-ejb-jar.xml.
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Adding Set of Session Beans generates client with wrong session bean names

    Hi,
    I am trying to import a set of session beans deployed on Sun Java Sever 8.2 using Netbeans 6.0. on windows XP.
    The problem is that the imported set generated by the IDE has wrong session bean names and out of 8 session beans in the client jar only 6 are shown (and different 6 every time). Also the remote methods of one bean are associated with another bean and every time its a different set of bean clients generated.
    I am really perplexed with this behavior. Any help on this issue will be highly appreciated.

    An RMI/IIOP parameter type must meet one of thefollowing criteria:
    It must be a primitive type, or it must implementeither java.rmi.Remote or java.io.Serializable,
    or it must be an interface for which the runtime typesatisfies the previous criteria,
    or it must be an array containing elements thatsatisfy the previous criteria.This tells you exactly what you need to do.

  • Exception while i m looking up my session bean from Client

    hi,
    actully i try to make a simple session bean ok
    first i make a seession bean and make his deployment discriptor
    and put all thing a jar file and deployee this file on Server its successfuly
    loaded and deploed.
    ok the problem is when i make a client bean and try to run it. it give me this exception
    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:643)      
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246)      
    at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:283)      
    at javax.naming.InitialContext.lookup(InitialContext.java:350)      
    at HelloClient.main(HelloClient.java:15)
    Process Exit...
    i where i right the machine name where my appserver is runing. inside lookup method
    client bean code is
    =====================
    import java.rmi.*;
    import javax.naming.*;
    import java.util.*;
    import HASSSAN.*;
    public class HelloClient {
         public static void main(String arg[]) {
         try {
              javax.naming.Context ctx =
              new javax.naming.InitialContext(System.getProperties());
              Object obj = ctx.lookup("HelloBean");
              HelloHome home = (HelloHome) javax.rmi.PortableRemoteObject.narrow(obj,HelloHome.class);
              Hello hello =home.create();
              System.out.println(hello.sayHello());
              hello.remove();
              System.out.println("Success");
         }catch(Exception e) {
              e.printStackTrace();
    }

    Two hints:
    Need to specify class name in environment or system
    property, or as an applet parameter,
              javax.naming.Context ctx = new javax.naming.InitialContext(System.getProperties());This means you need to check what you're putting on your command line in the way of "-D" settings.
    or in an application resource file:You can get this from the methodology jgongo mentions.

  • Combining single transaction between session bean & application client

    Hi All,
    The following transaction exception was encountered when trying to combine a EmployeeSessionBean.create(Employee) method in an application client:
    Application Client output
    SEVERE: null
    javax.transaction.SystemException: org.omg.CORBA.UNKNOWN: ----------BEGIN server-side stack trace----------
    org.omg.CORBA.UNKNOWN: WARNING: IOP00010002: Unknown user exception thrown by the server - exception: org.eclipse.persistence.exceptions.DatabaseException; message:
    Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: java.lang.IllegalStateException: cannot add non-XA Resource to global JTS transaction.
    Error Code: 0
    Call: INSERT INTO EmployeeDB.Project (ID, NAME) VALUES (?, ?)
    bind => [2 parameters bound]
    Query: InsertObjectQuery(domain.Project@19d2d53) vmcid: OMG minor code: 2 completed: Maybe
    at com.sun.gjc.spi.base.DataSource.getConnection(DataSource.java:117)
    at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:126)
    ----------END server-side stack trace---------- vmcid: OMG minor code: 2 completed: Maybe
    at com.sun.jts.jta.TransactionManagerImpl.commit(TransactionManagerImpl.java:332)
    at com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate.commitDistributedTransaction(JavaEETransactionManagerJTSDelegate.java:184)
    at com.sun.enterprise.transaction.JavaEETransactionManagerSimplified.commit(JavaEETransactionManagerSimplified.java:873)
    at com.sun.enterprise.transaction.UserTransactionImpl.commit(UserTransactionImpl.java:208)
    at applicationClient(*applicationClient.java:229*)
    GF 3.1 Server log
    WARNING: A system exception occurred during an invocation on EJB EmployeeSessionBean method public void ejb.EmployeeSessionBean.create(Employee) javax.ejb.EJBException
    Caused by: javax.persistence.TransactionRequiredException
    at ejb.EmployeeSessionBean.create(*EmployeeSessionBean.java:27*)
    SEVERE: RAR5027:Unexpected exception in resource pooling
    java.lang.IllegalStateException: cannot add non-XA Resource to global JTS transaction.
    WARNING: RAR7132: Unable to enlist the resource in transaction. Returned resource to pool. Pool name: [ mysqlPool ]
    WARNING: RAR5117 : Failed to obtain/create connection from connection pool [ mysqlPool ]. Reason : com.sun.appserv.connectors.internal.api.PoolingException: java.lang.IllegalStateException: cannot add non-XA Resource to global JTS transaction.
    WARNING: RAR5114 : Error allocating connection : [Error in allocating a connection. Cause: java.lang.IllegalStateException: cannot add non-XA Resource to global JTS transaction.]
    WARNING: Local Exception Stack:
    Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.2.0.v20110202-r8913): org.eclipse.persistence.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: java.lang.IllegalStateException: cannot add non-XA Resource to global JTS transaction.
    Below is the code snippet of EmployeeSessionBean & client.applicationClient:
    @Stateless
    //@TransactionManagement(TransactionManagementType.BEAN)
    public class EmployeeSessionBean implements EmployeeService {   
        @PersistenceContext(unitName="EmployeeDB-PU")
        private EntityManager manager;
        public void create(Employee employee) {
            manager.persist(employee);  // line 27
    import javax.transaction.UserTransaction;
    public class applicationClient {
    @Resource UserTransaction tx;
    @EJB private static EmployeeService bean;
    try {
        tx.begin();
        Employee employee = new Employee()
            bean.create(employee);
    } finally {
           try {
                 tx.commit();  // line 229
    }How to relinguish transaction on EmployeeSessionBean so that all transaction could take place in applicationClient side only?
    I am trying to apply examples in Pro JPA 2 to a Java EE 6 ManyToMany application.
    Your assistance would be much appreciated.
    Thanks,
    Jack

    Hi r035198x,
    Thank you for some solid advice and would rather JPA take care of all the special cases such as keeping the records unique.
    Below are the changes made as suggested in ( 1 ), ( 2 ), ( 3 ):
    @Entity
    @IdClass(EmployeePK.class)
    @Table(name="EMPLOYEE", catalog="EmployeeDB", schema="")
    public class Employee implements Serializable {
        @Id
        @Column(name="FIRSTNAME")
        private String firstName;
        @Id
        @Column(name="SURNAME")
        private String surName;
        @Id
        @Column(name="DOB")
        @Temporal(TemporalType.DATE)
        private Date dob;
        @ManyToMany(cascade={CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH}, fetch=FetchType.EAGER)
        @JoinTable(name="EMPLOYEE_PROJECT", catalog="EmployeeDB", schema="",
               joinColumns={@JoinColumn(name="FIRSTNAME_ID", referencedColumnName="FIRSTNAME"),
                            @JoinColumn(name="SURNAME_ID", referencedColumnName="SURNAME"),
                            @JoinColumn(name="DOB", referencedColumnName="DOB")},
               inverseJoinColumns={@JoinColumn(name="PROJECT_ID")})
            private Set<Project> projects = new HashSet<Project>();
    @Entity
    @Table(name="PROJECT", catalog="EmployeeDB", schema="")
    public class Project implements Serializable {
        @Id
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        @Column(name="ID")
        private int id;
        @ManyToMany(mappedBy="projects", cascade={CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH}, fetch=FetchType.EAGER)
            @JoinTable(name="EMPLOYEE_PROJECT", catalog="EmployeeDB", schema="",
               joinColumns={@JoinColumn(name="PROJECT_ID", referencedColumnName="PROJECT_ID")},
               inverseJoinColumns={@JoinColumn(name="FIRSTNAME_ID", referencedColumnName="FIRSTNAME"),
                            @JoinColumn(name="SURNAME_ID", referencedColumnName="SURNAME"),
                            @JoinColumn(name="DOB_ID", referencedColumnName="DOB")})
        private Set<Employee> employees = new HashSet<Employee>();
    @Stateless
    public class EmployeeSessionBean implements EmployeeService {
        @PersistenceContext(unitName="EmployeeDB-PU") private EntityManager manager;
        public void create(Employee employee)
            manager.persist(employee);
    public class applicationClient {
        @EJB
        private static EmployeeService bean;
        public static void main(String[] args) {
        Employee employee = new Employee()
        bean.create(employee);   // line 209
    } I have diverged slightly from using simple primary key (EMPLOYEE_ID) to composite key class (FIRSTNAME, SURNAME, DOB) to resemble the actual application.
    Also gone back to using non - XADatasources since I am depending on JTA to do all the hardwork on the server side.
    Unfortunately, we have hit a snag once again with the following exception still:
    Application Client Output
    java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.glassfish.appclient.client.acc.AppClientContainer.launch(AppClientContainer.java:432)
    at org.glassfish.appclient.client.AppClientFacade.launch(AppClientFacade.java:182)
    at org.glassfish.appclient.client.AppClientGroupFacade.main(AppClientGroupFacade.java:65)
    Caused by: javax.ejb.EJBException: java.rmi.MarshalException: CORBA MARSHAL 1330446347 Maybe; nested exception is:
    org.omg.CORBA.MARSHAL: ----------BEGIN server-side stack trace----------
    org.omg.CORBA.MARSHAL: WARNING: IOP00810011: Exception from readValue on ValueHandler in CDRInputStream vmcid: OMG minor code: 11 completed: Maybe
    Caused by: java.io.StreamCorruptedException: WARNING: ORBIO00013: Stream corrupted
    ----------END server-side stack trace---------- vmcid: OMG minor code: 11 completed: Maybe
    at ejb._EmployeeService_Wrapper.create(ejb/_EmployeeService_Wrapper.java)
    at applicationClient(applicationClient.java:209)
    GF 3.1 Server log
    WARNING: IOP00810011: Exception from readValue on ValueHandler in CDRInputStream
    org.omg.CORBA.MARSHAL: WARNING: IOP00810011: Exception from readValue on ValueHandler in CDRInputStream vmcid: OMG minor code: 11 completed: Maybe
    Caused by: java.lang.NullPointerException
    WARNING: ORBIO00013: Stream corrupted
    java.io.StreamCorruptedException: WARNING: ORBIO00013: Stream corrupted
    Your valuable input would be very appreciated.
    Thanks,
    Jack

  • Problem using application client for local stateful session bean

    Hi,
    I have deployed a local stateful session bean in Sun J2EE 1.4 application server.
    On running the applclient for the stateful session bean application client i get the following error:
    Warning: ACC006: No application client descriptor defined for: [null]
    cant we use application client for local stateful session beans. becoz the application runs smoothly when i changed the stateful sesion bean to remote.

    Hi,
    No, an ejb that exposes a local view can only be accessed by an ejb or web component packaged within the same application. Parameters and return values for invocations through the ejb local view are passed by reference instead of by value. That can't work for an application client since it's running in a separate JVM.
    --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

  • Context.lookup in a Servlet always returns the same Stateful Session Bean

    Hi,
    I am working on an application in which a Servlet should obtain one StateFul Session Bean per client. I read in EJB 3.0 in Action that to do so I should use a jndi lookup and save the result of the lookup in an HttpSession. This works fine for me when I have a single client.
    My issue is that when I have several clients, context.lookup returns the same SFSB for each client. This means that I end up having a single SFSB for the whole application. I've been browsing the web for a while now trying to find a solution but haven't had any luck yet.
    The code I use to obtain and save the SFSB is the following:
    HttpSession session = request.getSession(true);
    DFMServiceRemote service = (DFMServiceRemote) session.getAttribute("DFMService");
    if (null == service)
         service = (DFMServiceRemote) new InitialContext().lookup("DFMService");
         session.setAttribute("DFMService", service);
    }Using different browser, I end up with different HttpSession but a single SFSB. The only workaround I found is to create the context with environment variables or properties. It then returns different SFSBs for different HttpSession. The workaround code is as below:
    Hashtable<String, String> env = new Hashtable<String, String>();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
    env.put(Context.SECURITY_PRINCIPAL, "oc4jadmin");
    env.put(Context.SECURITY_CREDENTIALS, "welcome");
    env.put(Context.PROVIDER_URL, "ormi://localhost:23791/DriverFatigue");
    service = (DFMServiceRemote) new InitialContext(env).lookup("DFMService");My question is the following. How can I get a different instance of an SFSB every time I execute context.lookup without specifying properties.
    Thanks in advance for any help,
    Matthieu Siggen

    I just did something similar in another project using JBoss instead of oc4j and didn't have any problem. I expect I missed a configuration file in oc4j or there is a conflict somewhere.

  • Paradox - Should entity CMP EJB be faster than stateless session bean?

    Please bear with me on this.
    Just thinking of this scenario: hello world application. It can be implemented both as stateless session bean and entity bean.
    There's no persistent. So for the entity bean, it will be container managed, and no code to do anything to the load/remove/create. - comparably the same as stateless bean.
    Next, for the stateless session bean, each client call would require a dedicated instance of the EJB on the server (although for a very short amount of time). For the entity bean, it's shared, so only 1 instance is needed. It's also thread safe.
    So, for a very high traffic, shouldn't the entity bean do better because of single instance?
    What's other overhead?
    Does the entity bean cost more connections than the stateless bean?

    Feels like a comparison between apples and oranges.
    A stateless session bean is like every other instance, so these can be pooled by the EJB container. The container is free to create an instance for each client if necessary. That's different.
    A stateless session bean doesn't have to deal with a database that may or may not be located on another machine the way an entity bean does. There could be another network round trip involved. That's different.
    Session and entity beans are intended for entirely different purposes. Just because you can write Hello World with both doesn't mean it's representative of what EJBs are used for. I don't think it's a good, meaninful comparison. JMO - MOD

  • A question about entity manager in stateless session bean.

    JSR 220 ejbcore, page 47 : stateless session bean: All business object references of the same interface type for the same stateless session bean have the "same object identity", which is assigned by the container.
    So, if we have two session beans in client code...
    @EJB Cart cart1;
    @EJB Cart cart2;
    then cart1.equals(cart2)==true
    If we declare entity manager in stateless session bean:
    @PersistenceContext( unitName="ds" ,type=PersistenceContextType.TRANSACTION)
    private EntityManager em;If cart1 and cart2 are the same reference, do we have any problem when using the same reference(maybe the same em? ) to get data from db?

    If cart1 and cart2 are the same reference, do we have
    any problem when using the same reference(maybe the
    same em? ) to get data from db?No. In EJB, there is a distinction between the EJB reference and the bean instance.
    Each time you make an invocation on an EJB reference for a stateless session bean,
    the container can choose any instance of that bean's bean class to process the
    invocation. That's true whether you invoke the same reference multiple times or
    two difference references to the same bean.
    Each bean instance is guaranteed to be single-threaded.

  • Accessing the same stateful session bean from multiple clients in a clustered environment

    I am trying to access the same stateful session bean from multiple
              clients. I also want this bean to have failover support so we want to
              deploy it in a cluster. The following description is how we have tried
              to solve this problem, but it does not seem to be working. Any
              insight would be greatly appreciated!
              I have set up a cluster of three servers. I deployed a stateful
              session bean with in memory replication across the cluster. A client
              obtains a reference to an instance of one of these beans to handle a
              request. Subsequent requests will have to use the same bean and could
              come from various clients. So after using the bean the first client
              stores the handle to the bean (actually the replica aware stub) to be
              used by other clients to be able to obtain the bean. When another
              client retrieves the handle gets the replica aware stub and makes a
              call to the bean the request seems to unpredictably go to any of the
              three servers rather than the primary server hosting that bean. If the
              call goes to the primary server everything seems to work fine the
              session data is available and it gets backed up on the secondary
              server. If it happens to go to the secondary server a bean that has
              the correct session data services the request but gives the error
              <Failed to update the secondary copy of a stateful session bean from
              home:ejb20-statefulSession-TraderHome>. Then any subsequent requests
              to the primary server will not reflect changes made on the secondary
              and vice versa. If the request happens to go to the third server that
              is not hosting an instance of that bean then the client receives an
              error that the bean was not available. From my understanding I thought
              the replica aware stub would know which server is the primary host for
              that bean and send the request there.
              Thanks in advance,
              Justin
              

              If 'allow-concurrent-call' does exactly what you need, then you don't have a problem,
              do you?
              Except of course if you switch ejb containers. Oh well.
              Mike
              "FBenvadi" <[email protected]> wrote:
              >I've got the same problem.
              >I understand from you that concurrent access to a stateful session bean
              >is
              >not allowed but there is a
              >token is weblogic-ejb-jar.xml that is called 'allow-concurrent-call'
              >that
              >does exactly what I need.
              >What you mean 'you'll get a surprise when you go to production' ?
              >I need to understand becouse I can still change the design.
              >Thanks Francesco
              >[email protected]
              >
              >"Mike Reiche" <[email protected]> wrote in message
              >news:[email protected]...
              >>
              >> Get the fix immediately from BEA and test it. It would be a shame to
              >wait
              >until
              >> December only to get a fix - that doesn't work.
              >>
              >> As for stateful session bean use - just remember that concurrent access
              >to
              >a stateful
              >> session bean is not allowed. Things will work fine until you go to
              >production
              >> and encounter some real load - then you will get a surprise.
              >>
              >> Mike
              >>
              >> [email protected] (Justin Meyer) wrote:
              >> >I just heard back from WebLogic Tech Support and they have confirmed
              >> >that this is a bug. Here is their reply:
              >> >
              >> >There is some problem in failover of stateful session beans when its
              >> >run from a java client.However, it is fixed now.
              >> >
              >> >The fix will be in SP2 which will be out by december.
              >> >
              >> >
              >> >Mike,
              >> >Thanks for your reply. I do infact believe we are correctly using
              >a
              >> >stateful session bean however it may have been misleading from my
              >> >description of the problem. We are not accessing the bean
              >> >concurrently from 2 different clients. The second client will only
              >> >come into play if the first client fails. In this case we want to
              >be
              >> >able to reacquire the handle to our stateful session bean and call
              >it
              >> >from the secondary client.
              >> >
              >> >
              >> >Justin
              >> >
              >> >"Mike Reiche" <[email protected]> wrote in message
              >news:<[email protected]>...
              >> >> You should be using an entity bean, not a stateful session bean
              >for
              >> >this application.
              >> >>
              >> >> A stateful session bean is intended to be keep state (stateful)
              >for
              >> >the duration
              >> >> of a client's session (session).
              >> >>
              >> >> It is not meant to be shared by different clients - in fact, if
              >you
              >> >attempt to
              >> >> access the same stateful session bean concurrently - it will throw
              >> >an exception.
              >> >>
              >> >> We did your little trick (storing/retrieving handle) with a stateful
              >> >session bean
              >> >> on WLS 5.1 - and it did work properly - not as you describe. Our
              >sfsb's
              >> >were not
              >> >> replicated as yours are.
              >> >>
              >> >> Mike
              >> >>
              >> >> [email protected] (Justin Meyer) wrote:
              >> >> >I am trying to access the same stateful session bean from multiple
              >> >> >clients. I also want this bean to have failover support so we want
              >> >to
              >> >> >deploy it in a cluster. The following description is how we have
              >tried
              >> >> >to solve this problem, but it does not seem to be working. Any
              >> >> >insight would be greatly appreciated!
              >> >> >
              >> >> >I have set up a cluster of three servers. I deployed a stateful
              >> >> >session bean with in memory replication across the cluster. A client
              >> >> >obtains a reference to an instance of one of these beans to handle
              >> >a
              >> >> >request. Subsequent requests will have to use the same bean and
              >could
              >> >> >come from various clients. So after using the bean the first client
              >> >> >stores the handle to the bean (actually the replica aware stub)
              >to
              >> >be
              >> >> >used by other clients to be able to obtain the bean. When another
              >> >> >client retrieves the handle gets the replica aware stub and makes
              >> >a
              >> >> >call to the bean the request seems to unpredictably go to any of
              >the
              >> >> >three servers rather than the primary server hosting that bean.
              >If
              >> >the
              >> >> >call goes to the primary server everything seems to work fine the
              >> >> >session data is available and it gets backed up on the secondary
              >> >> >server. If it happens to go to the secondary server a bean that
              >has
              >> >> >the correct session data services the request but gives the error
              >> >> ><Failed to update the secondary copy of a stateful session bean
              >from
              >> >> >home:ejb20-statefulSession-TraderHome>. Then any subsequent requests
              >> >> >to the primary server will not reflect changes made on the secondary
              >> >> >and vice versa. If the request happens to go to the third server
              >that
              >> >> >is not hosting an instance of that bean then the client receives
              >an
              >> >> >error that the bean was not available. From my understanding I
              >thought
              >> >> >the replica aware stub would know which server is the primary host
              >> >for
              >> >> >that bean and send the request there.
              >> >> >
              >> >> >Thanks in advance,
              >> >> >Justin
              >>
              >
              >
              

  • How to run a client program in Session bean using weblogic 8.1

    Hi
    I am new to weblogic server 8.1. I sucessfully deployed session ejb Session Bean. I created sessionbean jar file and put it it classpath also.
    and also i created sessiobeanclient jar file, it included in class path.
    While running client program it throws exception like noclass def found exception
    plz tell me the right way to run the session ejb program.
    bye

    Hi,
    You have to follow the given steps before you are going to run the client program that invokes the session bean .
    1)set the Weblogic Environment using the tool setWLSEnv
    2)place the Session bean jar file in classpath
    3)run the client program
    Note:If the client has to execute on remote machine we need to copy client class,remote interface, home interface and other classes which are used as
    parameters and return types.
    Regards
    Anilkumar kari

  • Creating multiple stateful session beans from a java client. (EJB 3.0)

    I'm having difficulties with the following:
    To access the ShoppingCartBean, I have to put the following annotation in my standalone java client:
    @EJB
    private static ShoppingCartRemote shoppingCartBean;
    The static must be there, thus only one ShoppingCartBean will exist within my java client. But as the ShoppingCartBean is a stateful session bean, I want to be able to get different beans of the same type.
    What is the correct way to do this in EJB 3.0?

    Great question. Because Home interfaces have been removed for the EJB 3.0 simplified
    API, stateful session bean creation happens as a side-effect of injection. However, the
    same is true of EJB 3.0 business interface lookups. The easiest way to create additional
    stateful session beans is to lookup the same dependency that was declared via your
    @EJB annotation.
    E.g.,
    // Assuming the declaring class is pkg1.ShoppingCartClient.java
    InitialContext ic = new InitialContext();
    ShoppingCartRemote scr1 = (ShoppingCartRemote)
    ic.lookup("java:comp/env/pkg1.ShoppingCartClient/shoppingCartBean");
    Note that the name relative to java:comp/env is the default associated with your
    @EJB annotation since the name() attribute wasn't used. Alternatively, you
    could have used :
    @EJB(name="scb") private static ShoppingCartRemote shoppingCartBean;
    InitialContext ic = new InitialContext();
    ShoppingCartRemote scr1 = (ShoppingCartRemote) ic.lookup("java:comp/env/scb");
    Yet another alternative is to declare the @EJB at the class-level. This just defines
    the dependency without any injection, which is fine if you want to create a bunch of
    them via lookup anyway.
    @EJB(name="scb", beanInterface=ShoppingCartRemote.class)
    public class .... {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Minimal requirements for remote client app to call a EJB 3 session bean

    I'm just starting to get into EJBs, trying to learn the EJB 3 APIs. I kind of understand the setup on the server side to create a session bean. What I don't understand is what I would have to deploy for each of the remote client app (Swing-based GUI or something like that) installations. Of course, the client app code would have to be deployed to each client desktop, but what stuff related to the session bean? Just the session bean interface class?
    For ease of discussion, let's say my bean is CalculatorBean, having two interfaces, CalculatorRemoteIface and CalculatorLocalIface. Let's also say my client app, CalculatorUI, is a simple Swing-based GUI that grabs a reference to a CalculatorBean.
    Other than just the Swing-based classes and the JRE, what JARs/classes will I want to deploy to each desktop?
    (Please assume the latest Sun Java System App Server 9 and Java EE 5, if you are familiar with them.)

    Personally- I would deploy your backend
    in EJB 3.0, but then expose it as a web service. It
    is MUCH easier for your clients to connect to a web
    service (and mantain that code), then to have them
    connect via RMI/JNDI.Oh, I would say it's quite the opposite. RMI/JNDI is MUCH easier from a client point of view than web services. To make web services work easy from the client side you have to generate code and the tools that generate code from a web services wsdl file doesn't do a great job today. But that was not the question. But take some time reading this article about webservices...it's quite funny and spot on: http://wanderingbarque.com/nonintersecting/2006/11/15/the-s-stands-for-simple
    Now to your question, yes you will need the remote interface on the client side.
    /klejs

Maybe you are looking for

  • Updating error

    So I'm at a loss here. I put new music on my itunes and went to update my nano and it gave me an error message that said that my nano "can not be updated because all the playlists no longer exist" I then went and looked at my ipod and all of the song

  • [SOLVED] Xmonad - Use subLayout without tabs

    Hi there, I have a defined layout using subLayouts : codeLayout = spacing 6 $ windowNavigation $ subTabbed $ boringWindows $ ResizableTall 1 (2/100) (1/2) [] ||| noBorders Full According to the documentation, subTabbed is a use of subLayout with addT

  • Photoshop Elements 9 Contacts

    I have PE9.  When I try to send a photo as an email attachment, I cannot input any contact info.  I get a pop-up that asks me to sign in to my Adobe ID.  When I try, it says Photoshop.com is not available, error code 400.  At no point do I get to a s

  • Why do I have to click 'Open' to open an application or document,  when previously in Tiger, all I had to do was click on the line or image in Flow?

    I've only had OSX 10.8.2 this last month, but I've found that whenever I want to open a document, I have to click 'Open' in 'Perform tasks with the selected item' function (The gearwheel with dropdown arrow). When I had Tiger, all I had to do was cli

  • TMS Configuration client depending

    Hello Community, i need information on how to configure TMS with the following scenario: Two Systems: DEV and PRD Two Clients: DEV with clients 100 (Customizing GTS) and 200 (Customizing ERP) PRD with clients 100 (GTS prod) and 200 (ERP prod) can you