To instantiate a session bean, call one of the home interface create methods as shown in the example below. All create methods can raise javax::ejb::CreateException. The example below instantiates the home of a bean with home interface name bookStore/inventory. The IDL remote interface is bookStore::inventory:
try {
bookStore::inventory_var inventory = home->create();
}
catch (javax::ejb::CreateException &ce)
{
cout << "CreateException for component " << component_name << "\n"
<< "Message:" << ce.message << "\n";
}