Results 1 to 2 of 2

Thread: StepScope in JndiObjectFactoryBean

  1. #1
    Join Date
    May 2010
    Posts
    7

    Default StepScope in JndiObjectFactoryBean

    Hello,
    I want to pass the Name of the InputQueue as a JobParameter to the Job.

    When I declare this:

    Code:
    <bean id="inputQueue" class="org.springframework.jndi.JndiObjectFactoryBean" scope="step">
       <property name="lookupOnStartup" value="false"/>
       <property name="proxyInterface" value="javax.jms.Queue"/>
      <property name="jndiName" value="#{jobParameters['input.queue']}"/>
    </bean>
    I get this Exception:

    Code:
    Caused by: java.lang.IllegalStateException: Cannot create scoped proxy for bean 'scopedTarget.inputQueue': Target type could not be determined at the time of proxy creation.
    	at org.springframework.aop.scope.ScopedProxyFactoryBean.setBeanFactory(ScopedProxyFactoryBean.java:94)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeAwareMethods(AbstractAutowireCapableBeanFactory.java:1439)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1408)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
    	... 94 more
    Is it really not possible? Does anybody have another idea to solve this requirement?

    Thanks
    Dennis

  2. #2
    Join Date
    Jun 2005
    Posts
    4,230

    Default

    Generally speaking the approach to this kind of issue with Spring JMS is to provide a DestinationResolver. You could do that, or you could write a custom FactoryBean, wrapping the one you are using now, but which reports the correct concrete type of its product (JndiObjectFactoryBean only knows how to report that it can create Object).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •