Serialization Retrieval

I just started messing with serialization and I'm not finding what I want to do, or even if what I want to do is possible. Basically, I can type info into a textfield, click a save button, and then the input is saved to a .txt file. I'm wondering how (or if) I can retrieve that input in the .txt file from another class and have it display in another textfield, or label, or whatever.

If all you want to do is store the string into a text file, you don?t need to serialize. You just write to an OutputStream, then retrieve via a InputStream.
You use serialization when you store or send (via TCP/IP) an Object, so the retrieving end knows how to rebuild this Object.

Similar Messages

  • Serialization Error retrieving data from JSP to Applet

    I have an applet which calls a JSP to write data object to the db and then the JSP sends back the updated data object. The writing part is ok but the response is giving the following error. The data object is in a separate class which implements Serialized.
    Here's the code in the applet calling the JSP and the response from the JSP
    URL server = null;
    String urlConnectionString = "http://localhost:7001/isLoginValid.jsp";
    try
         server = new URL(urlConnectionString);
    catch(MalformedURLException e)
         System.out.println("URL exception: " + e );          
    // send request
    ObjectInputStream response = null;
    Object result = null;
    try
         URLConnection conn = server.openConnection();
            conn.setDoOutput(true);
            conn.setUseCaches(false);
            conn.setRequestProperty("Content-Type", "application/octet-
            stream");
            ObjectOutputStream request = new ObjectOutputStream(new 
            BufferedOutputStream(conn.getOutputStream()));
         request.writeObject((Object)dvo);
         request.flush();
         request.close();
            // get the result input stream
         response = new ObjectInputStream(new BufferedInputStream
            (conn.getInputStream()));
         // read response back from the server
         result = response.readObject();
            if( result!=null && (result instanceof DataVO))
              dvo = (DataVO)result;
                 String vo = dvo.printDataVO();
                 System.out.println
                 ("*****************DataVO********************\n"+vo);
         else
              System.out.println("not an instanceof DataVO");
    catch(IOException ignored)
         System.out.println("Error in DataVO response");
         ignored.printStackTrace();
    }Here's the code in the JSP sending the response back to the applet.
    The 'dvo' object is the object which is serialized and has gets and sets
    for the diff. data elements. When I print the 'dvo' before writing
    the object to outputStream it prints the correct values for the data
    element.
    // send response
    response.setStatus(HttpServletResponse.SC_OK);
    ObjectOutputStream outputStream = new ObjectOutputStream (new BufferedOutputStream (response.getOutputStream()));
    outputStream.writeObject(dvo);
    outputStream.flush();ERROR is as follows:
    Error in DataVO response
    java.io.StreamCorruptedException: InputStream does not contain a serialized object
         at java/io/ObjectInputStream.readStreamHeader
         at java/io/ObjectInputStream.<init>
    What am I doing wrong?. Please respond soon. Thanks

    Here's the code. Yes I have it implementing serializable.
    import java.io.Serializable;
    import java.util.Date;
    public class DataVO implements Serializable
         // Data Variables
         private     String uname;
         private     String pwd;
         private     String errorMSG;
         private     boolean multiMessage;
         private     boolean blnFirstTextField;
         private     boolean subscriptionError;
         private     boolean subscriptionCancelled;
         private     int userNumber;
         private     int status;
         private     int userCount;
         private     int userMax;
         private     int seqnum;
         private boolean loginValid;
         private int t_Interval;
         public DataVO()
              uname="";                   
              pwd="";                     
              errorMSG="";                
              multiMessage=false;        
              blnFirstTextField=false;   
              subscriptionError=false;   
              subscriptionCancelled=false;
              userNumber = -1;
              status = -1;   
              userCount = -1;
              userMax = -1;  
              seqnum = -1;   
              loginValid = false;
              t_Interval = 0;
         public String getUserName() {return uname;}
         public void setUserName(String uname) {this.uname = uname;}
         public String getPassword() {return pwd;}
         public void setPassword(String pwd) {this.pwd = pwd;}
         public String getErrorMessage() {return errorMSG;}
         public void setErrorMessage(String errorMSG) {this.errorMSG = errorMSG;}
         public boolean isMultiMessage() {return multiMessage;}
         public void setMultiMessage(boolean multiMessage) {this.multiMessage = multiMessage;}
         public boolean isBlnFirstTextField() {return blnFirstTextField;}
         public void setBlnFirstTextField(boolean blnFirstTextField) {this.blnFirstTextField = blnFirstTextField;}
         public boolean isSubscriptionError() {return subscriptionError;}
         public void setSubscriptionError(boolean subscriptionError) {this.subscriptionError = subscriptionError;}
         public boolean isSubscriptionCancelled() {return subscriptionCancelled;}
         public void setSubscriptionCancelled(boolean subscriptionCancelled) {this.subscriptionCancelled = subscriptionCancelled;}
         public int getUserNumber() {return userNumber;}
         public void setUserNumber(int userNumber) {this.userNumber = userNumber;}
         public int getStatus() {return status;}
         public void setStatus(int status) {this.status = status;}
         public int getUserCount() {return userCount;}
         public void setUserCount(int userCount) {this.userCount = userCount;}
         public int getUserMax() {return userMax;}
         public void setUserMax(int userMax) {this.userMax = userMax;}
         public int getSeqNo() {return seqnum;}
         public void setSeqNo(int seqnum) {this.seqnum = seqnum;}
         public boolean isLoginValid() {return loginValid;}
         public void setLoginValid(boolean loginValid) {this.loginValid = loginValid;}
         public int getTimeIntvl() {return t_Interval;}
         public void setTimeIntvl(int t_Interval) {this.t_Interval = t_Interval;}
         public String printDataVO()
              String returnString = "username = "+uname+"\n";
              returnString = returnString + "password = "+pwd+"\n";
              returnString = returnString + "errorMSG = "+errorMSG+"\n";
              returnString = returnString + "multiMessage = "+multiMessage+"\n";
              returnString = returnString + "blnFirstTextField = "+blnFirstTextField+"\n";
              returnString = returnString + "subscriptionError = "+subscriptionError+"\n";
              returnString = returnString + "subscriptionCancelled = "+subscriptionCancelled+"\n";
              returnString = returnString + "userNumber = "+userNumber+"\n";
              returnString = returnString + "status = "+status+"\n";
              returnString = returnString + "userCount = "+userCount+"\n";
              returnString = returnString + "userMax = "+userMax+"\n";
              returnString = returnString + "seqnum = "+seqnum+"\n";
              returnString = returnString + "loginValid = "+loginValid+"\n";
              returnString = returnString + "t_Interval = "+t_Interval+"\n";
              return returnString;
    }

  • API to retrieve SQL query from a Webi Document

    Hi,
    Which API can be used to retrieve the Oracle SQL query for a webi report using BO XI web services SDK? The report is connected to a Oracle database in the backend.
    A sample code is greatly appreciated.
    Thanks a lot!
    Liz

    Hi Liz,
    The libraries for the Enterprise and Report Engine SDKs are included with your Enterprise installation and the location will vary with each version:
    XI Release 1 and Release 2
    XI Release 1 (assuming it's installed on C:\):
    - Windows: C:\Program Files\Common\3.0\java\lib
    - Linux/UNIX: (INSTALL_DIR)/java/lib
    XI Release 2:
    - Windows: (INSTALL_DIR)\Business Objects\Common\3.5\java\lib
    - Linux/UNIX: (INSTALL_DIR)/java/lib
    There are quite a few JAR files in this location, but you should only need the following set for Enterprise & REBean with XI Release 1 or XI Release 2:
    From the java\lib directory
    - boconfig.jar
    - cecore.jar
    - celib.jar
    - ceplugins.jar
    - cereports.jar
    - cesession.jar
    - ceutils.jar
    - cexsd.jar
    - corbaidl.jar
    - ebus405.jar
    - jtools.jar
    - keycodeDecoder.jar
    - rebean.common.jar
    - rebean.fc.jar
    - rebean.jar
    - rebean.wi.jar
    - rpoifs.jar
    - Serialization.jar
    - URIUtil.jar
    - wilog.jar     
    From the java\lib\external directory:
    - Concurrent.jar
    - freessl201.jar
    - icu4j.jar
    - jaxrpc.jar
    - jsafe.jar
    - log4j.jar
    - pullparser.jar
    - saaj.jar
    - sslj.jar
    - xbean.jar
    - xercesImpl.jar
    - xml-apis.jar
    BusinessObjects Enterprise XI 3.0
    - Windows: (INSTALL_DIR)\Business Objects\Common\4.0\java\lib
    - Linux/UNIX: (INSTALL_DIR)/java/lib
    You can find a list of required JAR files in the [XI 3.0 Enterprise SDK Developer Guide|https://boc.sdn.sap.com/node/7298].
    Cheers,
    Parin
    Edited by: Parin Patel on Jun 25, 2008 11:03 AM

  • Retrieve data from a bean into a Servlet

    Hi,
    I created a simple JSP file called index.jsp situated in application root, then I associated this JSP with a java bean in order to collect data after the form submission, the attribute Action inside the Form tag points on a Servlet called Login situated in the application com.myapp.servlets package.
    the problem is that, using the scope="session" in the JSP page, I'm able to get catch the bean generated after the submission of the form, even the action is the Servlet called Login neither a back to the currest JSP or a redirection to another JSP, but in the same time, when I try to use bean methods to read the data (username, password) it gives null as result, I'm not able to understand the behavior of the bean which is created via Form submission but unreachable via the Servlet.
    herese the code
    the JSP (index.jsp)
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
    <jsp:useBean id="MyBean" scope="session" class="com.datalog.beans.LoginBean"/>
    <jsp:setProperty name="MyBean" property="*"/>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Document sans nom</title>
    </head>
    <body>
    <table width="100%" border="1">
      <tr>
        <td> </td>
      </tr>
      <tr>
        <td><form name="form1" method="post" action="doLogin">
          <table width="100%"  border="0" cellspacing="0">
            <tr>
              <td width="30%">username : </td>
              <td><input name="username" type="text" id="username"></td>
            </tr>
            <tr>
              <td>password : </td>
              <td><input name="password" type="password" id="password"></td>
            </tr>
            <tr>
              <td> </td>
              <td><input type="submit" name="Submit" value="Envoyer"></td>
            </tr>
          </table>
        </form></td>
      </tr>
      <tr><!-- in case when try to use without a servlet call-->
        <td>username after submission <jsp:getProperty name="MyBean" property="username" /><br>
         password after submission <jsp:getProperty name="MyBean" property="password" /></td>
      </tr>
    </table>
    </body>
    </html>The bean (LoginBean.java)
    package com.datalog.beans;
    import java.io.Serializable;
    public class LoginBean implements Serializable {
        private String username;
        private String password;
        public LoginBean(){
            System.out.println("i'm the bean ... "+this);
        public String getPassword() {
            return password;
        public void setPassword(String password) {
            this.password = password;
            System.out.println(this.password);
        public String getUsername() {
            return username;
        public void setUsername(String username) {
            this.username = username;
            System.out.println(this.username);
    }Servlet (Login.java)
    * Created on 14 d�c. 2004
    * TODO To change the template for this generated file go to
    * Window - Preferences - Java - Code Style - Code Templates
    package com.datalog.cpservlets;
    import java.io.IOException;
    import java.io.PrintWriter;
    import javax.servlet.ServletConfig;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    import com.datalog.beans.LoginBean;
    * Servlet Class
    * @web.servlet              name="Login"
    *                           display-name="Name for Login"
    *                           description="Description for Login"
    * @web.servlet-mapping      url-pattern="/Login"
    * @web.servlet-init-param   name="A parameter"
    *                           value="A value"
    public class Login extends HttpServlet {
        public Login() {
            super();
            // TODO Auto-generated constructor stub
        public void init(ServletConfig config) throws ServletException {
            super.init(config);
            // TODO Auto-generated method stub
        protected void doGet(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException,
            IOException {
            // TODO Auto-generated method stub
            super.doGet(req, resp);
        protected void doPost(
            HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
            // TODO Auto-generated method stub
            PrintWriter out = response.getWriter();
            out.println("<br><br>Servlet (Login) in use.<br>");
            out.println("username from request.getParameter : "+request.getParameter("username")+"<br>");
            out.println("password from request.getParameter : "+request.getParameter("password")+"<br>");
            out.println("<br><br>Trying to use the bean...<br>");
            HttpSession session = request.getSession();
            LoginBean myBean = (LoginBean)session.getAttribute("MyBean");
            out.println("supposed bean adr : "+myBean);
            out.println("<br>username from myBean.getUsername : <b>"+myBean.getUsername()+"</b><br>");
            out.println("<br>password from myBean.getPassword : <b>"+myBean.getPassword()+"</b><br>");
    }thank's.

    The code that would populate the bean is here:
    <jsp:useBean id="MyBean" scope="session" class="com.datalog.beans.LoginBean"/>
    <jsp:setProperty name="MyBean" property="*"/>
    When this code runs, it
    1 - creates a LoginBean (if one is not already present)
    2 - Populates the loginBean from the request parameters.
    But this code is currently running when you generate the login page - not when you push the submit button.
    Solutions
    1 - Submit the form to a JSP page which runs the jsp:setProperty tag and then forwards to your Login servlet
    2 - Retrieve the request parameters in your servlet and populate the bean. The jakarta commons BeanUtils are the standard way to go here. They are actually preferable to the jsp:setProperty tag which has some "features" in its use.
    Cheers,
    evnafets

  • After upgrading software to 5.0, I lost my Contact List. How do you retrieve it.

    After upgrading software to 5.0, I lost my Contact List. How do you retrieve it.

    Prodesigntools.com , go ahead and download the software from there and use your serial number to serialize it.

  • How to retrieve detached @ManyToOne entities with relationship

    Hi All,
    I am having difficulty retrieving all the Zipcode, Zipname records which have successfully been deployed on Glassfish v2r2, JDK1.6.0_06, MySQL 5.0, Netbeans 6.1 on Windows XP platform.
    Below are the relevant EJBs snippets:
    package domain;
    @Entity
    @Table(name="ZIPCODE")
    public class Zipcode implements Serializable {
        @Id
        @Column(name="ID")
        private int id;
        public int getId() {
            return id;
        @OneToMany(cascade={CascadeType.ALL}, mappedBy="zipcode", fetch=FetchType.EAGER, targetEntity=Zipname.class)
        private Collection<Zipname> zipnames = new ArrayList<Zipname>();
        public Collection<Zipname> getNames()
         return zipnames;
    package domain;
    @Entity
    @Table(name="ZIPNAME")
    public class Zipname implements Serializable {
        @Id
        @Column(name="ID")
        private int id;
        public void setId(int id) {
            this.id = id;
        @ManyToOne(fetch=FetchType.EAGER)
        @JoinColumn(name="ZIPCODE_ID")
        private Zipcode zipcode;
        public Zipcode getZipcode() {
            return zipcode;
    package ejb;
    @Stateless
    public class ZipcodeBean implements ZipcodeRemote {
        @PersistenceContext(unitName="GeographicalDB") private EntityManager manager;
        public void createZipcode(Zipcode zipcode)
           manager.persist(zipcode);
        public Zipcode findZipcode(int pKey)
           Zipcode zipcode = manager.find(Zipcode.class, pKey);
            zipcode.getNames().size();
            return zipcode;
        public List fetchZipcodesWithRelationships()
          List list = manager.createQuery("FROM Zipcode zipcode").getResultList();
          for (Object obj : list)
             Zipcode zipcode = (Zipcode)obj;
             zipcode.getNames().size();
          return list;
    @Stateless
    public class ZipnameBean implements ZipnameRemote {
        @PersistenceContext(unitName="GeographicalDB") private EntityManager manager;
        public void createZipname(Zipname zipname)
         manager.persist(zipname);
        public Zipname findZipname(int pKey)
            Zipname zipname = manager.find(Zipname.class, pKey);
            zipname.getZipcode().getNames().size();
            return zipname;
        public List fetchZipnamesWithRelationships()
          List list = manager.createQuery("FROM Zipname zipname").getResultList();
          for (Object obj : list)
             Zipname zipname = (Zipname)obj;
             zipname.getZipcode().getNames().size();
          return list;
    public class ZipcodeApplicationClient {
        @EJB
        private static ZipcodeRemote zipcodebean;
        private static ZipnameRemote zipnamebean;
        public ZipcodeApplicationClient() {
        public static void main(String[] args) {
            try {
                Zipcode zipcode_1 = new Zipcode();
                zipcode_1.setcode(9001);
                Zipname zipname_1 = new Zipname();
                zipname_1.setName("Harbour Cove");
                zipcode_1.getNames().add(zipname_1);
                zipname_1.setZipcode(zipcode_1);
    //          zipnamebean.createZipname(zipname_1);
                zipcodebean.createZipcode(zipcode_1);
                //fetch detached entity without relationship
                Zipcode zipcode_2 = zipcodebean.findZipcode(0);
                System.out.println("zipcode_2.getId(): " + zipcode_2.getId());
                System.out.println("zipcode_2.getCode(): " + zipcode_2.getCode());
                Iterator iterator = zipcode_2.getNames().iterator();
                while (iterator.hasNext())
                    System.out.println(iterator.next().toString());
                // output of fetching detached entity without relationship
                zipcode_2.getId(): 0
                zipcode_2.getCode(): 2010
                domain.ZipName@107e9a8
                zipcode_2.getLatitude: -33.883
                zipcode_2.getLongitude(): 151.216
                zipcode_2.getLocality(): Sydney
                //fetch detached entity with relationship
                List list =  zipcodebean.fetchZipcodesWithRelationships(); // line 76         
                // output of fetching detached entity with relationship
                           Caught an unexpected exception!
                           javax.ejb.EJBException: nested exception is: java.rmi.MarshalException: CORBA BAD_PARAM 1330446342 Maybe; nested exception is:
                           java.io.NotSerializableException: ----------BEGIN server-side stack
                           at client.ZipcodeApplicationClient.main(ZipcodeApplicationClient.java:76)
                           -------------------------------------------------------------------------------------------------------------------------------------------( i ) As a result, please advice on how to utilise both fetchZipcodesWithRelationships() & fetchZipnamesWithRelationships() in ZipcodeApplicationClient() to retrieve collections of Zipcodes & Zipnames without encountering this issue?
    (ii) I also like to utilise the zipnamebean.createZipnamez(zipname_1) to properly create this entity.
    The local firewall has been de-activated. All components reside on the same host.
    I have tried various approaches and googled without success.
    Your guidances would be very much appreciated.
    Many thanks,
    Jack

    Hi All,
    When trying to add multiple Zipnames with the following additional statements at the beginning of ZipcodeApplicationClient:
                Zipcode zipcode_1 = new Zipcode();
                zipcode_1.setcode(9001);
                Zipname zipname_1 = new Zipname();
                zipname_1.setName("Harbour Cove");
                zipcode_1.getNames().add(zipname_1);
                Zipname zipname_2 = new Zipname();
                zipname_2.setName("Fairyland");
                zipcode_1.getNames().add(zipname_2);
                Zipname zipname_3 = new Zipname();
                zipname_3.setName("Wonderland");
                zipcode_1.getNames().add(zipname_3);
                zipname_1.setZipcode(zipcode_1);
                zipname_2.setZipcode(zipcode_1);
                zipname_3.setZipcode(zipcode_1);
                zipcodebean.createZipcode(zipcode_1); // line 49
    The whole persistence step (line 49) failed altogether with these output:
    Caught an unexpected exception!
    javax.ejb.EJBException: nested exception is: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
            java.rmi.RemoteException: null; nested exception is:
            javax.persistence.EntityExistsException:
    Exception Description: Cannot persist detached object [domain.Zipname@1a6eaa4].
    Class> domain.Zipname Primary Key> [0]
    at client.ZipcodeApplicationClient.main(ZipcodeApplicationClient.java:49)Any ideas on why this occur?
    Thanks,
    Jack

  • Object Serialization(Materialization and Dematerialization)

    I've encountered some issues with mapping my objects to an RDBMS and am hoping for some advice.
    I've tried various O/R mapping frameworks like Castor(too complex and too slow for my liking), JRF(nice but very repetitive and difficult to extend) and then some, but have yet to find one which I'm comfortable with building an application on.
    Instead, I've chosen to do it the low-tech way, with each domain class, say Book for instance, having a Broker class which knows how to communicate with the chosen form of persistence. So, since I chose an RDBMS, Book class has a BookRelationalBroker class which knows how to materialize and dematerialize Book objects to and from a RDBMS. If so required, I can plug in a BookXMLBroker which knows how to serialize the object in the form of an xml data file.
    I've also implemented a primitive object caching system which (when enabled), caches objects requested so we only have to materialize it from the db once.
    Here are 2 issues I have with my system:
    It is amazingly tedious (not to mention inefficient) to recreate the entire object from the database. This is even more so because I've implemented the Event Notification pattern, such that when say a book is deleted, the members who have reserved it are notified. The whole point of the Event Notification mechanism is so that the object being watched does not need to know of the objects which need to be notified on a state change. However, I've found it necessary to re-attach all the listeners on an object when it is materialized from the DB, defeating the purpose of the pattern.
    Complex object relationships are mapped poorly and recursive materialization leads to slow response times. If a Group object has a Vector of Members and other Groups, then whenever a Group object is materialized, all its constituent Members and Group objects also need to be materialized. (I understand O/R frameworks solve this through lazy instantiation)
    I studied the Jive2 architecture and found that they approached this problem by accessing the DB directly for any complex object relationships. In other words, the Group object does not actually contain a Vector of Members and Groups. Instead, it has a method called say getMembers() which proceeds to retrieve the necessary data from the DB and then materialize these objects.
    I'm not too excited about this approach for 2 reasons:
    How object-oriented is this approach? Seems more like database-oriented programming to me.
    Every call to retrieve Members necessitates a call to the DB. The data isn't cached with the Group object because the Group object does not actually contain the necessary reference to the Members and Groups.
    Can anyone shed some light on this topic?

    How object-oriented is this approach? Seems more like database-oriented programming to me. There is a reason people still use Relational databases rather than OO DBs. First, is that the vast majority of data in the real world maps easily to a relational model, consequently there is no advantage to a OO model. Second, either because of this or simply because OO models are not computationally simple, OO databases tend to be slower than relational DBs.
    It sounds like you are trying to implement a OO DB model using a relational database. So you basically end up with two problems. The DB is not optimized for OO models, and you have to find a way to map it in the OO model itself. And this is slow and messy.
    To solve the slowness problem you could, just like EJB servers, cache the data in memory. Lot of work but if you want to do it then have fun.
    The second way is to give up. Realize that your data model is not inherently OO'd and just implement it efficiently as a relational model. Then provide an interface that loads it into the OO model. And where needed add pass through logic to allow the database itself to do things it is really good at - like queries.

  • What is the best way to store data to a file? Serialization?

    FYI: I am some what of a novice programer. I have almost finished my degree but everything I know about Java is self taught (never taken a course in java). Any way here is my question.
    So I have an example program that I have created. It basically just has three textpanes which also have the ability to contain images. Now I would like to learn how to store data to a file for later retrieval and decided to use a program such as this as an example. I am not sure if I should use the serialization API that java has or some other means such as XML. If I used XML I was not sure how to store the image data that would be contained in the text panes. I figured serialization would take care of that if I just serialized my main class and then restored it. So That is that I tried first. Is this a good direction to go?
    The problem I am having is that I cant seem to get the serialization to work the way I need it to. I am not sure what I am doing wrong because I have read many tutorials and looked at allot of example code but still dont understand. The tutorial I looked at most is [this one at IBM.|http://java.sun.com/developer/technicalArticles/Programming/serialization/]
    The eclipse project folder for my example program can be found here:
    [http://startoftext.com/stuff/myMenuExp/]
    zipped version:
    [http://startoftext.com/stuff/myMenuExp.zip]
    The main class is mainwindow.java. I know the source is kinda dirty. Any comments are welcome but I am most interested in how to solve this serialization problem. Thanks
    -James

    DrClap wrote:
    What will the nature of the data be? Just a handful of strings? A bunch of objects of different types reflecting the current state of your program to great depth and complexity? Something else?The data will be what is contained in three text panes. Each text pane containing rich text and images. For an example take a look at the example program in my first post.
    How will the data be used? Just write it out when the app shuts down, and read it all back in when it starts up? Do you need to query or search for specific subsets of the data? Is there any value in the stored form of the data being human-readable?Basically the data will need to be saved when the application shuts down or when the user selects save from the file menu. The data will be restored when the user opens the file from the file menu. It would be nice if the stored data is human readable but its not of primary importance.
    How often will the data be written and read? How many reads/writes/bytes/etc. per second/minute? Not often. Just a simple open and save from the file menu.
    How large could the data conceivably get?It will probably be a few paragraphs of formated text and less then a dozen images per text pane.
    Will reading and writing of the data need to occur concurrently?no.
    Do you need to add new data to the storage as your app goes along, or just replace what's there with the most current state?Replace with the most current state of the data.
    If it's a simple read once at startup, write once at shutdown, overwriting the previous data, read only by your app, not by humans, then serialization via ObjectInput/OutputStream is probably the way to go. If there are other requirements, you may want to go with XML serialization, a DB, or some other solution.Thanks for the information. Serialization sounds like the way to go. Even if I end up using XML serialization in the end it would still be of interest to me to learn how to use serialization without xml.
    I was trying to go with using serialization in be beginning but I cant seem to get it to work. Would you be willing to take a look at my example program. I attempted to implement serialization but it does not seem to work. Could you take a look and see what I am doing wrong. At this point I am stuck as i cant seem to get serialization to work.
    I am going to go ahead and mark this thread as answered because I think I already got most of the information I was looking for except what I am doing wrong with my attempt as serialization.
    Thank you jverd for your time.

  • Jndi and serializable objects

    Hi,
    I am attempting to create a cache on the web server to store
    frequently accessed reference data. I do so by running a series of
    queries in a startup class. The data retrieved from the result set of
    each query is stored in a custom class and bound to the server context.
    My understanding is that when serializable objects are bound, they are
    written to disk (so as not.to waste valuable Heap space I assume). As a
    test I made the startup query return a large amount of data and I
    expected to see the amount of free disk space decrease as the objects
    were bound however I did not see this occurring. I examined the memory
    usage of the java process with the NT task manager, and the memory usage
    was increasing pretty dramatically as the query results were performed
    and new objects created to store this data.
    Based on these observations I assume that the objects I created and
    bound are stored in the Java Heap and not written to disk. Would
    Weblogic at some point write these to disk if memory became tight or is
    my understanding that binding an object serializes it incorrect?
    If it turns out that what I am attempting here consumes a lot of heap
    space, I assume that server performance will suffer which is
    unacceptable. Would using read-only entity beans be a better solution?
    The container could manage this memory more effectively but it would
    seem to add a lot of overhead for a simple read only data cache.
    Thanks,
    Steve Snodgrass

    We never write jndi data to the disk. So if you add more objects your are
    going to take up more heap space. You should be looking at other
    alternatives to implement this.
    -- Prasad
    Steve Snodgrass wrote:
    Hi,
    I am attempting to create a cache on the web server to store
    frequently accessed reference data. I do so by running a series of
    queries in a startup class. The data retrieved from the result set of
    each query is stored in a custom class and bound to the server context.
    My understanding is that when serializable objects are bound, they are
    written to disk (so as not.to waste valuable Heap space I assume). As a
    test I made the startup query return a large amount of data and I
    expected to see the amount of free disk space decrease as the objects
    were bound however I did not see this occurring. I examined the memory
    usage of the java process with the NT task manager, and the memory usage
    was increasing pretty dramatically as the query results were performed
    and new objects created to store this data.
    Based on these observations I assume that the objects I created and
    bound are stored in the Java Heap and not written to disk. Would
    Weblogic at some point write these to disk if memory became tight or is
    my understanding that binding an object serializes it incorrect?
    If it turns out that what I am attempting here consumes a lot of heap
    space, I assume that server performance will suffer which is
    unacceptable. Would using read-only entity beans be a better solution?
    The container could manage this memory more effectively but it would
    seem to add a lot of overhead for a simple read only data cache.
    Thanks,
    Steve Snodgrass

  • How to retrieve data and display in JSP page

    hi,
    i am trying to retrieve data from SQL server 2000 and display in JSP Page. I have already place the codes of the retrieve in the bean file. I wanna ask is that how to display in the JSP page. If possible, can provide example codings for mi to reference?
    Thanks
    Regards,
    shixuan

    HI Tan ,
    I pressume that you wanted to make use of PDK, the code can go like this .
    <b><u>1) JAVA file</u></b>
    import com.sapportals.htmlb.DropdownListBox;
         import com.sapportals.htmlb.InputField;
         import com.sapportals.htmlb.event.Event;
         import com.sapportals.htmlb.page.DynPage;
         import com.sapportals.htmlb.page.PageException;
         import com.sapportals.portal.htmlb.page.JSPDynPage;
         import com.sapportals.portal.htmlb.page.PageProcessorComponent;
         import com.sapportals.portal.prt.component.IPortalComponentRequest;
         import com.sapportals.portal.prt.component.IPortalComponentSession;
         import com.sapportals.portal.prt.component.IPortalComponentContext;
         import java.sql.*;
         public class P_SAP_B_User extends PageProcessorComponent
         * Method          :           getPage()
         * Description      :                         
         * Input Parameters     :     None
         * Returns          :          Object of Class DynPage     
              public DynPage getPage()
                  return new P_SAP_B_UserDynPage();
                }     // end of dynPage()
                public static class P_SAP_B_UserDynPage extends JSPDynPage
                  /* Variable Declaration     */
                   /* Object of bean class P_SAP_B_CreateUser initialised to null */
                       private P_SAP_B_CreateUser createUserBean = null;
                  /* Flags for checking the occurance of Event & Error. */
                  private int iFlag=0;
                  private int iErrFlag=0;
                  /* Variables for storing the information
                          entered by user in each text field */
                  private String sFname;
                  private String sSname;
                  private String sAge;
                  private String sExp;
                  private String sSkill;
                  private String sUnit;
         * Method          :           doInitialization()
         * Description      :                         
         * Input Parameters     :     None
         * Returns          :          None
                  public void doInitialization()
                         IPortalComponentSession componentSession = ((IPortalComponentRequest)getRequest()).getComponentSession();
                         Object o = componentSession.getValue("createUserBean");
                         if(o==null || !(o instanceof P_SAP_B_CreateUser))
                           createUserBean = new P_SAP_B_CreateUser();
                           componentSession.putValue("createUserBean",createUserBean);
                        }     // end of if
                         else
                             createUserBean = (P_SAP_B_CreateUser) o;
                         }     // end of else
                   }//end of doInitialisation()
         * Method          :           onUpdate()
         * Description      :                         
         * Input Parameters     :     object of Event class
         * Returns          :          None
                   public void onUpdate(Event e)throws PageException
                        /*     sets flag to 1 when update button is clicked. */
                        iFlag=1;
         * Method          :           doProcessAfterInput()
         * Description      :                         
         * Input Parameters     :     None
         * Returns          :          None
                  public void doProcessAfterInput() throws PageException
                             InputField ifFirstName = (InputField) getComponentByName("FirstName");
                             InputField ifSecondName = (InputField) getComponentByName("SecondName");
                             InputField ifAge = (InputField) getComponentByName("Age");
                             InputField ifExp = (InputField) getComponentByName("Exp");
                             InputField ifSkill = (InputField) getComponentByName("Skill");
                             DropdownListBox dlbUnit = (DropdownListBox) getComponentByName("Unit");
                             int iAge,iExp;
                             IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();
                            IPortalComponentContext myContext = request.getComponentContext();
                             P_SAP_B_CreateUser myNameContainer = (P_SAP_B_CreateUser) myContext.getValue("createUserBean");
                             if(ifFirstName != null)
                                  this.sFname = ifFirstName.getValueAsDataType().toString() ;
                             }     // end of if
                             if(ifSecondName!= null)
                                  this.sSname = ifSecondName.getValueAsDataType().toString() ;
                             }      // end of if
                             if(ifAge!= null)
                                  this.sAge = ifAge.getValueAsDataType().toString() ;
                             }     // end of if
                             if(ifExp!= null)
                                  this.sExp = ifExp.getValueAsDataType().toString() ; 
                             }     // end of if                         
                             if(ifSkill != null)
                                  this.sSkill = ifSkill.getValueAsDataType().toString() ;          
                             }     // end of if
                             if(dlbUnit != null)
                                  this.sUnit = dlbUnit.getSelection().toString() ;     ;
                             }      // end of if
                          /* Data Validation */
                             /* try block for numeric Exception */
                             try
                                 /* checking for any field left blank by the user */
                                  if(sFname.equals("") || sSname.equals("") ||  sAge.equals("")|| sExp.equals("") || sSkill.equals(""))
                                        /* set error flag to 1 in case of any field left blank */
                                        iErrFlag=1;
                                  } // end of if
                                  else
                                        /* converting Age and Experience fields (String) to integer */
                                         iAge= Integer.parseInt(sAge);
                                         iExp= Integer.parseInt(sExp);
                                       /* setting the boundaries on the value in Age Field */
                                         if(iAge<0)
                                             /* set error flag to 2 in case of age below 0 */
                                             iErrFlag=2;
                                         }// end of if
                                       /* setting the boundaries on the value in Experience field */
                                          else if(iExp<0 ||(iExp/12)>=iAge)
                                              /* set error flag to 3 in case of experience below 0 or exceeding the age in years */
                                              iErrFlag=3;
                                          }// end of else if
                                          /* In case of no error */
                                          else
                                             /* setting the bean variables */
                                             try
                                                 Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                                                 Connection con = DriverManager.getConnection("jdbc:odbc:Test");
                                                 String query="insert into UserData values(?,?,?,?,?,?)";
                                                 PreparedStatement prestat=con.prepareStatement(query);
                                                 /* setting the values to be inserted into the user table */
                                                 prestat.setString(1,sFname);
                                                 prestat.setString(2,sSname);
                                                 prestat.setString(3,sAge);
                                                 prestat.setString(4,sExp);
                                                 prestat.setString(5,sSkill );
                                                 prestat.setString(6,sUnit);
                                                 prestat.executeUpdate() ;
                                                 prestat.close();
                                                 con.close();
                                                 myNameContainer.setSFname(sFname);
                                                 myNameContainer.setSLname(sSname);
                                                 myNameContainer.setSAge(sAge);
                                                 myNameContainer.setSExp(sExp);
                                                myNameContainer.setSSkill(sSkill);
                                                myNameContainer.setSUnit(sUnit);
                                             } // end of inner try block
                                              catch(Exception sqle)
                                                 myNameContainer.setErrMessage("Update failed ! Please try again." );
                                              } // end of catch corresponding to inner try
                                                           } // end of inner else
                                                      } //end of outer else
                                   } //end of outer try block
                                   catch(Exception e)
                                     /* setting flag to 4 in case of non-numeric age/experience values */
                                     iErrFlag = 4;
                                     /* Displaying error message corresponding to the value of error flag */
                                  switch(iErrFlag)
                                    /* Empty Field */
                                    case 1:myNameContainer.setErrMessage( "Please Fill all the fields");
                                    break;
                                    /* Invalid Value in the age field */
                                    case 2:myNameContainer.setErrMessage( "Enter a valid value in Age field.(Hint : Have you entered Age<0 ?");
                                    break;
                                    /* Invalid Value in the experience field */
                                    case 3:myNameContainer.setErrMessage( "Enter a valid value in Experience field.(Hint : Experince should not be negative or greater than your age in months)");
                                    break;
                                    /* Non-numeric value in the Age/ experience fields */
                                    case 4:myNameContainer.setErrMessage( "Please Enter Numeric Value for Age and Experience");
                                    break;
                                 } // end of switch-case block
              } //end of doProcessAfterInput()
         * Method          :           doProcessBeforeOutput()
         * Description      :                         
         * Input Parameters     :     None
         * Returns          :          None
                  public void doProcessBeforeOutput() throws PageException
                       /* Displays Form for new user creation by default */
                       this.setJspName("P_SAP_B_UserCreationForm.jsp");
                         /* In case of an error display an error message page */
                         if(iErrFlag!=0)
                              setJspName("ErrorPage.jsp");
                         } //end of if
                         /* Displays the user's information as entered in the SQL
                            database after its been uploaded by the user */
                         else if(iFlag==1)
                             setJspName("hello.jsp");      
                          } // end of else if
                  } // end of doProcessBeforeOutput()
              } // end of P_SAP_B_UserDynPage Class
         } // end of P_SAP_B_User class
    * End of File P_SAP_B_User.java
    2) Bean
    package com.sap.usercreation;
    import java.io.Serializable;
    public class P_SAP_B_CreateUser implements Serializable
         private String sFname;
         private String sLname;
         private String sUnit;
         private String sSkill;
         private String sExp;
         private String sAge;
         private String errMessage;
         * @return
         public String getSFname() {
              return sFname;
    * @return
    public String getSLname() {
         return sLname;
    * @param i
    * @param string
    public void setSFname(String string) {
         sFname = string;
    * @param string
    public void setSLname(String string) {
         sLname = string;
    * @return
    public String getSUnit() {
         return sUnit;
    * @param string
    public void setSUnit(String string) {
         sUnit = string;
    * @return
    public String getSSkill() {
         return sSkill;
    public void setSSkill(String string) {
         sSkill = string;
    * @return
    public String getSAge() {
         return sAge;
    * @return
    public String getSExp() {
         return sExp;
    * @param string
    public void setSAge(String string) {
         sAge = string;
    * @param string
    public void setSExp(String string) {
         sExp = string;
    * @return
    public String getErrMessage() {
         return errMessage;
    * @param string
    public void setErrMessage(String string) {
         errMessage = string;
    3) The Jsp file i have already posted.
    See if you copy this code and paste it wont work as i have not given you full code ,But yes this gives you an overview of how things can be done .
    Thanx
    Pankaj

  • Unable to retrieve BPM in Integration Directory

    Hi Experts, i got a problem like this. I have already created my design object (BPM, Interfaces, Mapping, etc) in Integration Repository. Then i am going to start working on the Integration Directory (Configuration) ... However, when i try to create New Integration Process in Integration Directory, and i already choose my Integration Process from the list of my IP in my repository, when i want to confirm it, i got this following error:
    Unable to transport object Integration Process IP_MM096 | <my namespace>  of type RepBProcess from application REPOSITORY on system REPOSITORY. Detailed information: Attempt to serialize the generic part of object Integration Process IP_MM096 | <my namespace> failed(serialization problem)
    Anybody know or has an idea what is wrong with this?
    NB: my Integration Process name is IP_MM096
    thnks guys....

    I just finish redo the IP in my production system in IR. Then when i try to retrieve that new IP, i got the same message....I am out of idea what should i do next. Anyone? The thing is, i dont know the error mean...It just dont give enough information...
    Unable to transport object Integration Process IP_MM096_NEW1 | of type RepBProcess from application REPOSITORY on system REPOSITORY. Detailed information: Attempt to serialize the generic part of object Integration Process IP_MM096_NEW1 (serialization problem)

  • Differences between the serializable and externizable

    please give me

    Recently i gathered information
    serializable:
    is the super interface for the externalizable.
    during deserialization, it doesnot call the construtor.
    it follows the stored bits retrieval concept.
    this is the marker interface.
    externalizable:
    extends serializable.
    uses the constructor during the deserialization
    contains two methods:writeExternal(),readExternal()
    Cheers
    Kurakula Sudhakar Reddy(Sudha).

  • Retrieving BLOB in CMP2.0 from Oracle 8.1.7.3

    Hi all,
    In one of our project we are using CMP 2.0 and WLS8.1 SP2. While storing BLOB into Oracle (8.1.7) database we are not facing any issue.
    But retrieving the BLOB from the database throwing error.
    In weblogic.cmp.jar.xml I have defined the database column as below
    <field-map>
    <cmp-field>pendingUser</cmp-field>
    <dbms-column>PENDING_USER</dbms-column>
    <dbms-column-type>OracleBlob</dbms-column-type>
    </field-map>
    Stack trace of the issue is below
    javax.ejb.FinderException: Exception executing finder 'findByAdministrator':
    java.io.StreamCorruptedException: invalid stream header
    java.io.StreamCorruptedException: invalid stream header
    at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:737)
    at java.io.ObjectInputStream.<init>(ObjectInputStream.java:253)
    at com.boa.gcib.docwf.ecf.ejbs.pendinguser.PendingUserEntity_2zvzps__WebLo
    gic_CMP_RDBMS.__WL_set_pendingUserForInput(PendingUserEntity_2zvzps__WebLogic_CMP_
    RDBMS.java:2258)
    at com.boa.gcib.docwf.ecf.ejbs.pendinguser.PendingUserEntity_2zvzps__WebLo
    gic_CMP_RDBMS.__WL_loadGroup0FromRS(PendingUserEntity_2zvzps__WebLogic_CMP_RDBMS.j
    ava:868)
    at com.boa.gcib.docwf.ecf.ejbs.pendinguser.PendingUserEntity_2zvzps__WebLo
    gic_CMP_RDBMS.__WL_loadGroupByIndex(PendingUserEntity_2zvzps__WebLogic_CMP_RDBMS.j
    ava:1100)
    at weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.loadBeanFromRS(RDBMSPe
    rsistenceManager.java:428)
    at weblogic.ejb20.manager.DBManager.getBeanFromRS(DBManager.java:1435)
    at weblogic.ejb20.manager.BaseEntityManager.getBeanFromRS(BaseEntityManage
    r.java:1207)
    at weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.getBeanFromRS(RDBMSPer
    sistenceManager.java:2015)
    at com.boa.gcib.docwf.ecf.ejbs.pendinguser.PendingUserEntity_2zvzps__WebLo
    gic_CMP_RDBMS.ejbFindByAdministrator(PendingUserEntity_2zvzps__WebLogic_CMP_RDBMS.
    java:537)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja
    va:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso
    rImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.collectionFinder(RDBMS
    PersistenceManager.java:378)
    at weblogic.ejb20.manager.BaseEntityManager.collectionFinder(BaseEntityMan
    ager.java:1700)
    at weblogic.ejb20.manager.BaseEntityManager.collectionFinder(BaseEntityMan
    ager.java:1672)
    at weblogic.ejb20.internal.EntityEJBHome.finder(EntityEJBHome.java:560)
    at com.boa.gcib.docwf.ecf.ejbs.pendinguser.PendingUserEntity_2zvzps_HomeIm
    pl.findByAdministrator(PendingUserEntity_2zvzps_HomeImpl.java:128)
    at com.boa.gcib.docwf.ecf.ejbs.user.UserManagerBean.getRequestedAccounts(U
    serManagerBean.java:1158)
    at com.boa.gcib.docwf.ecf.ejbs.user.UserManager_iq4580_EOImpl.getRequested
    Accounts(UserManager_iq4580_EOImpl.java:46)
    at com.boa.gcib.docwf.ecf.ejbs.user.UserManager_iq4580_EOImpl_WLSkel.invok
    e(Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:477)
    at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef
    .java:108)
    at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:420)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedS
    ubject.java:353)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:14
    4)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:
    415)
    at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.j
    ava:30)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    at com.boa.gcib.docwf.ecf.ejbs.pendinguser.PendingUserEntity_2zvzps__WebLo
    gic_CMP_RDBMS.ejbFindByAdministrator(PendingUserEntity_2zvzps__WebLogic_CMP_RDBMS.
    java:556)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja
    va:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso
    rImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.collectionFinder(RDBMS
    PersistenceManager.java:378)
    at weblogic.ejb20.manager.BaseEntityManager.collectionFinder(BaseEntityMan
    ager.java:1700)
    at weblogic.ejb20.manager.BaseEntityManager.collectionFinder(BaseEntityMan
    ager.java:1672)
    at weblogic.ejb20.internal.EntityEJBHome.finder(EntityEJBHome.java:560)
    at com.boa.gcib.docwf.ecf.ejbs.pendinguser.PendingUserEntity_2zvzps_HomeIm
    pl.findByAdministrator(PendingUserEntity_2zvzps_HomeImpl.java:128)
    at com.boa.gcib.docwf.ecf.ejbs.user.UserManagerBean.getRequestedAccounts(U
    serManagerBean.java:1158)
    at com.boa.gcib.docwf.ecf.ejbs.user.UserManager_iq4580_EOImpl.getRequested
    Accounts(UserManager_iq4580_EOImpl.java:46)
    at com.boa.gcib.docwf.ecf.ejbs.user.UserManager_iq4580_EOImpl_WLSkel.invok
    e(Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:477)
    at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef
    .java:108)
    at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:420)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedS
    ubject.java:353)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:14
    4)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:
    415)
    at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.j
    ava:30)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    Is there anything I am missing?
    Please help me!
    Thanks a lot in advance,
    Mahesh
    Message was edited by:
    Maheshindia

    There is a new flag named 'serialize-byte-array-to-oracle-blob' and it was
    introduced in SP2. Check whether that flag is useful. More info can be found
    on the SP2 release notes -
    http://e-docs.bea.com/wls/docs81/notes/resolved_sp02.html
    --Sathish
    <Mahesh Patil> wrote in message news:[email protected]...
    Hi all,
    In one of our project we are using CMP 2.0 and WLS8.1 SP2. While storing
    BLOB into Oracle (8.1.7) database we are not facing any issue.
    But retrieving the BLOB from the database throwing error.
    In weblogic.cmp.jar.xml I have defined the database column as below
    <field-map>
    <cmp-field>pendingUser</cmp-field>
    <dbms-column>PENDING_USER</dbms-column>
    <dbms-column-type>OracleBlob</dbms-column-type>
    </field-map>
    Stack trace of the issue is below
    javax.ejb.FinderException: Exception executing finder
    'findByAdministrator':
    java.io.StreamCorruptedException: invalid stream header
    java.io.StreamCorruptedException: invalid stream header
    at
    java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:737)
    at java.io.ObjectInputStream.<init>(ObjectInputStream.java:253)
    at
    com.boa.gcib.docwf.ecf.ejbs.pendinguser.PendingUserEntity_2zvzps__WebLo
    gic_CMP_RDBMS.__WL_set_pendingUserForInput(PendingUserEntity_2zvzps__WebLogic_CMP_
    RDBMS.java:2258)
    at
    com.boa.gcib.docwf.ecf.ejbs.pendinguser.PendingUserEntity_2zvzps__WebLo
    gic_CMP_RDBMS.__WL_loadGroup0FromRS(PendingUserEntity_2zvzps__WebLogic_CMP_RDBMS.j
    ava:868)
    at
    com.boa.gcib.docwf.ecf.ejbs.pendinguser.PendingUserEntity_2zvzps__WebLo
    gic_CMP_RDBMS.__WL_loadGroupByIndex(PendingUserEntity_2zvzps__WebLogic_CMP_RDBMS.j
    ava:1100)
    at
    weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.loadBeanFromRS(RDBMSPe
    rsistenceManager.java:428)
    at
    weblogic.ejb20.manager.DBManager.getBeanFromRS(DBManager.java:1435)
    at
    weblogic.ejb20.manager.BaseEntityManager.getBeanFromRS(BaseEntityManage
    r.java:1207)
    at
    weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.getBeanFromRS(RDBMSPer
    sistenceManager.java:2015)
    at
    com.boa.gcib.docwf.ecf.ejbs.pendinguser.PendingUserEntity_2zvzps__WebLo
    gic_CMP_RDBMS.ejbFindByAdministrator(PendingUserEntity_2zvzps__WebLogic_CMP_RDBMS.
    java:537)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja
    va:39)
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso
    rImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at
    weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.collectionFinder(RDBMS
    PersistenceManager.java:378)
    at
    weblogic.ejb20.manager.BaseEntityManager.collectionFinder(BaseEntityMan
    ager.java:1700)
    at
    weblogic.ejb20.manager.BaseEntityManager.collectionFinder(BaseEntityMan
    ager.java:1672)
    at
    weblogic.ejb20.internal.EntityEJBHome.finder(EntityEJBHome.java:560)
    at
    com.boa.gcib.docwf.ecf.ejbs.pendinguser.PendingUserEntity_2zvzps_HomeIm
    pl.findByAdministrator(PendingUserEntity_2zvzps_HomeImpl.java:128)
    at
    com.boa.gcib.docwf.ecf.ejbs.user.UserManagerBean.getRequestedAccounts(U
    serManagerBean.java:1158)
    at
    com.boa.gcib.docwf.ecf.ejbs.user.UserManager_iq4580_EOImpl.getRequested
    Accounts(UserManager_iq4580_EOImpl.java:46)
    at
    com.boa.gcib.docwf.ecf.ejbs.user.UserManager_iq4580_EOImpl_WLSkel.invok
    e(Unknown Source)
    at
    weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:477)
    at
    weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef
    .java:108)
    at
    weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:420)
    at
    weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedS
    ubject.java:353)
    at
    weblogic.security.service.SecurityManager.runAs(SecurityManager.java:14
    4)
    at
    weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:
    415)
    at
    weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.j
    ava:30)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    at
    com.boa.gcib.docwf.ecf.ejbs.pendinguser.PendingUserEntity_2zvzps__WebLo
    gic_CMP_RDBMS.ejbFindByAdministrator(PendingUserEntity_2zvzps__WebLogic_CMP_RDBMS.
    java:556)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja
    va:39)
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso
    rImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at
    weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.collectionFinder(RDBMS
    PersistenceManager.java:378)
    at
    weblogic.ejb20.manager.BaseEntityManager.collectionFinder(BaseEntityMan
    ager.java:1700)
    at
    weblogic.ejb20.manager.BaseEntityManager.collectionFinder(BaseEntityMan
    ager.java:1672)
    at
    weblogic.ejb20.internal.EntityEJBHome.finder(EntityEJBHome.java:560)
    at
    com.boa.gcib.docwf.ecf.ejbs.pendinguser.PendingUserEntity_2zvzps_HomeIm
    pl.findByAdministrator(PendingUserEntity_2zvzps_HomeImpl.java:128)
    at
    com.boa.gcib.docwf.ecf.ejbs.user.UserManagerBean.getRequestedAccounts(U
    serManagerBean.java:1158)
    at
    com.boa.gcib.docwf.ecf.ejbs.user.UserManager_iq4580_EOImpl.getRequested
    Accounts(UserManager_iq4580_EOImpl.java:46)
    at
    com.boa.gcib.docwf.ecf.ejbs.user.UserManager_iq4580_EOImpl_WLSkel.invok
    e(Unknown Source)
    at
    weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:477)
    at
    weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef
    .java:108)
    at
    weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:420)
    at
    weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedS
    ubject.java:353)
    at
    weblogic.security.service.SecurityManager.runAs(SecurityManager.java:14
    4)
    at
    weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:
    415)
    at
    weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.j
    ava:30)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    Is there anything I am missing?
    Please help me!
    Thanks a lot in advance,
    Mahesh
    Message was edited by:
    Maheshindia

  • Retrieving results for comparison in form based authentication with entitie

    Hi,Im developing an application using EJB3.0 and at the moment im working on a module involving user authentication.I work with the sun java system appserver 9.1 and netbeans 5.5.2 using the default toplink as the persistent provider.I have problems performing user based authentication.where am at is at shown below.I used a SLSB facade design pattern and created an entity from an existing database I built solely for the application (table name user_table). This is the code I have currently:
    Entity
    * UserTable.java
    * Created on 31 March 2008, 16:06
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package Entities;
    import java.io.Serializable;
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.Id;
    import javax.persistence.Table;
    * Entity class UserTable
    * @author Ayo
    @Entity
    @Table(name = "user_table")
    public class UserTable implements Serializable {
    @Id
    @Column(name = "user_id", nullable = false)
    private Integer userId;
    @Column(name = "username")
    private String username;
    @Column(name = "password")
    private String password;
    @Column(name = "user_type")
    private String userType;
    @Column(name = "access_level")
    private String accessLevel;
    @Column(name = "staff_id")
    private Integer staffId;
    @Column(name = "staff_type", nullable = false)
    private String staffType;
    @Column(name = "time_created")
    private String timeCreated;
    @Column(name = "time_modified")
    private String timeModified;
    @Column(name = "time_logged_in")
    private String timeLoggedIn;
    @Column(name = "time_logged_out")
    private String timeLoggedOut;
    @Column(name = "created_by")
    private String createdBy;
    /** Creates a new instance of UserTable */
    public UserTable() {
    * Creates a new instance of UserTable with the specified values.
    * @param userId the userId of the UserTable
    public UserTable(Integer userId) {
    this.userId = userId;
    * Creates a new instance of UserTable with the specified values.
    * @param userId the userId of the UserTable
    * @param staffType the staffType of the UserTable
    public UserTable(Integer userId, String staffType) {
    this.userId = userId;
    this.staffType = staffType;
    * Gets the userId of this UserTable.
    * @return the userId
    public Integer getUserId() {
    return this.userId;
    * Sets the userId of this UserTable to the specified value.
    * @param userId the new userId
    public void setUserId(Integer userId) {
    this.userId = userId;
    * Gets the username of this UserTable.
    * @return the username
    public String getUsername() {
    return this.username;
    * Sets the username of this UserTable to the specified value.
    * @param username the new username
    public void setUsername(String username) {
    this.username=username;
    * Gets the password of this UserTable.
    * @return the password
    public String getPassword() {
    return this.password;
    * Sets the password of this UserTable to the specified value.
    * @param password the new password
    public void setPassword(String password) {
    this.password=password;
    * Gets the userType of this UserTable.
    * @return the userType
    public String getUserType() {
    return this.userType;
    * Sets the userType of this UserTable to the specified value.
    * @param userType the new userType
    public void setUserType(String userType) {
    this.userType = userType;
    * Gets the accessLevel of this UserTable.
    * @return the accessLevel
    public String getAccessLevel() {
    return this.accessLevel;
    * Sets the accessLevel of this UserTable to the specified value.
    * @param accessLevel the new accessLevel
    public void setAccessLevel(String accessLevel) {
    this.accessLevel = accessLevel;
    * Gets the staffId of this UserTable.
    * @return the staffId
    public Integer getStaffId() {
    return this.staffId;
    * Sets the staffId of this UserTable to the specified value.
    * @param staffId the new staffId
    public void setStaffId(Integer staffId) {
    this.staffId = staffId;
    * Gets the staffType of this UserTable.
    * @return the staffType
    public String getStaffType() {
    return this.staffType;
    * Sets the staffType of this UserTable to the specified value.
    * @param staffType the new staffType
    public void setStaffType(String staffType) {
    this.staffType = staffType;
    * Gets the timeCreated of this UserTable.
    * @return the timeCreated
    public String getTimeCreated() {
    return this.timeCreated;
    * Sets the timeCreated of this UserTable to the specified value.
    * @param timeCreated the new timeCreated
    public void setTimeCreated(String timeCreated) {
    this.timeCreated = timeCreated;
    * Gets the timeModified of this UserTable.
    * @return the timeModified
    public String getTimeModified() {
    return this.timeModified;
    * Sets the timeModified of this UserTable to the specified value.
    * @param timeModified the new timeModified
    public void setTimeModified(String timeModified) {
    this.timeModified = timeModified;
    * Gets the timeLoggedIn of this UserTable.
    * @return the timeLoggedIn
    public String getTimeLoggedIn() {
    return this.timeLoggedIn;
    * Sets the timeLoggedIn of this UserTable to the specified value.
    * @param timeLoggedIn the new timeLoggedIn
    public void setTimeLoggedIn(String timeLoggedIn) {
    this.timeLoggedIn = timeLoggedIn;
    * Gets the timeLoggedOut of this UserTable.
    * @return the timeLoggedOut
    public String getTimeLoggedOut() {
    return this.timeLoggedOut;
    * Sets the timeLoggedOut of this UserTable to the specified value.
    * @param timeLoggedOut the new timeLoggedOut
    public void setTimeLoggedOut(String timeLoggedOut) {
    this.timeLoggedOut = timeLoggedOut;
    * Gets the createdBy of this UserTable.
    * @return the createdBy
    public String getCreatedBy() {
    return this.createdBy;
    * Sets the createdBy of this UserTable to the specified value.
    * @param createdBy the new createdBy
    public void setCreatedBy(String createdBy) {
    this.createdBy = createdBy;
    * Returns a hash code value for the object. This implementation computes
    * a hash code value based on the id fields in this object.
    * @return a hash code value for this object.
    @Override
    public int hashCode() {
    int hash = 0;
    hash += (this.userId != null ? this.userId.hashCode() : 0);
    return hash;
    * Determines whether another object is equal to this UserTable. The result is
    * <code>true</code> if and only if the argument is not null and is a UserTable object that
    * has the same id field values as this object.
    * @param object the reference object with which to compare
    * @return <code>true</code> if this object is the same as the argument;
    * <code>false</code> otherwise.
    @Override
    public boolean equals(Object object) {
    // TODO: Warning - this method won't work in the case the id fields are not set
    if (!(object instanceof UserTable)) {
    return false;
    UserTable other = (UserTable)object;
    if (this.userId != other.userId && (this.userId == null || !this.userId.equals(other.userId))) return false;
    return true;
    * Returns a string representation of the object. This implementation constructs
    * that representation based on the id fields.
    * @return a string representation of the object.
    @Override
    public String toString() {
    return "Entities.UserTable[userId=" + userId + "]";
    SLSB
    * UserTableFacade.java
    * Created on 31 March 2008, 16:07
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package Entities;
    import java.util.*;
    import javax.ejb.Stateless;
    import javax.persistence.EntityManager;
    import javax.persistence.PersistenceContext;
    * @author Ayo
    @Stateless
    public class UserTableFacade implements UserTableFacadeLocal {
    @PersistenceContext
    private EntityManager em;
    /** Creates a new instance of UserTableFacade */
    public UserTableFacade() {
    public void create(UserTable userTable) {
    em.persist(userTable);
    public void edit(UserTable userTable) {
    em.merge(userTable);
    public void destroy(UserTable userTable) {
    em.merge(userTable);
    em.remove(userTable);
    public List findAll() {
    return em.createQuery("select Object(o)from UserTable as o").getResultList();
    local interface
    * UserTableFacadeLocal.java
    * Created on 31 March 2008, 16:07
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package Entities;
    import java.util.*;
    import javax.ejb.Local;
    * @author Ayo
    @Local
    public interface UserTableFacadeLocal {
    void create(UserTable userTable);
    void edit(UserTable userTable);
    void destroy(UserTable userTable);
    List findAll();
    controller servlet
    * userCheck.java
    * Created on 15 March 2008, 22:41
    package servlets;
    import Entities.UserTable;
    import Entities.UserTableFacadeLocal;
    import Entities.userValidationBean;
    import Entities.userValidationRemote;
    import java.io.*;
    import java.util.Iterator;
    import java.util.List;
    import java.util.Collection;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import javax.ejb.*;
    * @author Ayo
    * @version
    public class userCheck extends HttpServlet {
    @EJB
    private UserTableFacadeLocal userTableFacade;
    UserTable u;
    String userFellow;
    String pass;
    String username,password;
    /** Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
    * @param request servlet request
    * @param response servlet response
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    /*con=null;
    ps=null;
    rs=null;
    s=null;
    */response.setContentType("text/html;charset=UTF-8");
    PrintWriter out = response.getWriter();
    username=request.getParameter("username");
    password=request.getParameter("password");
    if(username==""||password=="")
    showError("<b><font color=\"red\">Please fill in the required blanks.</font></b>",request,response);
    else
    List user=userTableFacade.findAll();
    for(Iterator it=user.iterator();it.hasNext();)
    u=(UserTable)it.next();
    userFellow= u.getUsername();
    pass=u.getPassword();
    //out.println(" <b>"+elem.getTitle()+" </b><br />");
    //out.println(elem.getBody()+"<br /> ");
    //I used the following two lines to determing if im actually accessing the database and retrieving results, and I get all records in the table(usernames and passwords).
    //BUT I NEED A SPECIFIC RECORD TO MATCH THE USERNAME AND PASSWORD FROM THE FORM AND IF IT DOES NOT MATCH,I REDIRECT TO THE ERROR PAGE.THAT'S WHERE IM STUCK.
    out.println(userFellow);
    out.println(pass);
    /* if(username.equals(userFellow)&&password.equals(pass))
    RequestDispatcher d=request.getRequestDispatcher("blah.jsp");
    d.forward(request,response);
    else
    showError("<b><font color=\"red\">Invalid Login details!</font></b>",request,response);
    private void showError(String errorMsg,HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException
    request.setAttribute("error_msg",errorMsg);
    RequestDispatcher dispatcher=request.getRequestDispatcher("admin_error.jsp");
    dispatcher.forward(request,response);
    // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
    /** Handles the HTTP <code>GET</code> method.
    * @param request servlet request
    * @param response servlet response
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    processRequest(request, response);
    /** Handles the HTTP <code>POST</code> method.
    * @param request servlet request
    * @param response servlet response
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    processRequest(request, response);
    /** Returns a short description of the servlet.
    public String getServletInfo() {
    return "Short description";
    // </editor-fold>
    I NEED HELP.ive been on this for 5 days and i cant seem to get a solution. I tried creating a method (private Collection findByUsername()) and(private Collection
    findByPassword()) in the local interface that would supposedly return records based on input from the form but I got a null pointer and an ejb exception saying
    unknown find method or something, as in ,or an error message that said i cant search records by name or something.I dont know. Or is it the query that is not
    specific enough. I didnt seem to get the syntax right when i was trying to search by username and password.Please someone help me.
    Ayo.

    Hey everyone,
    Is the question I posted that hard?
    I even tried to just load a HTML <img src="picture.jpg"/> tag
    on the login.jsp and even this won't show.
    I'm thinking that the container, with the security mechanism, is blocking
    styles and images???
    Anyone...please help.
    -Yuri

  • ReportEngine (XI-R3.1) is not Serializable and fails on a wbelogic cluster

    In our J2EE web-application we store <b><code>com.businessobjects.rebean.wi.ReportEngines</code></b> in the <b><code>HttpSession</code></b> as recommended.
    <br>From this instance we retrieve the appropriate report "<b><code>ReportEngine</code></b>" instance based on the storeagetoken.
    <br>We retrieve the ReportEngine instance by:
    <br>
    <br><b><code>ReportEngine reportEngine = reportEngines.getServiceFromStorageToken(strEntry);</code></b>     
    <br>
    <br>The above works in a non-clustered single application server environment (weblogic-10).
    <br>
    <br>But in a cluster, if the storage-token and "ReportEngines" are created in one Node, then we get a <b><code>null</code></b> when we try retrieving the <b><code>ReportEngine</code></b> in another node.
    <br>
    <br>We dug in and discovered out that while  "<b><code>ReportEngines</code></b>" implements Serializable  "<b><code>ReportEngine</code></b>" does not implement the same.
    <br>
    <br>We noticed that the .NET SDK implementation of "<b><code>ReportEngine</code></b>" is serializable though (unlike Java).
    <br>
    <br>Does anyone know of any patch for the above.
    <br>
    <br>We have worked around by serializing the <b><code>DocumentInstance</code></b>in the DB and retrieve this using teh storage-token itself as a key.
    <br>Obviously, we use this route only as a workaround (only when we encounter a <b><code>null</code></b> <b><code>ReportEngine</code></b>,due the cluster node switches).
    <br>
    <br>----
    <br>There are other ways to get it to work without our workaround. One is by getting the load-balancer to retain the same weblogic node all thru the user-session (and in this case it works), but he cannot use that kind of a setup in our production environment.
    <br>We have to have the loadbalancer distributing requests to all nodes in the cluster regadless to the session.
    <br>--
    <br>
    <br>Would be glad to know of a SDK-patch for the above serialization issue.
    Edited by: savincent on Aug 11, 2010 9:56 PM
    Edited by: savincent on Aug 11, 2010 10:24 PM

    There's no patch for that in the XI 3.1 and previous product line.
    Your workaround sounds nice, i.e., sticky sessions for the session, and retrieve from token for failover.  When retrieving from the storage token, it serializes the report back from the WebI Report Server.
    Sincerely,
    Ted Ueda

Maybe you are looking for