Archived

This forum has been archived. Please start a new discussion on GitHub.

UnmarshalOutOfBoundsException

hi , when I throw an userException defined how:

// EXCEPTIONS

["java:getset"]
exception TVBLOBException {
/**
* Server supplied unique identifier of the operation.
*
* TODO investigate possibility of making this read-only
*
*/
int ticket;

/**
* Server supplied message suitable for logging but NOT for presentation
* to user.
*/
string message;
};

exception SystemError extends TVBLOBException {};

if I try to execute my test client from the same PC I don't have problem ,
if the server and client application are executed on different PC the client receive that exception:

../../include/Ice/BasicStream.h:578: Ice::UnmarshalOutOfBoundsException:
protocol error: out of bounds during unmarshaling

I don't have idea what is the problem in the documentation I fond that this exception is thrown when the exception is of an unknown type

thank for al info about
Andrea
=============
sorry the problem was founded ...........
=============

Comments

  • The most common reason for an UnmarshalOutOfBoundsException is if the client and the server use different interface definitions. Please see this FAQ for more details.
  • I am having a similar issue with user exceptions. I have defined an exception and a class:

    module Trainer
    {

    module Scenario
    {

    exception DatabaseException
    {

    string Message;

    };

    };

    }; // First file, contains type definitions

    module Trainer
    {

    module Scenario
    {

    class ScenarioDatabase
    {
    void DeleteScenario (string Name) throws DatabaseException;

    }
    };

    }; // Second file, contains interfaces / events / classes

    I am not using the Java metadata information as mentioned in the FAQ. I have recompiled all of my software and I'm sure that the slice files are the same (client and server are in the same source tree). In my server I'm doing the following to test the client's handling of the DatabaseException:

    void DeleteScenario (String Name) throws DatabaseException
    {
    throw new DatabaseException ("Test Exception");
    }

    I've also tried:

    void DeleteScenario (String Name) throws DatabaseException
    {
    DatabaseException e = new DatabaseException();
    e.Message = new String("Test Exception");
    throw e;

    }

    Both ways give me an Ice.UnmarshalOutOfBoundsException (reason = "unknown exception type `::Trainer::Scenario::DatabaseException') on the client only. With slice tracing on, on the client, I get "Slicing: unknown exception type `::Trainer::Scenario::DatabaseException'". The server has no issues. The client's jar file does contain the Trainer.Scenario.DatabaseException class file.

    I am running Java 1.5.0_16 on a RHEL 4.7 server.
  • mes
    mes California
    Hi,

    I tried to reproduce this situation using Ice 3.3.1 and JDK 1.5 on CentOS 5.2 and everything worked correctly. To look into this any further we would need a complete example from you that demonstrates the problem. Ideally you could provide the same JAR files you are using. If you'd rather not post the files here, you can send them to me via email.

    Regards,
    Mark
  • mes,

    I am able to reproduce this bug using the examples provided in the Ice-3.3.1.tar.gz file. I am running example demoj/Ice/invoke. When running the client, I enter '9' to throw an exception. I then receive:

    Ice.UnmarshalOutOfBoundsException
    reason = "unknown exception type `::Demo::PrintFailure'"
    at IceInternal.BasicStream.throwException(BasicStream.java:1672)
    at Ice.InputStreamI.throwException(InputStreamI.java:192)
    at Client.run(Client.java:270)
    at Ice.Application.main(Application.java:116)
    at Ice.Application.main(Application.java:64)
    at Client.main(Client.java:318)
    Caused by: Ice.UnmarshalOutOfBoundsException
    reason = (null)
    at IceInternal.BasicStream.readSize(BasicStream.java:610)
    at IceInternal.BasicStream.readString(BasicStream.java:1285)
    at IceInternal.BasicStream.throwException(BasicStream.java:1664)
    ... 5 more
  • matthew
    matthew NL, Canada
    What platform is that? What JDK? Are you sure you don't have an old version of Ice.jar in your CLASSPATH or similar?
  • I'm running on Red Hat Enterprise Linux ES release 4 (Nahant Update 8), with the 2.6.9-89.EL kernel. My JDK is 1.5.0_16 (standard Sun JVM). The only Ice.jar file on my CLASSPATH is installed in $JAVA_HOME/jre/lib/ext. Its md5sum matches the Ice.jar file in /usr/share/java. I am compiling with Apache Nat version 1.6.5. I'm not currently adding any of the *ice* jar files in /usr/share/java to my CLASSPATH. I've tried adding ant-ice.jar and IceGridGUI.jar to my CLASSPATH, recompiling the demo, and re-running with the same results.

    Let me know if you'd like me to try anything / run some test code on my end.
  • mes
    mes California
    Hi Harry,

    I was able to reproduce this problem. The crucial bit of information was the fact that Ice.jar is installed in your JVM's extension directory.

    The exception occurs because of a class loader failure when Ice attempts to dynamically load the class for a user exception (the same situation could occur for a Slice class). Everything works fine when Ice.jar is in your CLASSPATH because Ice uses the system class loader to find the generated exception class. The problem occurs when Ice.jar is installed as an extension, in which case Ice is trying to use the extension class loader to find the generated exception class. The extension class loader doesn't look for classes in CLASSPATH, so Ice fails to find the exception.

    We'll fix this for the next release. Meanwhile, the simplest solution is to remove Ice.jar from the extension directory and add it to your CLASSPATH.

    Regards,
    Mark