Results 1 to 11 of 11

Thread: UnmarshalOutOfBoundsException in eclipse plugin

  1. #1
    piccinini is offline Registered User
    Name: Enrico Piccinini
    Organization: Egicon
    Project: Robotics
    Join Date
    Feb 2010
    Posts
    20

    UnmarshalOutOfBoundsException in eclipse plugin

    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

    Code:
    #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

    Code:
    #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.

    Code:
    -- 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:

    Code:
    #
    # 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

  2. #2
    mes's Avatar
    mes
    mes is online now ZeroC Staff
    Name: Mark Spruiell
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Feb 2003
    Location
    California
    Posts
    1,445
    Hi Enrico,

    To unmarshal an exception, the Ice run time translates a Slice type ID (such as ::com::egicon::ats::grid::devices::plcbeckhoff::Pl cBeckhoffException) 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:

    Code:
    catch(com.egicon.ats.grid.devices.plcbeckhoff.PlcBeckhoffException ex)
    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

  3. #3
    piccinini is offline Registered User
    Name: Enrico Piccinini
    Organization: Egicon
    Project: Robotics
    Join Date
    Feb 2010
    Posts
    20
    Thank you Mess for your answer.

    If I understand your situation correctly, you are using Ice from within an Eclipse plug-in
    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

  4. #4
    xdm's Avatar
    xdm
    xdm is online now ZeroC Staff
    Name: Jose Gutierrez de la Concha
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Sep 2003
    Location
    La Coruņa, Spain
    Posts
    588
    Hi,

    have you try to add the common plug-in to "Manifest > Dependencies > Required Plug-ins"

  5. #5
    piccinini is offline Registered User
    Name: Enrico Piccinini
    Organization: Egicon
    Project: Robotics
    Join Date
    Feb 2010
    Posts
    20

    Unhappy

    Hi Xdm.

    Yes I tried.

    Below is reported the "common plugin" Manifest.mf where the base exception GridException is defined
    Code:
    Manifest-Version: 1.0
    Bundle-ManifestVersion: 2
    Bundle-Name: Common
    Bundle-SymbolicName: com.egicon.ats.grid.common
    Bundle-Version: 1.0.0.qualifier
    Bundle-Activator: com.egicon.ats.grid.common.Activator
    Bundle-Vendor: EGICON
    Require-Bundle: org.eclipse.ui,
     org.eclipse.core.runtime,
     com.zeroc.ice;bundle-version="3.4.1"
    Bundle-RequiredExecutionEnvironment: JavaSE-1.6
    Export-Package: com.egicon.ats.grid.common
    Bundle-ClassPath: .
    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
    Code:
    #include <GridException.ice>
    module com {
    	module egicon {
    		module ats {
    			module dummymodule
    			{
    			//	exception PlcBeckhoffException extends ::com::egicon::ats::grid::common::GridException  
    			//	{
    			//		long plcErrorCode;
    			//	};
    
    				exception DummyException  extends ::com::egicon::ats::grid::common::GridException
    				{
    					long plcErrorCode;
    				};
    				
    				interface DummyInterface 
    				{ 
    					void dummyOperation()throws DummyException;
    				};
    
    			}; 
    		};
    	};
    };
    dummyOperation simply throws DummyException (that is derived from GridException)

    The dummy plugin Manifest.mf is
    Code:
    Manifest-Version: 1.0
    Bundle-ManifestVersion: 2
    Bundle-Name: Dummy
    Bundle-SymbolicName: com.egicon.ats.grid.devices.dummy
    Bundle-Version: 1.0.0.qualifier
    Bundle-Activator: com.egicon.ats.grid.devices.dummy.Activator
    Bundle-Vendor: EGICON
    Require-Bundle: org.eclipse.ui,
     org.eclipse.core.runtime,
     com.zeroc.ice;bundle-version="3.4.1",
     com.egicon.ats.grid.serviceconnection;bundle-version="1.0.0",
     com.egicon.ats.grid.common;bundle-version="1.0.0"
    Bundle-RequiredExecutionEnvironment: JavaSE-1.6
    Bundle-ActivationPolicy: lazy
    Export-Package: com.egicon.ats.dummymodule,
     com.egicon.ats.grid.devices.dummy
    Bundle-ClassPath: .
    In the Required-Bundle section com.egicon.ats.grid.common is specified.

    I'm becoming crazy

  6. #6
    xdm's Avatar
    xdm
    xdm is online now ZeroC Staff
    Name: Jose Gutierrez de la Concha
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Sep 2003
    Location
    La Coruņa, Spain
    Posts
    588
    Can you upload a small sample that reproduce your problem, it will be easy for us to look at it.

  7. #7
    piccinini is offline Registered User
    Name: Enrico Piccinini
    Organization: Egicon
    Project: Robotics
    Join Date
    Feb 2010
    Posts
    20
    My last trial was a drammatically semplification of my slice file: none nested module, none derived exception but only a simple exception, none dependency from a common plugin

    Code:
    			module dummymodule
    			{
    				exception DummyException 
    				{
    					string description;
    					string file;
    					long   line;
    					long plcErrorCode;
    				};
    				
    				interface DummyInterface 
    				{ 
    					void dummyOperation()throws DummyException;
    				};
    
    			};
    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
    Code:
    -- 12/01/12 03:33:40:312 Slicing: unknown exception type `::dummymodule::DummyException'
    Hope my last trial will help you .... to help me.

    Thank you a lot again

  8. #8
    piccinini is offline Registered User
    Name: Enrico Piccinini
    Organization: Egicon
    Project: Robotics
    Join Date
    Feb 2010
    Posts
    20
    Quote Originally Posted by xdm View Post
    Can you upload a small sample that reproduce your problem, it will be easy for us to look at it.
    Ok I will prepare it. It is not immediate due to the fact that now everyting is working in an ice grid infrastructure.

  9. #9
    piccinini is offline Registered User
    Name: Enrico Piccinini
    Organization: Egicon
    Project: Robotics
    Join Date
    Feb 2010
    Posts
    20
    Hi,

    I've uploaded a sample project that reproduce the problem.

    I've modified the hello example provided with Ice.

    • The server hello.zip is in C++ and has been modified to make sayHallo operation throw DummyException
    • com.egicon.hello.zip is the main plugin for the client. Everything happens inside the Activator.java. You can launch the plugin using hello.launch (debug as eclipse application)
    • The other plugins com.egicon.ats.grid.serviceconnection.zip and com.egicon.common.zip to satisfy all dependencies
    • com.zeroc.ice.* is a plugin (splitted on more rar file to met upload dimensions requirement) that wrap all Ice jars

    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
    Last edited by piccinini; 01-12-2012 at 06:47 AM.

  10. #10
    piccinini is offline Registered User
    Name: Enrico Piccinini
    Organization: Egicon
    Project: Robotics
    Join Date
    Feb 2010
    Posts
    20
    com.zeroc.ice.* (are zipped rar files)

    com.zeroc.ice.part2.zip
    com.zeroc.ice.part1.zip
    com.zeroc.ice.part3.zip

    Thank you again
    Enrico

  11. #11
    piccinini is offline Registered User
    Name: Enrico Piccinini
    Organization: Egicon
    Project: Robotics
    Join Date
    Feb 2010
    Posts
    20

    Eureka!!! Problem solved

    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Eclipse Plugin and Ice
    By marcel in forum Bug Reports
    Replies: 1
    Last Post: 04-08-2010, 08:09 PM
  2. 3.4 Eclipse plugin
    By marcel in forum Help Center
    Replies: 1
    Last Post: 03-09-2010, 11:35 PM
  3. Eclipse C++ plugin...
    By krisjakobsen in forum Comments
    Replies: 3
    Last Post: 03-09-2010, 03:44 AM
  4. Eclipse plugin
    By rincewind in forum Comments
    Replies: 9
    Last Post: 09-14-2009, 12:23 PM
  5. Source for Eclipse plugin?
    By mefoster in forum Help Center
    Replies: 2
    Last Post: 01-27-2009, 04:14 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •