Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 12-01-2005
richardma richardma is offline
Registered User
 
Name: richard
Organization: qq
Project: wap
 
Join Date: Dec 2005
Posts: 31
Send a message via ICQ to richardma Send a message via MSN to richardma
-->
"NoObjectFactoryException" when call methods in interface by java

when I call a method in interface that was generated by C++ by java, It generated exception as follows:

Ice.NoObjectFactoryException
reason = (null)
type = "::WASP::PlayerInfo"

The phenomena is:
when the value returned is empty, the exception above not appear. But when the value not empty, the exception appear. why???
Reply With Quote
  #2 (permalink)  
Old 12-01-2005
benoit's Avatar
benoit benoit is offline
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 1,540
Hi,

Please see this thread regarding our support policy on the forums.

Thanks,

Benoit.
Reply With Quote
  #3 (permalink)  
Old 12-02-2005
richardma richardma is offline
Registered User
 
Name: richard
Organization: qq
Project: wap
 
Join Date: Dec 2005
Posts: 31
Send a message via ICQ to richardma Send a message via MSN to richardma
-->
Update over

I've done it!
__________________
Wireless Support Platform
---------------------------------------------
Yanbo Ma
Central University for Nationality, P.R.China
http://www.cun.edu.cn
yanboma_bj@yahoo.com.cn
---------------------------------------------
Reply With Quote
  #4 (permalink)  
Old 12-02-2005
benoit's Avatar
benoit benoit is offline
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 1,540
Hi,

Thanks!

It would be useful to see the definition of "::WASP::PlayerInfo". I'll assume it's defined as an abstract Slice class.

If the returned value is null, no object needs to be created so it's expected to not get this exception. However, if it's not null, the process receiving the object over the wire needs to instantiate it. The instantiation is delegated to the object factory. Did you register an object factory for the "::WASP::PlayerInfo" class?

Please see the Ice manual for more information on object factories, the Section 6.14.5 for instance. I also recommend you to have a look at the demo/Ice/value demo from your Ice distribution, it shows how to register object factories.

Benoit.
Reply With Quote
  #5 (permalink)  
Old 12-02-2005
richardma richardma is offline
Registered User
 
Name: richard
Organization: qq
Project: wap
 
Join Date: Dec 2005
Posts: 31
Send a message via ICQ to richardma Send a message via MSN to richardma
-->
need factory?

my slice definition as follows:
class Player
{
int iActId;
int iId;
string sPlayerId;
......
}
class PlayerInfo extends Player
{
int iSupVoteNum;
int iOppVoteNum;
};

sequence<PlayerInfo> SeqPlayInfo;

interface trans
{
SeqPlayInfo GetVoteObjInfo( int iActId, int iPage );
}

===========================================
The methods I call by java client is 'GetVoteObjInfo' in interface trans, No methods in class PlayerInfo, so the server implement by C++ doesn't need factory.
right?
__________________
Wireless Support Platform
---------------------------------------------
Yanbo Ma
Central University for Nationality, P.R.China
http://www.cun.edu.cn
yanboma_bj@yahoo.com.cn
---------------------------------------------
Reply With Quote
  #6 (permalink)  
Old 12-02-2005
benoit's Avatar
benoit benoit is offline
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 1,540
It's not clear from your definitions if the Player class has some methods or not. If it has some methods, then it's abstract and the PlayerInfo class is also abstract since it extends it. So you'll need to register an object factory for the PlayerInfo type if this is the case.

Benoit.
Reply With Quote
  #7 (permalink)  
Old 12-02-2005
richardma richardma is offline
Registered User
 
Name: richard
Organization: qq
Project: wap
 
Join Date: Dec 2005
Posts: 31
Send a message via ICQ to richardma Send a message via MSN to richardma
-->
hi

thanks

the Player class hasn't methods
__________________
Wireless Support Platform
---------------------------------------------
Yanbo Ma
Central University for Nationality, P.R.China
http://www.cun.edu.cn
yanboma_bj@yahoo.com.cn
---------------------------------------------
Reply With Quote
  #8 (permalink)  
Old 12-02-2005
benoit's Avatar
benoit benoit is offline
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 1,540
Ok, so you don't need to register an object factory .

When the Ice for Java runtime receives the "::WASP::PlayerInfo" type, it transforms it to the WASP.PlayerInfo Java class name. It then tries to load this class and instantiates it. If it can't find the class, it throws an Ice.ObjectFactoryException.

Is your CLASSPATH correctly setup? Is the WASP.PlayerInfo class in your CLASSPATH? If it's not this might be the reason for this exception. Also, please post the full stack trace of the exception if possible, this would help to figure out where exactly the exception coming from.

One last thing, if you're using a specific package for your Java generated classes, you will need to set the Ice.Default.Package or Ice.Package.<module> configuration property. See Section 10.15 and 10.15.2 in particular for more information about this.

Benoit.
Reply With Quote
  #9 (permalink)  
Old 12-02-2005
richardma richardma is offline
Registered User
 
Name: richard
Organization: qq
Project: wap
 
Join Date: Dec 2005
Posts: 31
Send a message via ICQ to richardma Send a message via MSN to richardma
-->
Talking problem has been solved, thanks a lot!

thanks
__________________
Wireless Support Platform
---------------------------------------------
Yanbo Ma
Central University for Nationality, P.R.China
http://www.cun.edu.cn
yanboma_bj@yahoo.com.cn
---------------------------------------------
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Don't "Ice-3.1.1-VC71.msi " include the "slice2java.exe"? Jason Gao Help Center 4 10-26-2006 12:23 PM
IceStorm "batch" reliability with Java? SteveWampler Help Center 3 10-27-2005 02:54 PM
Testing the "printer" example in java? zyoracle Help Center 2 06-20-2005 06:22 AM
starting "ice" process (node/admin etc) via Java BobDeAnna Help Center 6 01-04-2005 10:26 AM
Going from "in" to "out" param, using a class as a union catalin Help Center 1 04-05-2004 09:55 AM


All times are GMT -4. The time now is 10:33 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.