UnmarshalOutOfBoundsException in eclipse plugin

in Help Center
Hi.
I developed some ice modules.
In a common (to many others) Eclipse RCP plugin (com.egicon.ats.grid.common) I defined
GridException.ice where is defined an exception
While in another plugin (com.egicon.ats.grid.devices.plcbeckhoff) I defined some other types over a derived exception. The Ice file AtsPlcBeckhoff.ice
The client and the server share the same *.ice file.
I tried every setting (saw on this forum and read in the documentation) in my config file, but unfortunatelly I'm still getting the same UnmarshalOutOfBoundsException.
After a day of trials I don't know what to do else. Could you please help me?
My config file is:
Thank you a lot in advance.
Enrico
I developed some ice modules.
In a common (to many others) Eclipse RCP plugin (com.egicon.ats.grid.common) I defined
GridException.ice where is defined an exception
#ifndef GRID_EXCEPTION_ICE #define GRID_EXCEPTION_ICE module com { module egicon { module ats { module grid { module common { exception GridException { string description; string file; long line; }; }; }; }; }; }; #endif
While in another plugin (com.egicon.ats.grid.devices.plcbeckhoff) I defined some other types over a derived exception. The Ice file AtsPlcBeckhoff.ice
#ifndef ATS_PLC_BECKHOFF_ICE #define ATS_PLC_BECKHOFF_ICE #include <GridException.ice> module com { module egicon { module ats { module grid { module devices { module plcbeckhoff { exception PlcBeckhoffException extends ::com::egicon::ats::grid::common::GridException { long plcErrorCode; }; .......
The client and the server share the same *.ice file.
I tried every setting (saw on this forum and read in the documentation) in my config file, but unfortunatelly I'm still getting the same UnmarshalOutOfBoundsException.
-- 10/01/12 19:21:18:882 Slicing: unknown exception type `::com::egicon::ats::grid::devices::plcbeckhoff::PlcBeckhoffException' -- 10/01/12 19:21:18:886 Slicing: unknown exception type `::com::egicon::ats::grid::common::GridException' Ice.UnmarshalOutOfBoundsException reason = "unknown exception type `::com::egicon::ats::grid::devices::plcbeckhoff::PlcBeckhoffException'"
After a day of trials I don't know what to do else. Could you please help me?
My config file is:
# # The IceGrid locator proxy. # Ice.Default.Locator=AtsGrid/Locator:default -p 4061 # # This property is used by the clients to connect to IceStorm. # IceStorm.TopicManager.Proxy=IceStorm/TopicManager PlcBeckhoff.Subscriber.Endpoints=tcp #Ice.Package.common=com.egicon.ats.grid Ice.Default.Package=com.egicon.ats.grid.devices.common Ice.Trace.Slicing=1
Thank you a lot in advance.
Enrico
0
Comments
To unmarshal an exception, the Ice run time translates a Slice type ID (such as ::com::egicon::ats::grid::devices::plcbeckhoff::PlcBeckhoffException) into an equivalent Java class name and then attempts to dynamically load that class. If the run time states that an exception type is unknown, it means that Ice was unsuccessful in performing these steps.
Such a situation could occur if the class is missing from your CLASSPATH. However, this is unlikely if your program contains static references to these classes, such as a catch statement like this:
Clearly, this code could only compile and run if the generated exception classes were already present in your CLASSPATH. If your code does not contain any static references to the generated exception classes, I suggest that you carefully check the contents of your CLASSPATH to verify that these classes are present.
Another possibility is a class loader issue. If I understand your situation correctly, you are using Ice from within an Eclipse plug-in. If that's the case, it's possible that the Ice run time is not using the correct class loader when attempting to locate the generated exception classes. You may need to supply a different class loader when initializing your communicator.
Regards,
Mark
Yes it is correct.
I'm tring to solve the problem but it's very diffucult.
Building a sample (simplified respect to the original) but with the same modules relations, I stated that the problem seems to be the eclipse integration. Better, it seems to be in relation to the fact that OSGI uses differents class loaders for each plugin.
In fact if I launch my code as JUnit (by JUnit runner) everything works fine; while if I integrate the plugin inside an eclipse application everyting stops to work.
I don't know exactly how to work with class loader and I'm looking at this article:
EclipseZone - Eclipse - a tale of two VMs (and many classloaders)
I hope it will help me.
Could you give me any more ideas ? I tried to put in classpath the generated the bin folder of all plugin that defines an Exception class, but the proble still be there.
Thank you a lot again
have you try to add the common plug-in to "Manifest > Dependencies > Required Plug-ins"
Yes I tried.
Below is reported the "common plugin" Manifest.mf where the base exception GridException is defined
Export-Package row, shows that the package where resides GridException generated code is exported
The simplified plugin I've done is represented from this slice file
dummyOperation simply throws DummyException (that is derived from GridException)
The dummy plugin Manifest.mf is
In the Required-Bundle section com.egicon.ats.grid.common is specified.
I'm becoming crazy
Unfortunately also this has gone bad.:(
The sympton is ever the same: launching my test as a simple test works fine. Launch the same sample code as eclipse plugin works bad
Hope my last trial will help you .... to help me.
Thank you a lot again
Ok I will prepare it. It is not immediate due to the fact that now everyting is working in an ice grid infrastructure.
I've uploaded a sample project that reproduce the problem.
I've modified the hello example provided with Ice.
Running this plugin will end throwing OutOfBundleException.
P.S I add com.zeroc.ice.* plugin in the next post due to the limit of five files
Attachment not found.
Attachment not found.
Attachment not found.
Thank you again
Enrico
As I exaplined we are in Eclipse-RCP plugin scenario and we have two plugin; the first wrap zeroc Ice jars, the other use it.
To allow Ice throwing a user defined Excpetion with a correct runtime cast (avoiding UnmarshallOutOfBoundException) we used BuddyPolicy in both plugin.
So both Manifest.MF of our plugins report the line:
Eclipse-BuddyPolicy: registered
I hope this help some one in the future!
bye