Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 09-26-2004
fw_csha fw_csha is offline
Registered User
 
 
Join Date: Sep 2004
Posts: 22
a runtime error

i have succeed in compiling and linking the "hello world example" (the example in notebook) .
but when i run them .


what i do are as follows:
1 . run the server.exe (nothing happen)
2 . run the client.exe
it shows that
"This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information."

the server dose not receive the message "hello world".

thanks !
Reply With Quote
  #2 (permalink)  
Old 09-26-2004
fw_csha fw_csha is offline
Registered User
 
 
Join Date: Sep 2004
Posts: 22
/////////////////////////////////////////
//server.cpp
/////////////////////////////////////////
#include <Ice/Ice.h>
#include "Printer.h"
using namespace std;
class PrinterI : public Printer {
public:
virtual void printString(const string & s,const Ice::Current &);
};
void PrinterI:rintString(const string & s, const Ice::Current &)
{
cout << s << endl;
}
int
main(int argc, char* argv[])
{
int status = 0;
Ice::CommunicatorPtr ic;
try {
ic = Ice::initialize(argc, argv);
Ice::ObjectAdapterPtr adapter = ic->createObjectAdapterWithEndpoints(
"SimplePrinterAdapter", "default -p 22222");
Ice::ObjectPtr object = new PrinterI;
adapter->add(object,
Ice::stringToIdentity("SimplePrinter"));
adapter->activate();
ic->waitForShutdown();
} catch (const Ice::Exception & e) {
cerr << e << endl;
status = 1;
} catch (const char * msg) {
cerr << msg << endl;
status = 1;
}
if (ic)
ic->destroy();
return status;
}

/////////////////////////////////////
//client.cpp
/////////////////////////////////////

#include <Ice/Ice.h>
#include "Printer.h"
using namespace std;
int
main(int argc, char * argv[])
{
int status = 0;
Ice::CommunicatorPtr ic;
try {
ic = Ice::initialize(argc, argv);
Ice::ObjectPrx base = ic->stringToProxy(
"SimplePrinter:default -p 22222");
PrinterPrx printer = PrinterPrx::checkedCast(base);
if (!printer)
throw "Invalid proxy";
printer->printString("Hello World!");
} catch (const Ice::Exception & ex) {
cerr << ex << endl;

status = 1;
} catch (const char * msg) {
cerr << msg << endl;
status = 1;
}

if (ic)
ic->destroy();
return status;
}

Last edited by fw_csha : 09-26-2004 at 11:28 AM.
Reply With Quote
  #3 (permalink)  
Old 09-26-2004
stephan stephan is offline
Registered User
 
Name: Stephan Stapel
Organization: Stephan Stapel
Project: BristolNG
 
