Results 1 to 4 of 4

Thread: NoObjectFactoryException with class that has no methods

  1. #1
    MarcinK is offline Registered User
    Name: Marcin Kobylarz
    Organization: Posterus Sp. z o. o.
    Project: Remote user database
    Join Date
    Aug 2008
    Posts
    5

    NoObjectFactoryException with class that has no methods

    Hi,

    I don't know if this is a bug or maybe a I have missed something but:

    I declared a method-less class:

    Code:
    class EmailAddressIce
    {
            string emailAddress;
            string displayName;
    };
    I use this class as a input parameter to method changeEmail:

    Code:
    interface IdentityIce
    {
            // ............
            EmailAddressChangeRequestIce* changeEmailAddress(EmailAddressIce emailAddress);
            // ............
    }
    I invocated the method changeEmailAddress from php with an object as an argument and on my java server I got this exception:

    Code:
    26.09.08 10:08:23:218 warning: Ice.ThreadPool.Server-0: dispatch exception:
    identity: pl.posterus.posso.core.Identity/faf68534-df80-40d6-9fb5-9954735dbff3:9
    facet: 
    operation: changeEmailAddress
    Ice.NoObjectFactoryException
        reason = ""
        type = "::interfacesice::EmailAddressIce"
    	at IceInternal.BasicStream.readObject(BasicStream.java:1418)
    	at IceInternal.BasicStream.readPendingObjects(BasicStream.java:1632)
    	at pl.posterus.posso.interfacesice._IdentityIceDisp.___changeEmailAddress(_IdentityIceDisp.java:328)
    	at pl.posterus.posso.interfacesice._IdentityIceDisp.__dispatch(_IdentityIceDisp.java:487)
    	at IceInternal.Incoming.invoke(Incoming.java:166)
    	at Ice.ConnectionI.invokeAll(ConnectionI.java:2045)
    	at Ice.ConnectionI.message(ConnectionI.java:977)
    	at IceInternal.ThreadPool.run(ThreadPool.java:575)
    	at IceInternal.ThreadPool.access$100(ThreadPool.java:12)
    	at IceInternal.ThreadPool$EventHandlerThread.run(ThreadPool.java:951)
    In chapter 10.14.4 one can read:

    Finally, keep in mind that if a class has only data members, but no operations, you need not create and register an object factory to transmit instances of such a class. Only if a class has operations do you have to define and register an object factory.
    I made a test and in my communicator initialisation I did the following:

    Code:
    InitializationData ini = new InitializationData();
    Properties properties = Util.createProperties();
    properties.setProperty("Ice.Trace.Protocol", "1");
    ini.properties = properties;
    
    communicator = Ice.Util.initialize(ini);
    
    // line below makes the exception disappear		
    communicator.addObjectFactory(EmailAddressIce.ice_factory(), EmailAddressIce.ice_staticId());
    And voila! This solved the issue.

    So now my doubt is: is this a bug, a documentation mislead, or maybe I missed something important here?

    My Ice version is 3.3.0.

    Greetings
    Last edited by MarcinK; 09-26-2008 at 04:38 AM.

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

    When you change the package of the generated code, the Ice run time is no longer able to translate a Slice type id such as ::interfacesice::EmailAddressIce into its mapped class name. Specifically, the Ice run time looks for a class named interfacesice.EmailAddressIce but can't find it, which is the reason for the NoObjectFactoryException.

    The solution is to add property definitions that aid the Ice run time in making these translations. In the example you provided, you would define a configuration property like this:

    Code:
    Ice.Package.interfacesice=pl.posterus.posso.interfacesice
    For more information, see Section 10.15 of the manual.

    Regards,
    Mark

  3. #3
    mes's Avatar
    mes
    mes is offline ZeroC Staff
    Name: Mark Spruiell
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Feb 2003
    Location
    California
    Posts
    1,441
    Quote Originally Posted by mes View Post
    Code:
    Ice.Package.interfacesice=pl.posterus.posso.interfacesice
    Sorry, that should be:

    Code:
    Ice.Package.interfacesice=pl.posterus.posso

  4. #4
    MarcinK is offline Registered User
    Name: Marcin Kobylarz
    Organization: Posterus Sp. z o. o.
    Project: Remote user database
    Join Date
    Aug 2008
    Posts
    5
    Not a surprise, you're right . This helped.

    Thank you.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. NoObjectFactoryException
    By halfhp in forum Help Center
    Replies: 3
    Last Post: 10-22-2009, 04:42 PM
  2. Ice.NoObjectFactoryException
    By mcrystal in forum Help Center
    Replies: 1
    Last Post: 12-05-2007, 07:22 PM
  3. NoObjectFactoryException for method-less class
    By borax00 in forum Help Center
    Replies: 7
    Last Post: 07-20-2006, 05:07 AM
  4. Replies: 8
    Last Post: 12-02-2005, 08:46 AM
  5. Ice::NoObjectFactoryException
    By Mr.Freeze in forum Help Center
    Replies: 6
    Last Post: 09-02-2003, 10:27 AM

Posting Permissions

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