PDA

View Full Version : Remoting - getting error and getting mad...



rolandz
03-28-2008, 11:48 AM
Hi,

I am trying to perform some expepriment related to my current task. Thus I've created a trivial environment which, unfortunatelly, does not work. It consists of a service host that exposes service via remoting and a service client that uses a service.

However I am getting following error:



ServiceClient: FATAL ServiceClient - Fatal error occured in service client application
System.NullReferenceException: Object reference not set to an instance of an object.

Server stack trace:
at SaoRemoteObjectProxy_9020e64d54264553b85415f1001c7 80c.HelloWorld()
at System.Runtime.Remoting.Messaging.StackBuilderSink ._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink .PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink .SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleRe turnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateI nvoke(MessageData& msgData, Int32 type)
at Service.IHelloWorldService.HelloWorld()
at Service.Program.Main() in L:\Lithium.pl\Examples\AopLoggingExample\AopLoggin gExample\Program.cs:line 44

Attachet whole test solution...

TIA

rolandz
03-28-2008, 12:49 PM
I've discoverred that if the context is configuraed in the app.config file in the xml context configuration section and then I access it via ContextRegistry then remoting works fine.


What is the difference between manually created XmlApplicationContext instance and context registerred in the registry? Does this mean that the XmlApplicationContext instance gets disposed immediatelly and service stops?

It is strange beacuse if I added a line reading a key from input and after that the line accessing context what should prevent it from being disposed too fast I was getting the same error. With context registry problem disappears...

Bruno Baia
04-06-2008, 09:32 PM
Hi,

This is not related to XmlApplicationContext being disposed, but because Spring remoting proxies uses explicitly ContextRegistry.GetContext().
Calling RegistryContext.RegisterContext method with your XmlApplicationContext should resolve it too.

I've created an issue on JIRA about that :
http://jira.springframework.org/browse/SPRNET-923

- Bruno