Join Date: Oct 2003
Location: Essen, Germany
Posts: 169
Imho not too much wrong with the code.
As you seem to be running Windows (the error message you wrote is a Windows error message, isn't it?), did you try to run the application from within Visual Studio? The integrated debugger should give additional information.

Also: Did you compile your program in debug mode? If so, please try to use release mode and see if the program still breaks down. I had some cases where debug mode applications crashed whereas the release mode compiled versions run perfectly...

regs,

Stephan
Reply With Quote
  #4 (permalink)  
Old 09-27-2004
bernard's Avatar
bernard bernard is online now
ZeroC Staff
 
Name: Bernard Normier
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Palm Beach Gardens, FL
Posts: 816
Crash in debug, works fine in release ... sounds like a runtime library issue.

When you build Ice in debug more, everything is built with /MDd: all the libraries have a 'd' suffix (e.g. iced.lib and ice15d.dll) and are linked with the debug multi-threaded VC++ runtime DLLs.

When you build Ice in release mode, everything is built with /MD: no 'd' suffix (ice.lib, ice15.lib), and all the libraries and linked with the release multi-threaded VC++ runtime DLLs.

When you build your application, choose /MD or /MDd, and link with the corresponding Ice libraries.

Cheers,
Bernard
Reply With Quote
  #5 (permalink)  
Old 09-27-2004
stephan stephan is offline
Registered User
 
Name: Stephan Stapel
Organization: Stephan Stapel
Project: BristolNG
 
Join Date: Oct 2003
Location: Essen, Germany
Posts: 169
Quote:
Originally posted by bernard
Crash in debug, works fine in release ... sounds like a runtime library issue.
I didn't say that this is the problem. That was just an assumption
Reply With Quote
  #6 (permalink)  
Old 09-28-2004
fw_csha fw_csha is offline
Registered User
 
 
Join Date: Sep 2004
Posts: 22
Quote:
Originally posted by bernard
Crash in debug, works fine in release ... sounds like a runtime library issue.

When you build Ice in debug more, everything is built with /MDd: all the libraries have a 'd' suffix (e.g. iced.lib and ice15d.dll) and are linked with the debug multi-threaded VC++ runtime DLLs.

When you build Ice in release mode, everything is built with /MD: no 'd' suffix (ice.lib, ice15.lib), and all the libraries and linked with the release multi-threaded VC++ runtime DLLs.

When you build your application, choose /MD or /MDd, and link with the corresponding Ice libraries.

Cheers,
Bernard


I have tried to compile the files in release ,but the problem still exists.

Maybe it is caused by the config file that does't have extended name.

Where could i find some instructions for writing the config file?



#
# The client reads this property to create the reference to the
# "hello" object in the server.
#
Hello.Proxy=hello:tcp -p 10000:udp -p 10000:ssl -p 10001

#
# The server creates one single object adapter with the name
# "Hello". The following line sets the endpoints for this
# adapter.
#
Hello.Endpoints=tcp -p 10000:udp -p 10000:ssl -p 10001

#
# Warn about connection exceptions
#
Ice.Warn.Connections=1

#
# We want a faster ACM for this demo.
#
Ice.ConnectionIdleTime=10

#
# Network Tracing
#
# 0 = no network tracing
# 1 = trace connection establishment and closure
# 2 = like 1, but more detailed
# 3 = like 2, but also trace data transfer
#
Ice.Trace.Network=0

#
# Protocol Tracing
#
# 0 = no protocol tracing
# 1 = trace protocol messages
#
Ice.Trace.Protocol=0

#
# Security Tracing
#
# 0 = no security tracing
# 1 = trace warning messages
# 2 = config file parsing warnings
#
IceSSL.Trace.Security=0

#
# SSL Configuration File
#
# An XML based file that specifies the certificates, keys, SSL version
# and other pertinent information for creating an SSL connection.
#
Ice.Plugin.IceSSL=IceSSL:create
IceSSL.Client.CertPath=../../../certs
IceSSL.Client.Config=sslconfig.xml
IceSSL.Server.CertPath=../../../certs
IceSSL.Server.Config=sslconfig.xml

#
# Glacier settings
#
Glacier.Router.Endpoints=default -p 10005
Glacier.Router.Client.Endpoints=tcp:udp:ssl
Glacier.Router.Trace.Client=2
Glacier.Router.Trace.RoutingTable=1

#
# Uncomment the following lines if you want to run this demo with Glacier
#
#Ice.Default.Router=Glacier/router:default -p 10005

#
# IcePack registry settings (assumes that a db directory exists in the
# current working directory).
#
IcePack.Registry.Client.Endpoints=default -p 10006
IcePack.Registry.Server.Endpoints=default
IcePack.Registry.Admin.Endpoints=default
IcePack.Registry.Data=db
IcePack.Registry.DynamicRegistration=1

#
# Uncomment the following lines if you want to run this demo with the
# IcePack registry. Note that we override properties previously set
# above, so make sure to comment out these properties to run the demo
# without IcePack.
#
#Hello.Proxy=hello@HelloAdapter
#Hello.Endpoints=tcp:udp:ssl
#Hello.AdapterId=HelloAdapter
#Ice.Default.Locator=IcePack/Locator:default -p 10006
Reply With Quote
  #7 (permalink)  
Old 09-28-2004
stephan stephan is offline
Registered User
 
Name: Stephan Stapel
Organization: Stephan Stapel
Project: BristolNG
 
Join Date: Oct 2003
Location: Essen, Germany
Posts: 169
Quote:
Originally posted by fw_csha

Maybe it is caused by the config file that does't have extended name.
Where could i find some instructions for writing the config file?
No, the extension is not the problem. The ice runtime takes any file that is passed to the executable through

executable.exe --Ice.Config=myfile.txt

However, your server app states "-p 222222" while the config says "-p 10000". Are you sure that this is the desired setting?

Maybe the client doesn't find the servant. Are you checking for null pointers and catching exceptions in the client?

regs,

Stephan
Reply With Quote
  #8 (permalink)  
Old 09-28-2004
bernard's Avatar
bernard bernard is online now
ZeroC Staff
 
Name: Bernard Normier
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Palm Beach Gardens, FL
Posts: 816
For this very simple application, you don't even need any configuration. Like Stephan suggested in his first post, the best would be to debug this problem in Visual Studio.

Also double-check that you build with /MDd and link with iced.lib and iceutild.lib. You also need to use the same version of Visual C++ to build Ice and to build your application.

Cheers,
Bernard
Reply With Quote
  #9 (permalink)  
Old 09-28-2004
Baloo Baloo is offline
Registered User
 
 
Join Date: Sep 2004
Location: Hungary (one joke and you're dead)
Posts: 5
I'm not sure if this is what you are looking for, but I had similar problems, so I'm gonna write down what I had to set in VS.NET 2003 (C++):

debug multithreaded dll (for debug)
multithreaded dll (for release)
RTTI enabled (C++/language)
linker: ice.lib/iceutil.lib (can be done with #pragma comment(lib, "<libname>")

I think that's all. If I remember correctly, in my case RTTI solved the errors you posted.

Hope that helps!


Baloo

p.s.: remember, these are for VS.NET 2003 + C++
Reply With Quote
  #10 (permalink)  
Old 09-28-2004
marc's Avatar
marc marc is offline
ZeroC Staff
 
Name: Marc Laukien
Organization: ZeroC, Inc.
Project: The Internet Communications Engine
 
Join Date: Feb 2003
Location: Florida
Posts: 1,781
You must use ice.lib and iceutil.lib for release only. Use iced.lib and iceutild.lib for debug.
Reply With Quote
  #11 (permalink)  
Old 09-29-2004
fw_csha fw_csha is offline
Registered User
 
 
Join Date: Sep 2004
Posts: 22
Quote:
Originally posted by Baloo
I'm not sure if this is what you are looking for, but I had similar problems, so I'm gonna write down what I had to set in VS.NET 2003 (C++):

debug multithreaded dll (for debug)
multithreaded dll (for release)
RTTI enabled (C++/language)
linker: ice.lib/iceutil.lib (can be done with #pragma comment(lib, "<libname>")

I think that's all. If I remember correctly, in my case RTTI solved the errors you posted.

Hope that helps!


Baloo

p.s.: remember, these are for VS.NET 2003 + C++


thanks so so so ~~~~~~ much!!!

"in my case RTTI solved the errors you posted."

so do i

Last edited by fw_csha : 09-29-2004 at 11:34 AM.
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
Runtime Exception Greenhippo Help Center 4 04-24-2007 03:28 PM
Change IP address during runtime wgwolf Help Center 1 05-31-2006 05:35 AM
Debug runtime errors Deqing Help Center 4 02-14-2006 07:19 PM
determine messagesize during runtime DeepDiver Help Center 3 01-26-2006 08:22 AM
"Filesystem demo" runtime error oops Help Center 3 09-25-2004 09:42 AM


All times are GMT -4. The time now is 10:51 AM.


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.