Maintaining sessions with a java bean

I am trying to debug a Web App that occasionally loses its session when one
          page is being jsp_forwarded to another. The original JSP coder uses a Java
          bean named Session to hold all the sesssion information. The usebean tag is
          used to maintain the correct instance. This session loss did not occur when
          we were still running 5.1. Now with 6.1 we have this mysterious problem. Can
          anyone make suggestions on how to tackle this problem?
          The weblogic.xml file contains the working directory and the keepgenerated
          set to true. All else is default.
          Kenny
          

Try the following forum (about JSP technology)
http://forum.java.sun.com/forum.jspa?forumID=45

Similar Messages

  • Hi, I have quick question about use of USEBEAN tag in SP2. When I specify a scope of SESSION for the java bean, it does not keep the values that I set for variable in the bean persistent.Thanks,Sonny

     

    Make sure that your bean is implementing the serializable interface and that
    you are accessing the bean from the session with the same name.
    Bryan
    "Sandeep Suri" <[email protected]> wrote in message
    news:[email protected]..
    Hi, I have quick question about use of USEBEAN tag in SP2. When I
    specify a scope of SESSION for the java bean, it does not keep the
    values that I set for variable in the bean persistent.Thanks,Sonny
    Try our New Web Based Forum at http://softwareforum.sun.com
    Includes Access to our Product Knowledge Base!

  • Web Service from an EJB with an Java Bean: createSAXParseException

    Hi I am using Together to develop Web Services from an EJB+a Java Bean.
    I used the Trader Example, which includes an EJB + a Java Bean.
    Running the utility "ant" I get the following exception:
    "C:\bea\jdk131\jre\lib\rt.jar;C:\bea\jdk131\lib\rt.jar;c:\bea\wlserver6.1\lib\weblogic.jar;C:\Programme\Together5.5\lib\javax.jar;;"
    org.apache.tools.ant.Main
    WLS61: Error at line:6 col:12 ':' Already got a ':' in name
    WLS61:      at weblogic.xml.babel.baseparser.SAXElementFactory.createSAXParseException(SAXElementFactory.java:60)
    WLS61:      at weblogic.xml.babel.parsers.StreamParser.<init>(StreamParser.java:45)
    WLS61:      at weblogic.xml.babel.parsers.BabelXMLEventStream.startDocument(BabelXMLEventStream.java:28)
    WLS61:      at weblogic.soap.WebServiceProxy.getXMLStream(WebServiceProxy.java:600)
    WLS61:      at weblogic.soap.WebServiceProxy.getXMLStream(WebServiceProxy.java:577)
    WLS61:      at weblogic.soap.WebServiceProxy.getServiceFrom(WebServiceProxy.java:225)
    WLS61:      at weblogic.ant.taskdefs.ejb.WSGenHelper.writeClientJar(WSGenHelper.java:1125)
    WLS61:      at weblogic.ant.taskdefs.ejb.WSGenHelper.writeWSDL(WSGenHelper.java:1285)
    WLS61:      at weblogic.ant.taskdefs.ejb.WSGenHelper.saveDescriptors(WSGenHelper.java:1418)
    WLS61:      at weblogic.ant.taskdefs.ejb.WSGenHelper.output(WSGenHelper.java:1486)
    WLS61:      at weblogic.ant.taskdefs.ejb.WSGenHelper.doit(WSGenHelper.java:1520)
    WLS61:      at weblogic.ant.taskdefs.ejb.WSGen.execute(WSGen.java:93)
    WLS61:      at org.apache.tools.ant.Target.execute(Target.java:153)
    WLS61:      at org.apache.tools.ant.Project.runTarget(Project.java:898)
    WLS61:      at org.apache.tools.ant.Project.executeTarget(Project.java:536)
    WLS61:      at org.apache.tools.ant.Project.executeTargets(Project.java:510)
    WLS61:      at org.apache.tools.ant.Main.runBuild(Main.java:421)
    WLS61:      at org.apache.tools.ant.Main.main(Main.java:149)
    WLS61: Buildfile: build.xml
    WLS61:
    WLS61: wsgen:
    WLS61:
    WLS61: BUILD SUCCESSFUL
    WLS61:
    WLS61: Total time: 7 seconds
    WLS61: Finished with 19 Errors, 0 Warnings.

    Hi,
    try these links
    http://www.baigzeeshan.com/2010/11/creating-webservice-from-java-class-in.html
    http://www.baigzeeshan.com/2010/11/calling-webservice-in-oracle-adf-by.html
    Hope it help,
    Zeeshan

  • Problems with a java bean in Weblogic 5.1

    Hello,
              I am having a problem deploying a java bean in Weblogic 5.1:
              I have been given a .class and a .jar file for a java bean (not an EJB). I
              placed the .class file into e:\temp\WEB-INF\classes and added the following
              line to my weblogic.properties file:
              weblogic.httpd.webApp.testApp=e:/temp/
              I have also updated the web.xml file in the WEB-INF directory as follows:
              <?xml version="1.0" encoding="UTF-8"?>
              <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
              Application 1.2//EN"
              "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
              <web-app>
              <servlet>
              <servlet-name>EdIface</servlet-name>
              <jsp-file>test.jsp</jsp-file>
              </servlet>
              <servlet-mapping>
              <servlet-name>EdIface</servlet-name>
              <url-pattern>EdIface</url-pattern>
              </servlet-mapping>
              </web-app>
              When I try to access my http:\\server:port\testApp\test I get an "Error
              500 - internal server error".
              Has anyone had experice with deploying a java bean with jsut the .class and
              .jar file? Where should I put the .jar file?
              I appreciate any advice!
              

    Bump

  • Problem with Maintaining State with EJB3 Stateful Bean

    I'm a newbie in EJB3. I've wrote a Stateful bean together with JSF as the UI tier. Below is my Stateful bean.
    package com.dhydrated.business;
    import com.dhydrated.entity.User;
    import java.io.Serializable;
    import javax.ejb.Remove;
    import javax.ejb.Stateful;
    @Stateful
    public class LogonBean
            implements LogonRemote, Serializable {
        private User user;
        public void setUser(User user) {
            this.user = user;
        public User getUser() {
            return user;
    }In above code, I'm storing User object as the private variable. The problem is, whenever I set the User object in the 1st page, I'm unable to retrieve the same user object in the 2nd page. Seems like my Stateful bean does not saved the state or conversation of the bean.
    Appreciate if someone could tell me on how to save the state of above Stateful bean. Is there some other conf. that I might missed out?

    I was find good solution! =)
    *** JScript ***
    <script TYPE="text/javascript">
    <!--
    function popup(myform)
    if (! window.focus) return true;
    var d = new Date();
    windowname = d.getTime();
    window.open('', windowname, 'top=100,left=100,height=200,width=200,location=no,resizable=no,scrollbars=no,status=no');
    myform.target=windowname;
    return true;
    -->
    </script>
    *** JSF ***
    <h:form onsubmit="popup(this)">
    <h:commandButton value="Press Me" actionListener="#{sessionBean.resetCursor}" action="selectElemList" />
    </h:form>
    But it work only with <h:commandButton> tag. If you try to use <h:commandLink>, then 'onsubmit' attribute by <form> tag don't work.
    If you know how make necessary functional with <h:commandLink> tag, please let me know.

  • Invalidating a session in Java Bean

    Hi,
    I need to write a logout() method in my Java Bean to invalidate
    the current session upon logout.
    But i keep getting error when i try to access the session.
    bu using
    session.invalidate();
    Does anyone know how to retrieve the current session in a Java Bean??
    Thanks..

    Hi,
    You can pass the session from the JSP to the Javabean method for invalidating it. For example, in your JSP you can have:
    <%-- instantiate your bean --%>
    <jsp:useBean id="bean" class="YourJavaBean" scope="page" />
    <%-- call the method with the session parametere --%>
    bean.logout(session);
    And then in your bean, have:
    public void logout(HttpSession session) {
    //Any processing...
    //invalidate the session
    session.invalidate();
    Hope that helps,
    Srinivas

  • Crystal report generation with Java Bean AS  Data source on RAD

    <p>Hi,</p><p>&#160;</p><p>          Our company wants report generation in IBM RAD 7.0  using crystal reports with a Java Bean as data source. i HAVEN&#39;T FOUND ANY ARTICLES TO WORK ON RAD. Any inputs appreciated..</p><p>&#160;</p><p>Thanks,</p><p>Manju</p>

    Look for Java POJO in the doc, i'm using RAD 7.0 and it's working like RAD 6.0

  • Is it possible to create crystal reports on IBM RAD with Java Bean as Data Source

    <p>Hi,</p><p>&#160;</p><p>          Our company wants report generation in IBM RAD 7.0  using crystal reports with a Java Bean as data source. i HAVEN&#39;T FOUND ANY ARTICLES TO WORK ON RAD. Any inputs appreciated..</p><p>&#160;</p><p>Thanks,</p><p>Manju</p>

    Look for Java POJO in the doc, i'm using RAD 7.0 and it's working like RAD 6.0

  • Maintain session

    I have a client side java program running. It is to comunicate with a web server using HTTP. How do I maintain session in my java program in the client machine. I have no access to the web server.
    java.net.URL and java.net.HttpURLConnection are not maintaining session, tough allow me to transact. It creates a new session for every hit.
    help!!!
    Trijoy
    [email protected]

    Hello Darted,
    I have a small task ahead. My boss hates logging in userid and passwords every time he logs ont a site, which he dose 10-15 times a day. Due to session timeouts, he has to repeat the login process.
    The requirement is that, I should have a process running, that will maintain the session throughout the day by hitting the URL every 18 mins or so..(session timeout is of 20 mins), and when he writes the URL the old session is maintained.
    The process is such that it sends data over http to the server. The data is accepted only for the live and valid session. At present we are sending it through a form (post). If the state can be maintained in the java applet, swing or whatever, we will remove the HTML form and will automate the process of form sending.
    I am looking for a mechanism which emulates a browser, i.e. maintain the session till it gets time out or browser is closed.... only I want to avoid using a browser and refreshing it every time and want to implement it thru java so that I can have control over it.
    Thanks
    Trijoy
    PS. Any help in design, source code, suggestion is highly appreciated

  • What is the difference between Java Beans and EJBs ?

    Hi,
    Can someone tell me that ? Kind of confused... Thanks !
    Philip

    Hmm, I'm gonna have a go at this - hopefully someone will build on it with more differences or requirements:
    A Java Bean is merely a Java class written to conform to some simply rules for construction and method naming eg:
    public class MyBean
      private String myField;
      public MyBean()
      public void setMyField(String myField)
        this.myField = myField;
      public String getMyField()
        return myField;
    }Applications can use Java Beans without having to know about the class in advance - a typical situation might be their use in visual GUI editors where the properties of the bean can be exposed and manipulated by the editor through examination of the method names or an accompanying descriptor.
    An Enterprise Java Bean doesn't have all that much in common with a Java Bean. An EJB is a small set of classes meeting a single (usually) business requirement written to conform to the EJB specification. This enables them to be used by J2EE Application servers to perform enterprise business functions (data storage, manipulation, business logic etc.). The whole idea is that by writing to the specification the server can automatically provide support for transaction management, concurrent access, scaleability, etc that a mission-critical system might require without the programmer having to understand the workings of the application server.
    Essentially an EJB can either
    1) maintain the permanent state of a business object (eg, hold the data for a single product in a catalogue)
    2) perform a small set of business operations (eg, place an order for a customer)
    3) act in response to messages passed around the system (eg, send a mail to the user when the items have been shipped)
    I would have a look at the following two pages to get a better overview:
    http://java.sun.com/products/javabeans/
    http://java.sun.com/products/ejb/
    Hope this helps.

  • What is java beans?

    what is the difference between java application and java beans?
    thanks!

    Hmm, I'm gonna have a go at this - hopefully someone will build on it with more differences or requirements:
    A Java Bean is merely a Java class written to conform to some simply rules for construction and method naming eg:
    public class MyBean
      private String myField;
      public MyBean()
      public void setMyField(String myField)
        this.myField = myField;
      public String getMyField()
        return myField;
    }Applications can use Java Beans without having to know about the class in advance - a typical situation might be their use in visual GUI editors where the properties of the bean can be exposed and manipulated by the editor through examination of the method names or an accompanying descriptor.
    An Enterprise Java Bean doesn't have all that much in common with a Java Bean. An EJB is a small set of classes meeting a single (usually) business requirement written to conform to the EJB specification. This enables them to be used by J2EE Application servers to perform enterprise business functions (data storage, manipulation, business logic etc.). The whole idea is that by writing to the specification the server can automatically provide support for transaction management, concurrent access, scaleability, etc that a mission-critical system might require without the programmer having to understand the workings of the application server.
    Essentially an EJB can either
    1) maintain the permanent state of a business object (eg, hold the data for a single product in a catalogue)
    2) perform a small set of business operations (eg, place an order for a customer)
    3) act in response to messages passed around the system (eg, send a mail to the user when the items have been shipped)
    I would have a look at the following two pages to get a better overview:
    http://java.sun.com/products/javabeans/
    http://java.sun.com/products/ejb/
    Hope this helps.

  • Java Bean does not display in Forms 9i

    Hi,
    I created a Java bean taht would not display in a Forms 9i application. I do not get any error messages, just nothing seem to happen. I did the following:
    1. Created a Java Bean with az Init() public function, packed it into a jar file and put it into <9iASHome>\forms90\java
    2. Added the jar file to the formsweb.cfg file's archive_jini.
    3. Created a Form with a Java Bean item on a canvas.
    4. Set the implementation property of the bean item to the full java 'direcotry' path of the class.
    5. Created the WHEN-NEW-FORM-INSTANCE trigger and put this code into it:
    fbean.register_bean('BLOCK3.BEAN_AREA4',1,'geoifsweb.ifsframe');
    After deploying the form to 9iAS and running it nothing seems to happen, only the place of the Java Bean appears on the Form. Teh Java Bean class extend a JFrame class, so I would expect it to appear on the screen.
    What am I missing? Thank you for any help or hint in advance.
    Regards,
    Tamas Szecsy

    Tamas
    When using fbean.register_bean you don't need to set the implementation class of the bean at design time.
    You must however supply the full package and class name in the register_bean call.
    Do you get any exceptions in the Java console?
    I'd also switch logging on (see FBEAN.Set_Logging_Mode)

  • Using Java Bean in JSP to show database record

    I have links in my Tomcat container that if someone clicks on a specific link it should go to a Record page (Show.jsp) with all the values associated with a record from a database.
    For example if someone clicks on a specific link like this:
    LinkExample
    it would take you to a jsp with database info for someone named Jones and show you his info:
    Lastname = Jones
    Firstname = Mike
    City = San Diego
    I would like to do this using a Java helper class and bean so I dont have any database connection or Java code in my JSP.
    I created Java class file that has Database connection that works with a Java bean. I just dont know how to get the Show.jsp to work with the Java Bean and Java helper class file.
    Here is what I have for Show.jsp and this is the part I have been working on the longest but cant get it to work because it doesnt seem to work with the database:<jsp:useBean id="user" class="num.UserDB"/>
    //do I call getUser(lastname) here and if so how?
    <jsp:setProperty name="user" property="*"/>
    Last Name: <jsp:getProperty name="user" property="lastname"/><BR>
    First Name: <jsp:getProperty name="user" property="firstname"/><BR>
    City: <jsp:getProperty name="user" property="city"/><BR>My Java Helper class that compiles and connects to database:
    package num;
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import num.User;
    public class UserDB
    public User getUser(String lastname)
    User user = new User();     
            try          
         Class.forName...//database connection stuff here
        ResultSet results = stmt.executeQuery("SELECT * from user where lastname = '" + lastname + "'");
         if(results.next() == true)
         results.next();
         user.setLastname(results.getString("lastname"));
         user.setFirstname(results.getString("firstname"));
            user.setFirstname(results.getString("city"));
         catch(Exception e)          
                   System.out.println("Exception...");               
       return user;
    }My Java Bean that compiles here:
    package num;
    public class User
      private String firstname;
      private String lastname;
    private String city;
      public User()
         //no arg constructor
      public User(String firstname, String lastname, String city)
           this.lastname = lastname;
              this.firstname = firstname;
              this.city = city;
      public String getLastname()
              return lastname;
      public void setLastname(String lastname)
         this.lastname = lastname;
      //more bean methods for all fields here
     

    Sorry if I wasnt specific enough. I have a link that passes a value (field that is passed is called lastname) to a JSP where I want to show record info for that value that is passed.
    My question is how do I show the database record info on Show.jsp for the lastname field value of Jones where I want to use a Java Bean and Database helper class in Show.jsp
    Here is the message I get when I hit the link (LinkExample) and it goes to Show.jsp:
    org.apache.jasper.JasperException: Cannot find any information on property 'lastname' in a bean of type 'num.UserDB'
    .....My UserDB class:
    public class UserDB
    public User getUser(String lastname)
    User user = new User();     
            try          
         Class.forName("org.gjt.mm.mysql.Driver");
        Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/dbconnone?user=smitherson&password=abcdefg");
        Statement stmt = conn.createStatement();
        ResultSet results = stmt.executeQuery("SELECT * from user where lastname = '" + lastname + "'");
         if(results.next() == true)
         results.next();
         user.setLastname(results.getString("lastname"));
         user.setFirstname(results.getString("firstname"));
                         user.city(results.getString("city"));
         catch(Exception e)          
             System.out.println("Exception..." + e);          
       return user;
    }Bean class:
    package num;
    public class User
      private String firstname;
      private String lastname;
      private String city;
      public User()
         //no arg constructor
      public User(String firstname, String lastname, Sting city)
          this.firstname = firstname;
           this.lastname = lastname;
    this.city = city;
      public String getFirstname()
              return firstname;
      public void setFirstname(String firstname)
         this.firstname = firstname;
      public String getLastname()
              return lastname;
      public void setLastname(String lastname)
         this.lastname = lastname;
      public String getCity()
              return city;
      public void setCity(String city)
         this.city = city;
      

  • Can I use two webservices in one Java Bean?

    Hi,
    I have created two webservices (deployed on my local J2EE Engine). I want to use both services in one application and create a new webservice that combines the functionality of both services.
    Is this possible to combine the two services with a java bean? If yes, have I to do something special?
    Is this possible at all?
    Is there another way to do it?
    Thank you!
    Bye
    Julia

    Hi Julia,
    Yes, you can call to different web services from another service.
    For that, do one thing.
    Make deployable proxies for both Web services. Then use these both deployable proxies in your main web service from where you want to call these web services.
    Code for calling these both web services is same as you are calling web services from any other J2ee or Java project.
    Regards,
    Bhavik Devisha

  • Passing Session to Other Java Application

    Dear All,
    We need to pass session of SAP BO to other java application.in short we need to make single sign on between these two without using third party authentication type.
    by research , i could find out extension point API which supports to environment, through which it might be possible.
    I need your help on this.
    Environment:
    SAP BO 4.1 Sp2
    Any Help on this would be appreciated.
    Best Regards,
    Atulm

    Hi all, i have one problem. I need to pass some
    session to a java bean for processing.. Can i know are
    there any possible ways of passing? thanks.if i understand you correctly, and you mean passing a session object
    to a bean from a jsp page, do this:
    have in your bean:
    import javax.servlet.http.HttpSession;
    private HttpSession session = null;
    public void setSession (HttpSession sessionFromJsp) {
    session = sessionFromJsp;
    in your jsp:
    beanname.setSession(session);
    the variable named session is available is jsp pages,
    it is an instance of the javax.servlet.http.HttpSession class,
    and provides access to the client session information.
    dave

Maybe you are looking for