[ 
https://issues.apache.org/jira/browse/KARAF-2095?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Antoni Mylka updated KARAF-2095:
--------------------------------

    Attachment: jndibugtest.zip

I've been able to reproduce the same error with a much smaller example 
(attached). 

As far as I understand it's a bug in the standard "jndi" feature of Karaf. When 
it's installed - the OSGI environment contains a Service with the 
javax.naming.spi.ObjectFactory interface and the 
com.sun.jndi.url.rmi.rmiURLContextFactory implementation class.

When I want to lookup an RMI object via JNDI, the control gets through a number 
of methods into the Aries' 
ObjectFactoryHelper.getObjectInstanceUsingObjectFactories. The 
ObjectFactoryHelper gets a list of javax.naming.spi.ObjectFactory services from 
the OSGI environment and tries to pass the object to all of them. The problem 
is that by the time the control gets to that method, the object is not a 
string, but a RMIServerImpl_Stub. When it's passed to the rmiURLContextFactory 
- the error occurs, because the rmiURLContextFactory expects a String or an 
array of strings.

Karaf 2.3 (and 3.0) contain a solution for ARIES-823 - about coping with 
ObjectFactories that expect only a Reference. This particular object factory 
expects a String, so it seems to be an even worse case of a "badly written 
ObjectFactory".

I don't know much about Karaf or JNDI but AFAICS either the 
rmiURLContextFactory should NOT be registered as an OSGI service or some 
specific hack, similar to ARIES-823 should be applied in Aries.

The attachment contains a simple maven module with two pax exam tests. Both 
contain a JNDI lookup. One is successfull, one fails. The only difference 
between them is that one installs the "jndi" feature, one doesn't.
                
> Camel Route (JMS Polling) not working when installing feature "jndi"
> --------------------------------------------------------------------
>
>                 Key: KARAF-2095
>                 URL: https://issues.apache.org/jira/browse/KARAF-2095
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-core
>    Affects Versions: 2.2.9
>         Environment: Windows/Linux
>            Reporter: Shrish Srivastava
>         Attachments: jndibugtest.zip, karaf.log, wls_jmspolling.zip
>
>
> We have a route which polls on a weblogic jms queue.If we do not have 
> "feature jndi" installed, the route work fine.On installing jndi feature,it 
> work fine if we do not restart the container. On restarting the container it 
> throws following exception.
> ---------------------------------------------------------------------------
> 013-01-02 16:06:22,723 | WARN  |  JmsConsumer[IN] | 
> faultJmsMessageListenerContainer | 101 - org.springframework.jms - 
> 3.0.7.RELEASE | Could not refresh JMS Connection for destination 'IN' - 
> retrying in 5000 ms. Cause: JndiObjectTargetSource failed to obtain new 
> target object; nested exception is javax.naming.ConfigurationException: 
> rmiURLContextFactory.getObjectInstance: argument must be an RMI URL String or 
> an array of them
> org.springframework.jndi.JndiLookupFailureException: JndiObjectTargetSource 
> failed to obtain new target object; nested exception is 
> javax.naming.ConfigurationException: rmiURLContextFactory.getObjectInstance: 
> argument must be an RMI URL String or an array of them
> ----------------------------------------------------------------------------
> I enclosed the following files:
>  1)log file for my test(karaf.log)
>  2)Test project as attachment(wls_jmspolling.zip)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to