StreamCorruptedException when sending object

Hi,
I have successfully created an ObjectOutputStream on the server side of my application, along with an ObjectInputStream on the client side. I think my server sends objects correctly, but when my client tries to receive the objects, I get a StreamCorruptedException (my objects do implement Serializable). Does anyone know what would be the likely cause of this?

It means that something unexpected was read or that an unexpected IOException occurred during ObjectInputStream.readObject().
Are you writing anything else to the ObjectOutputStream, e.g. with a writeInt() method?
Is there a detail member in the exception, & if so what does it say?

Similar Messages

  • [java.nio] StreamCorruptedException when deserializing objects

    Hello everybody!
    I made a messaging (chat) program using java.io where all the client-server communication is done by serializing small objects. Now I would like to covert the server side to the NIO concept and I'm already struck. I successfully pass objects to the client and the client deserializes them, but only the first one! When it try to read the second it fails with a StreamCorruptedException.
    Here�s a sample (testing) code. In the server run() method I first serialize a string, then get its byte array from ByteArrayOutputStream and in the loop periodically send this byte array through the channel. On the client side I just read the deserialized object.
    Server run():
    public void run() {
            try {
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                ObjectOutputStream oos = new ObjectOutputStream(baos);
                oos.writeObject("abcdefgh");
                byte[] objectArr = baos.toByteArray();
                baos.close();
                oos.close();
                ByteBuffer buff = ByteBuffer.allocate(objectArr.length);
                buff.put(objectArr);
                buff.flip();
                while(true) {
                    selector.select();
                    Set keys = selector.selectedKeys();
                    for (Object o : keys) {
                        SelectionKey key = (SelectionKey)o;
                        if (key.isAcceptable()) {
                            ServerSocketChannel server = (ServerSocketChannel) key.channel();
                            clientChannel = server.accept();
                            if (clientChannel == null)
                                continue;
                            clientChannel.configureBlocking(false);
                            SelectionKey clientKey = clientChannel.register(selector, SelectionKey.OP_WRITE);
                        } else if (key.isWritable()) {
                            SocketChannel client = (SocketChannel) key.channel();
                            if (buff.hasRemaining()) {
                                client.write(buff);
                            } else {
                                buff.clear();
                                buff.put(objectArr);
                                buff.flip();
                    try {
                        Thread.currentThread().sleep(2000);
                    } catch (InterruptedException e) {
                        return;
            } catch (IOException e) {
                e.printStackTrace();
        }Client run():
    public void run() {
            try {
                soc = new Socket("localhost", 4000);
                ObjectInputStream ois = new ObjectInputStream(soc.getInputStream());
                while(true) {
                    Object d = ois.readObject();
                    System.out.println("data = " + d.toString());
            } catch (Exception ex) {
                ex.printStackTrace();
        }At the second read I get a StreamCorruptedException.
    Apart from this I would like some hints in how to implement the application with NIO. For example how can I tell the objects apart on the client side � should I send every time a byte array before the object, which tells the length of the next coming object? This is probably not a 100% bulletproof solution and presents additional data transfer?
    Than you in advance!

    OK, I found a solution but I don't like it, because I don't understand it.
    The ObjectOutputStream adds a header (4 bytes) to the stream - if I send the array with those four bytes I get an StreamCorruptedException. If I send the array without the header I also get a StreamCorruptedException: "invalid stream header".
    If I reconstruct the object, by calling ObjectOutputStream.writeObject() and get it's byte array from ByteArrayOutputStream.toByteArray(), every time I have to fill the ByteBuffer, then it works.
    Here's the modified sending block, for the above example:
    } else if (key.isWritable()) {
                            SocketChannel client = (SocketChannel) key.channel();
                            if (buff.hasRemaining()) {
                                client.write(buff);
                            } else {
                                //* ---- added code ---------
                                baos.reset();
                                oos.writeObject("abcdefgh");
                                objectArr = baos.toByteArray();
                                buff.clear();
                                buff.put(objectArr);
                                buff.flip();
                        }   I really don't understand why I have to write the object in the object stream every time. I used ObjectOS and ByteArrayOS, to get the object byte array and then I thought I could forget about those streams and use this array to fill the ByteBuffer. What changes if I send the object through this process with every iteration (and how this harms speed - it's like sending everything twice)? If someone would explain this to me I would appreciate it much.

  • EOFException occur while sending object to servlet

    Hi all,
    I have encountered a problem when sending object from client to servlet. I am using Tomcat 5 and J2SE 1.4.2 and windowx XP Pro.
    Can anyone tells me why it happens? and how to solve it? it takes me a lot of time to solve, but still cannot solve it.
    The following is the error:
    java.IO.EOFException
    at java.io.ObjectInputStream$BlockInputStream.peekByte(ObjectInputStream.java:2435)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1245)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
    The following is my servlet code:
    import java.io.*;
    import javax.servlet.http.*;
    import javax.servlet.*;
    * Only Do Send and Receive -- connect to client
    public class CPServlet extends HttpServlet {
    public void init()
    System.out.println("*******************INIT");
    public void doPost (HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
    ObjectOutputStream oout = null;
    ObjectInputStream oin = null;
    CPManager mgr = new CPManager();
    System.out.println("doPost method");
    System.out.println(request.getMethod());
    response.setContentType("application/x-java-serialized-object");
    oout = new ObjectOutputStream(response.getOutputStream());
    oin = new ObjectInputStream(request.getInputStream());
    System.out.println("**** Start to send content **** ");
    Message msg = mgr.encryptNWrapKey(sth);
    sendContent(msg,oout);
    System.out.println("**** Finish sending First Message ****");
    System.out.println("**** Start to receive content **** ");
    try
    Message customerEncrypted = (Message)oin.readObject();
    catch (Exception e)
    e.printStackTrace();
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
    System.out.println("doGetMethod");
    doGet(request, response);
    public void sendContent(Message msg, ObjectOutputStream oout)
    MyUtil.sendObjectThrSocket(oout,msg);
    System.out.println("Successfully send content to Client");
    public Message receiveContent(ObjectInputStream oin)
    Message msg = (Message)MyUtil.getObjectThrSocket(oin);
    System.out.println("Successfully receive content from Client");
    return msg;

    can anyone help me?
    please

  • [svn] 949: Bug: BLZ-96 - When sending a HttpService request from ActionScript with multiple headers with the same name , it causes a ClassCastException in the server

    Revision: 949
    Author: [email protected]
    Date: 2008-03-27 07:12:59 -0700 (Thu, 27 Mar 2008)
    Log Message:
    Bug: BLZ-96 - When sending a HttpService request from ActionScript with multiple headers with the same name, it causes a ClassCastException in the server
    QA: Yes - try again with legacy-collection true and false.
    Doc: No
    Checkintests: Pass
    Details: Another try in fixing this bug. When legacy-collection is false, Actionscript Array on the client becomes Java Array on the server and my fix yesterday assumed this case. However, when legacy-collection is true, Actionscript Array becomes Java ArrayList on the server. So added code to handle this case.
    Ticket Links:
    http://bugs.adobe.com/jira/browse/BLZ-96
    Modified Paths:
    blazeds/branches/3.0.x/modules/proxy/src/java/flex/messaging/services/http/proxy/RequestF ilter.java

    Hi all!
    Just to post the solution to this if anyone ever runs accross this thread...
    For some reason i had it bad the first time, don't have time right now to see why but here is what worked for me:
    HashMap primaryFile = new HashMap();
    primaryFile.put("fileContent", bFile);
    primaryFile.put("fileName", uploadedFile.getFilename());
    operationBinding.getParamsMap().put("primaryFile", primaryFile);
    HashMap customDocMetadata = new HashMap();
    HashMap [] properties = new HashMap[1];
    HashMap customMetadataPropertyRoom = new HashMap();
    customMetadataPropertyRoom.put("name", "xRoom");
    customMetadataPropertyRoom.put("value", "SOME ROOM");
    properties[0] = customMetadataPropertyRoom;
    customDocMetadata.put("property", properties);
    operationBinding.getParamsMap().put("CustomDocMetaData", customDocMetadata);
    Basically an unbounded wsdl type is an array of objects (HashMaps), makes sense, i thought i had it like this before, must have messed up somewhere...
    Good luck all!

  • [svn] 931: Bug: BLZ-96 - When sending a HttpService request from ActionScript with multiple headers with the same name , it causes a ClassCastException in the server

    Revision: 931
    Author: [email protected]
    Date: 2008-03-26 11:31:01 -0700 (Wed, 26 Mar 2008)
    Log Message:
    Bug: BLZ-96 - When sending a HttpService request from ActionScript with multiple headers with the same name, it causes a ClassCastException in the server
    QA: Yes - we need automated tests for this basic case.
    Doc: No
    Checkintests: Pass
    Details: RequestFilter was not handling multiple headers with the same name properly.
    Ticket Links:
    http://bugs.adobe.com/jira/browse/BLZ-96
    Modified Paths:
    blazeds/branches/3.0.x/modules/proxy/src/java/flex/messaging/services/http/proxy/RequestF ilter.java

    Hi all!
    Just to post the solution to this if anyone ever runs accross this thread...
    For some reason i had it bad the first time, don't have time right now to see why but here is what worked for me:
    HashMap primaryFile = new HashMap();
    primaryFile.put("fileContent", bFile);
    primaryFile.put("fileName", uploadedFile.getFilename());
    operationBinding.getParamsMap().put("primaryFile", primaryFile);
    HashMap customDocMetadata = new HashMap();
    HashMap [] properties = new HashMap[1];
    HashMap customMetadataPropertyRoom = new HashMap();
    customMetadataPropertyRoom.put("name", "xRoom");
    customMetadataPropertyRoom.put("value", "SOME ROOM");
    properties[0] = customMetadataPropertyRoom;
    customDocMetadata.put("property", properties);
    operationBinding.getParamsMap().put("CustomDocMetaData", customDocMetadata);
    Basically an unbounded wsdl type is an array of objects (HashMaps), makes sense, i thought i had it like this before, must have messed up somewhere...
    Good luck all!

  • Need to send object instances over the network

    I found no other way to implement a switch case to cast objects on both sides to solve my problem.
    Basically I need to send objects over a network protocol based on XML, the object is sent inside XML
    converted in base64, overall encoding of XML is utf-8.
    Let's suppose in my network there are 2 peers connected via socket.
    I have multiple instances of different types on both peers but I want to keep these instances
    synchronized. If something changes on side A, side B must receive that instance and replace
    it in the correct place (just one way, from A to B).
    When I receive such instance on B I want to cast it to it's proper instance
    of it's proper type and I am scratching my head on how could I implement this without some
    sort of unique ID table and switch case.
    If I had 1 instance per type could it be done easily?
    But I need to keep in synch many instances per type.
    Is there any dynamic casting that I can trigger based on some type/instanceID information
    I could send along the object?

    I found no other way to implement a switch case to cast objects on both sides to solve my problem.
    Basically I need to send objects over a network protocol based on XML, the object is sent inside XML
    converted in base64, overall encoding of XML is utf-8.
    Let's suppose in my network there are 2 peers connected via socket.
    I have multiple instances of different types on both peers but I want to keep these instances
    synchronized. If something changes on side A, side B must receive that instance and replace
    it in the correct place (just one way, from A to B).
    When I receive such instance on B I want to cast it to it's proper instance
    of it's proper type and I am scratching my head on how could I implement this without some
    sort of unique ID table and switch case.
    If I had 1 instance per type could it be done easily?
    But I need to keep in synch many instances per type.
    Is there any dynamic casting that I can trigger based on some type/instanceID information
    I could send along the object?

  • Make positive vertical position change = UP when moving object? CS6

    When moving an object, entering a positive value for vertical position sends objects DOWN. How do I reverse this such that entering a positive value will move objects UP?Thanks.

    What about the suggestion in the first post in this thread, Reasoner?
    http://forums.adobe.com/message/3859580#3859580?tstart=30#3859580
    It is more work than using a script (was linked to in post #4 in the other thread).
    We may have to ask Carlos to make a new script that works in CS6 (and in CS7 and CS8 and so on).
    Carlos, what say you?

  • When is object type decided?

    I'd like to know when "OLTP Object Type(*)" is decided.
    Though I created the planned order in APO, "OLTP Object Type" wasn't determined.
    I checked existed planned order in my system and I found some planned orders have already been assigned "5" for "OLTP Object Type" but the others haven't been assinged yet.
    When is object type decided? And how can we control this?
    *OLTP Object Type = R/3 Object Type = Order_Type (import parameter of "BAPI_MOSRVAPS_SAVEMULTI3"(Order Category in OLTP System))
    The selectable values are the following.
    0     Stock
    1     Purchase Requisition
    2     Purchase Order
    3     Sales Order
    4     Planning
    5     Planned Order
    6     Production Order
    7     Reservation
    8     APO Local Order
    9     Advanced Shipping Notification
    A     Order Confirmation
    B     Delivery
    I     Inspection Lot
    M     Maintenance Order
    P     Project Order
    R     Proposed Order
    T     Shipment
    V     VMI Stock Transfer Order
         Not yet determined
    You can check the "OLTP Object Type" from transaction code "/n/sapapo/om16" (Ordmap Anchor Table tab).

    Hello Shohei,
    "OLTP Object Type(*)"  is of more importance to the external system; surely, it would be assigned after the number is changed by the CIF .
    The document is created an send it to R/3 or ECC (if you have publication types, Integration models, etc...); when the external system confirm the document and return it to SCM via CIF, the  "OLTP Object Type(*)" should be assigned.
    Probably you only have this number for documents working on planning version 000, and not for other planning versions.
    At the end: "OLTP Object Type(*)" is decided by the external system, when documents go trough CIF.
    Please check the following documentation:
    "Order Category in OLTP System
    The (OLTP or R/3) order category is used in addition to the order number to identify an order that has been transferred from an external (or R/3) system to the APO system.
    Some examples of order categories are sales orders (fixed value 3), purchase orders (fixed value 2), and production orders (fixed value 6).
    You can use various (OLTP or R/3) order categories for certain APO business objects, such as production orders or in-house production.
    For example, a procurement order (BUS10502) in the APO system can contain both procurement orders (category 2) and purchase requisitions (category 1). In APO, the order category is only used to identify an order in combination with the order number. The category is also used in part to determine if an order/schedule line in the APO system can be changed by a user or not (a purchase order, for example, may no longer be changed, while a purchase requisition may still be changed). Generally, the order category is of more importance to the external system. For example, the R/3 system needs to know whether it is a purchase order or a purchase requisition that is being dealt with.
    If an SAP (e.g. R/3) system is not linked to the APO system, and this system is to be used to exchange the order information that requires a certain order category, we recommend that you use the standard values, for example category 2 for business object BUS10502.
    Orders that are created within an APO system, for example in a planning run, are not given an (OLTP) order category when created, since they were not transferred to the APO system from an external system. These orders all automatically receive (for example, when they are imported) the order category 8 (APO local order). These orders have an APO internal order category which distinguishes between criteria such as in-house production or external procurement. In a subsequent (optional) step, an external system can then decide whether an order created in APO is a purchase order (category 2) or a purchase requisition (category 1) and assign it an (OLTP) order category and an (external) order number.
    You find these values in the documentation of the respective function or of the domain fixed values.
    Note that certain functions (for example, configurations) are only possible for certain order categories."
    Regards,
    Gustavo Pérez

  • Send Object With a Note

    Hi
    When selecting 'Send object with a note' from a purchase order and clicking on the 'Attributes' tab the Sensitivity is set to '502 Confidential'.  Can you please advise how to change the sensitivity to '501 Standard'?
    Thanks

    Hi all,
    I have found the solution for it.
    Share with you.
    Inside Function Group:CRM_1O_UI
    Include LCRM_1O_UIF17
    for the 'is_disabled' field control the status of the corresponding fcode.
    Update following code:
    {   INSERT         xxxxx                                      1
    if sy-cprog = 'SAPMCIC0'.
        CALL METHOD toolbar_create_process0->add_button
          EXPORTING
            fcode       = lv_fcode
            icon        = lv_icon
            butn_type   = lv_type
            text        = lv_text
            quickinfo   = lv_tip
            is_disabled = 'X'.
    else.
    *}   INSERT
        CALL METHOD toolbar_create_process0->add_button
          EXPORTING
            fcode       = lv_fcode
            icon        = lv_icon
            butn_type   = lv_type
            text        = lv_text
            quickinfo   = lv_tip
            is_disabled = ' '.
    *{   INSERT         xxxxx                                       2
    endif.
    *}   INSERT

  • Subject line 'space' character is lost when sending mail?

    Hi,
    I'm using JavaMail, and when sending a mail with a subject line that is longer than 62 characters, the last space before the 63rd character becomes a linefeed. This means that when the recipient receives the e-mail, the space in the subject line is actually dropped (becomes a linefeed).
    For example. I send an email with the following subject line: "New User Setup [ITNUS-0005] User Setup Progress Report for: Louise Gans".
    The recipient will receive the following subject: "New User Setup [ITNUS-0005] User Setup Progress Report for: LouiseGans".
    Note the missing space between "Louise Gans". Perhaps someone could test sending out that subject line, and see if they get the same problem?
    Looking at the message source on the recipient client, it shows a line feed / new line where that space is supposed to be.
    Using MS Outlook or GroupWise or another mail client, the subject lines gets sent through perfectly using the same mail server (Groupwise Internet Agent 7.0.3), but using JavaMail to send the mail through that mail server gives me the space problem.
    Can anybody shed some light on why this is happening? I would really appreciate the help.
    Here is an example of the code I am testing with:
    public class SendHtml {
         public static void main(String[] argv) {
              new SendHtml();
         public SendHtml() {
              String  to = "[email protected]";
              String subject = "New User Setup [ITNUS-0005] User Setup Progress Report for: Louise Gans";
              String from = "[email protected]";
              String cc = null;
              String bcc = null;
              String url = null;
              String mailhost = "mail.server.co.za";
              String mailer = "sendhtml";
              String protocol = null, host = null, user = null, password = null;
              String record = null;     // name of folder in which to record mail
              boolean debug = false;
              BufferedReader in =
                   new BufferedReader(new InputStreamReader(System.in));
              try {
                   Properties props = System.getProperties();
                   if (mailhost != null) {
                        props.put("mail.smtp.host", mailhost);
                   // Get a Session object
                   Session session = Session.getInstance(props, null);
                   // construct the message
                   Message msg = new MimeMessage(session);
                   if (from != null) {
                        msg.setFrom(new InternetAddress(from));
                   else {
                        msg.setFrom();
                   msg.setRecipients(Message.RecipientType.TO,
                             InternetAddress.parse(to, false));
                   if (cc != null)
                        msg.setRecipients(Message.RecipientType.CC,
                                  InternetAddress.parse(cc, false));
                   if (bcc != null)
                        msg.setRecipients(Message.RecipientType.BCC,
                                  InternetAddress.parse(bcc, false));
                   msg.setSubject(subject);
                   collect(in, msg);
                   msg.setHeader("X-Mailer", mailer);
                   msg.setSentDate(new Date());
                   // send the thing off
                   Transport.send(msg);
                   System.out.println("\nMail was sent successfully.");
                   // Keep a copy, if requested.
                   if (record != null) {
                        // Get a Store object
                        Store store = null;
                        if (url != null) {
                             URLName urln = new URLName(url);
                             store = session.getStore(urln);
                             store.connect();
                        } else {
                             if (protocol != null)          
                                  store = session.getStore(protocol);
                             else
                                  store = session.getStore();
                             // Connect
                             if (host != null || user != null || password != null)
                                  store.connect(host, user, password);
                             else
                                  store.connect();
                        // Get record Folder.  Create if it does not exist.
                        Folder folder = store.getFolder(record);
                        if (folder == null) {
                             System.err.println("Can't get record folder.");
                             System.exit(1);
                        if (!folder.exists())
                             folder.create(Folder.HOLDS_MESSAGES);
                        Message[] msgs = new Message[1];
                        msgs[0] = msg;
                        folder.appendMessages(msgs);
                        System.out.println("Mail was recorded successfully.");
              } catch (Exception e) {
                   e.printStackTrace();
         public void collect(BufferedReader in, Message msg)
         throws MessagingException, IOException {
              String line;
              String subject = msg.getSubject();
              StringBuffer sb = new StringBuffer();
              sb.append("<HTML>\n");
              sb.append("<HEAD>\n");
              sb.append("<TITLE>\n");
              sb.append(subject + "\n");
              sb.append("</TITLE>\n");
              sb.append("</HEAD>\n");
              sb.append("<BODY>\n");
              sb.append("<H1>" + subject + "</H1>" + "\n");
              sb.append("</BODY>\n");
              sb.append("</HTML>\n");
              msg.setDataHandler(new DataHandler(
                        new ByteArrayDataSource(sb.toString(), "text/html")));
    }

    The header is being "folded" as described in RFC 2822 section 2.2.3.
    The folding doesn't lose the space if unfolding is done properly.
    Perhaps the recipient mail program isn't handling unfolding properly?
    If so, please report the bug to the owner of that program.
    If you need to work around such a buggy program, you can set the
    System property "mail.mime.foldtext" to "false" to disable all folding
    in JavaMail.

  • Runtime error when sending email from PCUI

    Hi,
    When sending email from an activity in PCUI, I get runtime error, Line 2201, error, 'Object Expected'.
    Any idea?
    Thanks,
    AR

    Hi AR,
    This appears to be a javascript error. Could you give some more details about this error.
    Regards,
    Hemanth

  • Classcast exception while sending objects to the server

    I'm getting classcast exception when i try to send objects from the java webstart application at the client side to a server. Its working fine if I do the same without using javaweb start. I'm using hessian client to send objects to the server.
    I've a web app that gets outlook contacts from the client machine and send those to the server. I'm sending these contacts as custom objects(OutlookContact) to the server using hessian client. But these objects are being sent to the server as String objects but not as OutlookContact objects. I don't know whats happening. Can anyone please tell me is there any setting that I need to set in the jnlp file.
    thanks,
    Jayaram

    I am also getting the same error. Please anybody can help

  • How to setup Send Object With Note

    Hi all,
    I was trying to send a message to external email.
    So, for eg, in ME23N, I click on this "Send object with note" to a address which is type U.
    And in SCOT, business object is send as htm file type.
    However, when I receive this mail that i send, there is no url being generated.
    Below is the content of the email:
    If you are not forwarded automatically, use the following link:
    If the link is not to a valid server, log on to the SAP system and check the following object:
    System:     DEV
    Client:     123
    BOR Object Type:     BUS2012
    BOR Object Key:     4000000001
    Which setting am I missing?
    FYI, I'm using ECC 6. Extended notification has been setup.
    Thanks
    Edited by: Jack Wong on Jan 24, 2008 5:07 AM

    Hi Martin,
    Thanks for your reply.
    However, I don't think it's because of the mail server deleted the attachment.
    The htm file is attached to my external mail.
    And the htm file said that it will forward me to the link.
    I'm wondering which setting am I missing.
    Thanks.

  • OutOfMemoryError When Sending Large Image

    Hi All,
    We are developing a midlet that is esentially a photo blogging app. We are using an HTTP POST to send the image to the web server. The code is working properly as we are able to send images up to about 80KB.
    However, when sending images larger than ~80KB, the midlet gets an OutOfMemoryError.
    The image is being sent in chunked data packets, so shouldn't this mean we could send any size file since it would just keep sending more data chunks until it has reached the end of the file?...
    Has anyone else out there encountered this or perhaps know of a work around?
    Any help would be greatly appreciated.
    Thanks!
    Jim

    We are currently loading the entire image into memory at the moment which is
    probably causing the OutOfMemory exceptions. Would you know how native
    phone applications send images through HTTP which are many times the
    size of available memory?
    The only way I could think of is to somehow connect the input stream
    which gets the image from the phone's memory and the output stream
    which writes out the HTTP data. By doing this no new byte array will get
    declared (explicitly anyway) to temporarily hold the entire image in the phone's
    memory. I'm wondering could I accomplish something like that by somehow
    collapsing these two chunks of code into one that declares no arrays to hold
    the entire image in memory?
    Here's our current code for reference:
    Getting the image from the phone
    theFile is a FileConnection object which references the image file we want
                        InputStream fileInputStream = theFile.openInputStream();
                        fileContent = new byte[(int)filesize];
                        fileInputStream.read(fileContent);
                        fileInputStream.close();Writing image to HTTP output stream
    data is a byte[] array holding the entire image in memory
    httpOut is a DataOutputStream
    SuperViewerMidlet.httpOut.write(data);

  • Using FetchType.LAZY when sending entity to remote client

    Is it possible to use FetchType.LAZY when sending an entity (let's say Person) to a remote client? I'm fine with the fact that a call to person.getAddress() would have to return null o throw an exception of some sort. But, is it possible to even send the Person object when using lazy fetching?

    yeah, if you add the CMP jars to the client, it should work, but, if they attempt to introspect the lazy collection, a runtime exception will be thrown since their local copy does not have access to the backing DB... ..I understand the hesitance to have separate object types for different consumers, but, in some cases, it can save time in the long run because you a) avoid these access exceptions and b) have a middle API that can insulate the client or server from changes on the other end (i.e. the server now holds all 'tenants' as a Set, rather then List, but the VO objects still return it as a List so that client code does not need to be updated). You can also find tools to generate the value objects, so your development costs aren't too much hire during the initial release...

Maybe you are looking for

  • Microphone working but faulty probably after Win 8.1 upgrade

    Hi, internal microphone used to work OK but now its functioning but not picking up my voice, it gives the impression its "listening" to something else, a skype test just returns "background" noises, I dont think its a garbled version of my speech as

  • Reflect in other tables

    Hi, We are building a new application ,for that we need few tables in the back end. here are few of them. CREATE TABLE PWA( PROJECT_NUMBER VARCHAR2(200), PROJECT_NAME VARCHAR2(200), WBS_LEVEL VARCHAR2(200), TASK_NUMBER VARCHAR2(200), TASK_NAME VARCHA

  • The History Eraser in Inaction

    I have had the need to do a specific erasure and can't seem to do it. I have a file with a b&w conversion layer applied. I come back a few days later and decide that a portion of the image needs attention, so I open the b&w layer and make a few chang

  • How to show an ALV grid in planning book (using macro-exit)

    Hi Expertss, I am using a macro-exit. Now in the execution flow of this macro-exit I am required to shaow an ALV grid. I tried calling a Zreport in which i am calling alv screen(screen type dialog box). It is giving a short-dump saying Exception cond

  • What is BPE_ADPTER error

    In a http-XI scenario, in moni i can see Error_Category as BPE_ADPTER what is BPE_ADPTER error,