Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 896497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T14:44:24+00:00 2026-05-15T14:44:24+00:00

I am working on a corba application where in create_servant() method we are creating

  • 0

I am working on a corba application where in create_servant() method we are creating new servant and returning it to the callee. To make the memory management easier, I am inheriting PortableServer::RefCountServantBase class to the implementation class.
I get the below compilation errors.

“simples.cpp”, line 108: Error: Cannot create a variable for abstract class Simple_i.
“simples.cpp”, line 108: Error: PortableServer::ServantBase::invoke(CORBA::ServerRequest*) has not been overridden.
“simples.cpp”, line 108: Error: PortableServer::ServantBase::_primary_interface(const PortableServer::ObjectId&, PortableServer::POA*) has not been overridden.
3 Error(s) detected.

If I don’t inherit RefCountServantBase I don’t get any compilation errors. In samples.cpp, which is not shown here we are creating an instance of sample_i and returning it.

Here is the sample code:

// sample_i.h

#include "simple_s.h"
extern char* generate_unique_id();           // Generate unique uuids

class Simple_i : public virtual POA_Simple
                 , virtual public PortableServer::RefCountServantBase
{
  public:
    virtual char* to_lower(const char* val);
    virtual void  to_upper(char*&      val);
    virtual char* to_print(const char* val);
};

class SimpleFactory_i : public virtual POA_SimpleFactory
                        // , virtual public PortableServer::RefCountServantBase
{
  public:
    virtual Simple_ptr find_simple();

    // To make simpapp scalable have the SimpleFactory use the user
    // supplied identifier in the Simple object reference it creates.
};

================================================================================
// sample_s.h

#include <string.h>
#include "orbminor.h"
#include <Tobj_ServantBase.h>

#include "simple_c.h"

class POA_Simple : public Tobj_ServantBase 
{
    public:

        virtual ::CORBA::Char * to_lower (
            const char * str) = 0; 

        virtual void to_upper (
            ::CORBA::Char *& str) = 0; 

        virtual ::CORBA::Char * to_print (
            const char * str) = 0; 

        ::Simple_ptr _this();

        void invoke (::CORBA::ServerRequest_ptr _nasreq);

        ::CORBA::RepositoryId _primary_interface (
        const PortableServer::ObjectId &,
            PortableServer::POA_ptr);

    protected:
        virtual ~POA_Simple(){ }

    private:
        OBBArgument *getparams (::CORBA::Short, OBB::ServerRequest * SrvReq, ::CORBA::ULong & ArgCnt);

};
class POA_SimpleFactory : public Tobj_ServantBase 
{
    public:

        virtual ::Simple_ptr find_simple () = 0; 

        ::SimpleFactory_ptr _this();

        void invoke (::CORBA::ServerRequest_ptr _nasreq);

        ::CORBA::RepositoryId _primary_interface (
        const PortableServer::ObjectId &,
            PortableServer::POA_ptr);

    protected:
        virtual ~POA_SimpleFactory(){ }

    private:
        OBBArgument *getparams (::CORBA::Short, OBB::ServerRequest * SrvReq, ::CORBA::ULong & ArgCnt);

};
#endif

Update:
I changed the inheritance and did not inherit PortableServer::RefCountServantBase, since RefCountServantBase itself is getting inherited by Tobj_ServantBase.
Now, I have the code as below. Is this fine? Do I need to care about memory management
here ? Or am I missing something?

Tobj_Servant Server::create_servant(const char* intf_repos_id)
{
    Tobj_Servant servant = NULL;
    if (!strcmp(intf_repos_id, _tc_SimpleFactory->id())) {

        servant = new SimpleFactory_i();
    }
    if (!strcmp(intf_repos_id, _tc_Simple->id())) {
        servant = new Simple_i();
    }

    servant->_add_ref();
    return servant; // unknown interface
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T14:44:24+00:00Added an answer on May 15, 2026 at 2:44 pm

    In newer versions of CORBA, RefCountServantBase is deprecated. You no longer need to inherit from it because the auto-generated C++ servants now provide the same functionality. You should verify that the ORB you are using has implemented this change.

    As to the part of your question about your create_servant() function. It should be fine from the servant creation aspect. However it looks strange that you can assign multiple things to your servant variable. If this happened you would leak.

    I also can’t say about _tc_SimpleFactory->id() or _tc_Simple->id() because I’m not familiar with those functions. If they return CORBA strings then you are leaking memory.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 440k
  • Answers 440k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Try to use WinAPI CreateEvent function May 15, 2026 at 5:22 pm
  • Editorial Team
    Editorial Team added an answer A very clean way to solve the problem is to… May 15, 2026 at 5:22 pm
  • Editorial Team
    Editorial Team added an answer check .htaccess file url rewrite or any permission/restrictions etc. upload… May 15, 2026 at 5:22 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.