[jacorb-developer] PortableInterceptor and ServantLocator Together Cause Exception

Nick Cross jacorb at goots.org
Thu Jun 28 16:05:40 CEST 2012


This looks like a rather subtle interaction. As your code does a narrow 
before returning the base object this results in an is_a which results 
in a servant_to_reference e.g.
	at org.jacorb.poa.POA.getReference(POA.java:1294)
	at org.jacorb.poa.POA.servant_to_reference(POA.java:2020)
	at org.jacorb.orb.ServantDelegate.this_object(ServantDelegate.java:99)
	at org.omg.PortableServer.Servant._this_object(Servant.java:11)
	at org.omg.PortableServer.Servant._this_object(Servant.java:22)
	at org.jacorb.orb.Delegate.servant_preinvoke(Delegate.java:2587)
	at org.jacorb.orb.Delegate.is_a(Delegate.java:1789)
	at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:53)
	at demo.hello.BaseHelper.narrow(BaseHelper.java:59)

The problem is, inside the servantdelegate the servants (GoodDay versus 
DayFactory ) don't match and therefore it has to resort to using the 
default POA (which defaults to the root poa in the code). This could be 
avoided if an unchecked_narrow was used before returning the basehelper.

Cheers

Nick


On 27/06/12 21:41, McKnerney, Michael D (US SSA) wrote:
> Hi Nick,
>
> I turned on jacorb info-level logging and I see output about a transient POA being used which is strange ?
>
> I.e.
> <snip>
>
> tid=RequestProcessor-5,receive_request_service_contexts getDay
> tid=RequestProcessor-5,ServantLocator.preinvoke, operation=getDay; strOid=IDL:demo/hello/DayFactory:1.0
> INFO | AOM.java                 :176  | 2012-06-27 18:28:51,051 | AOM                      | add                      | tid:RequestProcessor-5 | oid: 00 02 3D 4A 2E 11 4
> B 49 0F 30 10 06 30 46 38 14 14 1B 48 4C ..=J..KI.0..0F8...HL1B                                                          .object is activated
> INFO | POA.java                 :1271 | 2012-06-27 18:28:51,051 | POA                      | getImplName              | tid:RequestProcessor-5 | Using server ID (4175497
> 725) for transient POA
> ** returning servant **
>
> <snip>
>
> Can you verify that you see the same output ?
>
> Btw- I changed POA.java to print the poa name and this is what I get when I rerun it:
>
> tid=RequestProcessor-5,ServantLocator.preinvoke, operation=getDay; strOid=IDL:demo/hello/DayFactory:1.0
> INFO | AOM.java                 :176  | 2012-06-27 20:31:37,596 | AOM                      | add                      | tid:RequestProcessor-5 | oid: 00 02 3F 30 3F 2D 4
> C 15 0A 25 10 06 30 46 38 14 14 1B 48 4C ..?0?-L..%..0F8...HL1B                                                          .object is activated
> INFO | POA.java                 :1271 | 2012-06-27 20:31:37,596 | POA                      | getImplName              | tid:RequestProcessor-5 | Using server ID (8752004
> 331) for transient POA=RootPOA
>
> Note "RootPOA"  ?
>
> Clearly the DayFactory servant is hosted by the simple_persistent poa so not sure what's up ?
>
> thanks again,
> mike
>
>
> -----Original Message-----
> From: Nick Cross [mailto:nick at goots.org]
> Sent: Wednesday, June 27, 2012 12:48 AM
> To: McKnerney, Michael D (US SSA)
> Subject: Re: [jacorb-developer] PortableInterceptor and ServantLocator Together Cause Exception
>
>
> Hi Mike,
>
> Something like:
>
>        servant._this_object (orb);
>
> Your test works fine for me then. By the way - thanks for providing it
> in such a nice form complete with command line - makes it so much easier
> to take a look and run it ;-)
>
> Cheers
>
> Nick
>
>
> On 27/06/12 06:28, Nick Cross wrote:
>>
>> Hi,
>>
>> I've had a very brief look at your source and shouldn't you be
>> associating your servant with an ORB in your preinvoke method in your
>> servantlocatorimpl?
>>
>> Regards
>>
>> Nick
>>
>>
>>
>>
>> On 26/06/12 22:45, McKnerney, Michael D (US SSA) wrote:
>>> Hi Nick
>>>
>>> Here's the hello2.jar and it does contain the source.
>>>
>>> Unjar it in your jacorb demo dir under a new dir called "hello2" and
>>> you should be good to build and run
>>>
>>> I.e.
>>>
>>>> cd $JACORB_HOME/demo
>>>> mkdir hello2
>>>> cd hello2
>>>> cp ~/hello2.jar .
>>>> jar xvf hello2.jar
>>> META-INF/
>>> META-INF/MANIFEST.MF
>>> src/
>>> src/demo/
>>> src/demo/hello/
>>> src/demo/hello/Server.java
>>> src/demo/hello/ServantLocatorImpl.java
>>> src/demo/hello/DayFactoryImpl.java
>>> src/demo/hello/MyInitializer.java
>>> src/demo/hello/GoodDayImpl.java
>>> src/demo/hello/Client.java
>>> src/demo/hello/MyInterceptor.java
>>> src/.project
>>> src/.classpath
>>> idl/
>>> idl/server.idl
>>> README
>>> build.xml
>>>
>>>> ant compile
>>>
>>>
>>> -mike
>>>
>>> -----Original Message-----
>>> From: Nick Cross [mailto:jacorb at goots.org]
>>> Sent: Tuesday, June 26, 2012 2:35 PM
>>> To: McKnerney, Michael D (US SSA)
>>> Subject: Re: [jacorb-developer] PortableInterceptor and ServantLocator
>>> Together Cause Exception
>>>
>>>
>>>
>>> Hi Mike,
>>>
>>> Attachments are stripped from the list - could you send it to me
>>> privately? Could you also supply the source code with the jar file.
>>>
>>> Thanks!
>>>
>>> Nick
>>>
>>>
>>> On 26/06/12 21:42, McKnerney, Michael D (US SSA) wrote:
>>>> Hi Nick,
>>>>
>>>> Yes, the servant meets the activation condition via this case from
>>>> page 95:
>>>>
>>>> "By returning a Servant instance from a ServantManager. The Servant
>>>> returned from PortableServer::ServantActivator::incarnate() or
>>>> PortableServer::ServantLocator::preinvoke() will be associated with
>>>> the ORB instance that contains the POA on which the ServantManager is
>>>> installed."
>>>>
>>>> See attached hello2.jar that demonstrates the issue.
>>>>
>>>> Btw- I run the demo like this:
>>>>
>>>> # server
>>>> /jacorb-3.0/demo/hello2/build/classes> jaco -cp
>>>> ./:${JACORB_HOME}:${JACORB_HOME}/lib/jacorb.jar:
>>>> ${JACORB_HOME}/lib/jacorb-services.jar:${JACORB_HOME}/lib/idl.jar
>>>> -Dorg.omg.PortableInterceptor.ORBInitializerClass.demo.hello.MyInitializer
>>>> -Djacorb.implname=hello -DOAAddress=iiop://:16250 demo.hello.Server
>>>> GoodDay.ior
>>>>
>>>> #client
>>>> /jacorb-3.0/demo/hello2/build/classes> jaco -cp ./:
>>>> ./:${JACORB_HOME}:${JACORB_HOME}/lib/jacorb.jar:
>>>> ${JACORB_HOME}/lib/jacorb-services.jar:${JACORB_HOME}/lib/idl.jar
>>>> demo.hello.Client GoodDay.ior
>>>>
>>>> The server output shows the same error:
>>>>
>>>> Jun 26, 2012 8:23:02 PM org.jacorb.orb.ORBSingleton<init>
>>>> INFO: created ORBSingleton
>>>> -- pre_init, orb_id=jacorb:3.0--
>>>> Jun 26, 2012 8:23:02 PM org.jacorb.orb.giop.CodeSet getTCSDefault
>>>> WARNING: Warning - unknown codeset (ASCII) - defaulting to ISO-8859-1
>>>> -- post_init, orb_id=jacorb:3.0--
>>>> Jun 26, 2012 8:23:02 PM
>>>> org.jacorb.orb.portableInterceptor.InterceptorManager<init>
>>>> INFO: InterceptorManager started with 1 Server Interceptors, 1 Client
>>>> Interceptors and 1 IOR Interceptors
>>>> Creating GoodDayImpl
>>>> Registering strOid: IDL:demo/hello/GoodDay:1.0
>>>> Creating DayFactoryImpl
>>>> Registering strOid: IDL:demo/hello/DayFactory:1.0
>>>> poa_manager.activate
>>>> Jun 26, 2012 8:23:02 PM org.jacorb.orb.ORB run
>>>> INFO: ORB run
>>>> Jun 26, 2012 8:23:09 PM org.jacorb.orb.iiop.ServerIIOPConnection
>>>> configure
>>>> INFO: Opened new server-side TCP/IP transport to 10.35.225.150:41518
>>>> tid=RequestProcessor-5,receive_request_service_contexts getDay
>>>> tid=RequestProcessor-5,ServantLocator.preinvoke, operation=getDay;
>>>> strOid=IDL:demo/hello/DayFactory:1.0
>>>> ** returning servant **
>>>> tid=RequestProcessor-5,receive_request getDay
>>>> create_reference_with_id
>>>> getDay, calling BaseHelper.narrow
>>>> tid=RequestProcessor-5,send_request _is_a
>>>> tid=RequestProcessor-5,ServantLocator.preinvoke, operation=_is_a;
>>>> strOid=IDL:demo/hello/GoodDay:1.0
>>>> ** returning servant **
>>>> Jun 26, 2012 8:23:09 PM org.jacorb.orb.giop.ClientConnectionManager
>>>> getConnection
>>>> INFO: ClientConnectionManager: created new ClientGIOPConnection to
>>>> 10.35.225.150:16250 (b76fa)
>>>> Jun 26, 2012 8:23:09 PM org.jacorb.orb.Delegate servant_preinvoke
>>>> SEVERE: unexpected exception during servant_preinvoke
>>>> org.omg.CORBA.BAD_INV_ORDER: The Servant has not been associated with
>>>> an ORBinstance
>>>> at org.omg.PortableServer.Servant._get_delegate(Servant.java:111)
>>>> at org.omg.PortableServer.Servant._poa(Servant.java:30)
>>>> at
>>>> org.jacorb.orb.portableInterceptor.ServerRequestInfoImpl.setServant(ServerRequestInfoImpl.java:153)
>>>>
>>>> at
>>>> org.jacorb.orb.portableInterceptor.ServerRequestInfoImpl.<init>(ServerRequestInfoImpl.java:133)
>>>>
>>>> at org.jacorb.orb.Delegate.servant_preinvoke(Delegate.java:2644)
>>>> at org.jacorb.orb.Delegate.is_a(Delegate.java:1789)
>>>> at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:53)
>>>> at demo.hello.BaseHelper.narrow(BaseHelper.java:59)
>>>> at demo.hello.DayFactoryImpl.getDay(DayFactoryImpl.java:30)
>>>> at demo.hello.DayFactoryPOA._invoke(DayFactoryPOA.java:58)
>>>> at
>>>> org.jacorb.poa.RequestProcessor.invokeOperation(RequestProcessor.java:349)
>>>>
>>>> at org.jacorb.poa.RequestProcessor.process(RequestProcessor.java:671)
>>>> at org.jacorb.poa.RequestProcessor.run(RequestProcessor.java:821)
>>>> getDay, caught exception=org.omg.CORBA.BAD_INV_ORDER: The Servant has
>>>> not been associated with an ORBinstance
>>>> ServantLocator.postinvoke, operation=getDay
>>>> tid=RequestProcessor-5,send_reply getDay
>>>> Jun 26, 2012 8:23:09 PM org.jacorb.orb.iiop.ServerIIOPConnection close
>>>> INFO: Closed server-side transport to 10.35.225.150:41518
>>>>
>>>> Thanks for the help !
>>>>
>>>> take care,
>>>> mike
>>>>
>>>> -----Original Message-----
>>>> From: Nick Cross [mailto:jacorb at goots.org]
>>>> Sent: Tuesday, June 26, 2012 1:39 AM
>>>> To: Discussions concerning CORBA development with JacORB
>>>> Cc: McKnerney, Michael D (US SSA)
>>>> Subject: Re: [jacorb-developer] PortableInterceptor and
>>>> ServantLocator Together Cause Exception
>>>>
>>>>
>>>> Hi,
>>>>
>>>> That error is coming from OMG supplied stub code. Could you verify that
>>>> the conditions in the IDL to Java mapping 1.3 2008-01-11 , section
>>>> 4.21.3, page 94/95 have been satisfied e.g. was your Servant activated
>>>> via the POA? If it has, then supplying a sample standalone compilable
>>>> and runnable test case would be useful.
>>>>
>>>> Regards
>>>>
>>>> Nick
>>>>
>>>>
>>>> On 26/06/12 01:17, McKnerney, Michael D (US SSA) wrote:
>>>>> Hi,
>>>>>
>>>>> Is it a known issue when using ServantLocator together with
>>>>> PortableInterceptor that this exception is always raised?
>>>>>
>>>>> Jun 25, 2012 10:32:17 PM org.jacorb.orb.Delegate servant_preinvoke
>>>>> SEVERE: unexpected exception during servant_preinvoke
>>>>> org.omg.CORBA.BAD_INV_ORDER: The Servant has not been associated
>>>>> with an ORBinstance
>>>>> at org.omg.PortableServer.Servant._get_delegate(Servant.java:111)
>>>>> at org.omg.PortableServer.Servant._poa(Servant.java:30)
>>>>> at
>>>>> org.jacorb.orb.portableInterceptor.ServerRequestInfoImpl.setServant(ServerRequestInfoImpl.java:153)
>>>>>
>>>>> at
>>>>> org.jacorb.orb.portableInterceptor.ServerRequestInfoImpl.<init>(ServerRequestInfoImpl.java:133)
>>>>>
>>>>> at org.jacorb.orb.Delegate.servant_preinvoke(Delegate.java:2644)
>>>>> at org.jacorb.orb.Delegate.is_a(Delegate.java:1789)
>>>>> at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:53)
>>>>> at GIAS.LibraryManagerHelper.narrow(LibraryManagerHelper.java:59)
>>>>> at baex.gl.gateway.gias.LibraryImpl.get_manager(LibraryImpl.java:81)
>>>>>
>>>>> I can post code if need be but essentially what I have is a servant
>>>>> (LibraryImpl) that is in the process of processing a method
>>>>> (get_manager) and during the processing it invokes narrow() which is
>>>>> handled within the same thread as the get_manager().
>>>>>
>>>>> If I take out the portable interceptor, all works as expected so I
>>>>> figure this might be a known issue?
>>>>>
>>>>> Thanks,
>>>>> mike
>>>>> _______________________________________________
>>>>> jacorb-developer maillist -
>>>>> jacorb-developer at lists.spline.inf.fu-berlin.de
>>>>> https://lists.spline.inf.fu-berlin.de/mailman/listinfo/jacorb-developer
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> jacorb-developer maillist -
>>>> jacorb-developer at lists.spline.inf.fu-berlin.de
>>>> https://lists.spline.inf.fu-berlin.de/mailman/listinfo/jacorb-developer
>>>
>>
>
> _______________________________________________
> jacorb-developer maillist  -  jacorb-developer at lists.spline.inf.fu-berlin.de
> https://lists.spline.inf.fu-berlin.de/mailman/listinfo/jacorb-developer
>




More information about the jacorb-developer mailing list