Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DATASNAP Class not registered

Status
Not open for further replies.

matiasUTN

Programmer
Aug 29, 2006
5
AR
What I must use in server DATASNAP to be able to accede from the client by means of an IP? With machine name I can do it, but with IP not, I obtain the error “Class not registered”.
Some idea?
 
First of all let me point out that I am not sure if what you will read below will help you or not. I just thought I'd share some thoughts since no one else has replied to this question yet.

I know of two reasons which cause "Class not registered" error.

Reason 1:
You are using an ActiveX or other COM object which is not registered in the computer you

run your program.


Reason 2:
You or the components you use are trying to load a delphi object from a stream and that

objects delphi class is not registered by default in your program.


I think in your case its probably "Reason 1". I have never used DATASNAP so i can NOT be

sure. I searched a little on the internet for you because I found it interesting to learn

about and it appears that DATASNAP server side requires that you deploy "MIDAS.DLL" on the

server machine and also on the Client machine (unless you use MidasLib unit in which case

you would not need it in the client machine)[see also Ref 1 below]. I think you will need

Use regsvr32.exe to register Midas.DLL as it contains COM objects (see also Ref 2,3 and 4).


If it is "reason 2" then you would typically see a message "[ClassName] class is not

registered" which would tell you the class you will need to register. And to register it

you can add the following code at the begining of your program :

RegisterClass(ClassName)



Web References:
[1]

[2]

read/fc5b3d7e7bd8fa6f/5e345321cd5d9e0b%235e345321cd5d9e0b

[3]

read/938e83c341c9f2ff/8fcc266ed9f1f533%238fcc266ed9f1f533

[4]

d/117c37037275bd36/133839f1a3b839c3%23133839f1a3b839c3


I hope the above will help you or at the very least i hope it wont cause more confusion.


Good luck
 
Ok, this is a difficult one.

Examining the code, this happens when you set the active property to true of the DCOM connection:

Code:
procedure TDCOMConnection.DoConnect;
begin
  if (FObjectBroker <> nil) then
  begin
    repeat
      if FComputerName = '' then
        FComputerName := FObjectBroker.GetComputerForGUID(GetServerCLSID);
      try
        SetAppServer(CreateRemoteComObject(ComputerName, GetServerCLSID) as IDispatch);
        FObjectBroker.SetConnectStatus(ComputerName, True);
      except
        FObjectBroker.SetConnectStatus(ComputerName, False);
        FComputerName := '';
      end;
    until Connected;
  end else if (ComputerName <> '') then
    SetAppServer(CreateRemoteComObject(ComputerName, GetServerCLSID) as IDispatch) else
    inherited DoConnect;
end;

so it will call the CreateRemoteComObject procedure with a computername/ip address and a CSLID.

searching the net, I stumbled on this link :


while this is not the solution to your problem, I think you need to fiddle with DCOMCNFG and its settings for your DCOM server.

Cheers,
Daddy



-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
Once more just a thought to share.

Since it works with a computer name and not with IP a possible workaround would be to find the computer name given its IP. I dont know if that is acceptable to your case.

Here is one link which seems to show how to get ComputerName from IP , I havent tested it, so it may or may not work:

 
thanks friends: I have been proving several alternatives to solve the problem, and I have not been able. The peculiar thing is that when making changes in the code of the DCOM server, when I return to compile, this one returns the code to its original format.
I have proven to do the following thing in the Server_TLB.pas: 1 Change the MachineName by the IP
2 Use ipaddr instead of MachineName
and one series of changes more than has not been. In any case I have decided to continue using like MachineName the hostname not to suspend my project. More ahead I will return on the subject. Greetings and thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top