Error using Blueprint xml to establish a Weblogic component with a JndiObjectFactoryBean

992 views Asked by At

So, I'm trying to get a Weblogic component to work in our application's blueprint file using the snippit below, though I'm not sure what else to include about it other than it being used to connect to a JMS queue.

> <bean id="wmqjndiFactoryBean"
> class="org.springframework.jndi.JndiObjectFactoryBean">
>         <property name="jndiName" value="jms/ConnectionFactory"/>
>         <property name="jndiTemplate">
>             <bean class="org.springframework.jndi.JndiTemplate">
>                 <property name="environment">
>                     <props>
>                         <prop key="java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory</prop>
>                         <prop key="java.naming.provider.url">t3://localhost</prop>
>                         <prop key="java.naming.security.principal">weblogic</prop>
>                         <prop key="java.naming.security.credentials">weblogic</prop>
>                     </props>
>                 </property>
>             </bean>
>         </property>
>         <property name="lookupOnStartup" value="false"/>
>         <property name="proxyInterface" value="javax.jms.ConnectionFactory"/>
>     </bean>
>     <bean id="weblogic-jms" class="org.apache.camel.component.jms.JmsComponent">
>         <property name="configuration">
>             <bean class="org.apache.camel.component.jms.JmsConfiguration">
>                 <property name="connectionFactory" ref="wmqjndiFactoryBean"/>
>             </bean>
>         </property>
>     </bean>

And this exception occurs:

    org.osgi.service.blueprint.container.ComponentDefinitionException: Error setting property: PropertyDescriptor <name: connectionFactory, getter: class org.apache.camel.component.jms.JmsConfiguration.getConnectionFactory(), setter: [class org.apache.camel.component.jms.JmsConfiguration.setConnectionFactory(interface javax.jms.ConnectionFactory)]
    at org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:941)
    at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:907)
    at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:888)
    at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:820)
    at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)
    at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:106)
    at org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:933)
    at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:907)
    at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:888)
    at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:820)
    at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)
    at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)
    at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:245)
    at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:183)
    at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:668)
    at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:370)
    at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:261)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at org.apache.aries.blueprint.container.ExecutorServiceWrapper.run(ExecutorServiceWrapper.java:106)
    at org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:48)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.Exception: Unable to convert value org.springframework.jndi.JndiObjectFactoryBean to type javax.jms.ConnectionFactory
    at org.apache.aries.blueprint.container.AggregateConverter.convert(AggregateConverter.java:184)
    at org.apache.aries.blueprint.container.BlueprintRepository.convert(BlueprintRepository.java:402)
    at org.apache.aries.blueprint.utils.ReflectionUtils$PropertyDescriptor.convert(ReflectionUtils.java:394)
    at org.apache.aries.blueprint.utils.ReflectionUtils$MethodPropertyDescriptor.internalSet(ReflectionUtils.java:628)
    at org.apache.aries.blueprint.utils.ReflectionUtils$PropertyDescriptor.set(ReflectionUtils.java:378)
    at org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:939)
    ... 29 more

And after scouring the internet for hours over the past couple days, I have not found a solution. I can't exactly tell you what it's not because it's hard to remember what I've already tried, but most of the articles/other questions I looked at weren't even applicable.

So why is this exception occurring and how can I fix it?

1

There are 1 answers

1
JeY On BEST ANSWER

Someone on our team finally figured out an answer. First, they changed the route a little bit:

    <bean id="jmsInConnectionFactoryJndiLookupFactory" class="org.springframework.jndi.JndiObjectFactoryBean" init-method="afterPropertiesSet">
            <property name="jndiName" value="jms/ConnectionFactory"/>
            <property name="jndiTemplate">
                <bean class="org.springframework.jndi.JndiTemplate">
                    <property name="environment">
                        <props>
                          <prop key="java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory</prop>
                          <prop key="java.naming.provider.url">t3://localhost</prop>
                          <prop key="java.naming.security.principal">weblogic</prop>
                          <prop key="java.naming.security.credentials">weblogic</prop>
                        </props>
                    </property>
                </bean>
            </property>
        </bean>
        <bean id="jmsInConnectionFactory" factory-ref="jmsInConnectionFactoryJndiLookupFactory" factory-method="getObject" />
        <bean id="weblogic-jms" class="org.apache.camel.component.jms.JmsComponent">
            <property name="configuration">
            <bean class="org.apache.camel.component.jms.JmsConfiguration">
                <property name="connectionFactory" ref="jmsInConnectionFactory"/>
            </bean>
            </property>
        </bean>

Second, they ran into another issue, which was solved here: https://issues.jboss.org/browse/ENTESB-1567

And then it was fixed, apparently! Hope that helps.