hi,
<br />
I have the replaced receive operations with browse operations in the JmsMessageBrowser like this:
<br />
<code>
<br />
@Override
<br />
protected MuleMessage doRequest(long timeout) throws Exception {
<br />
Session session=null;
<br />
QueueBrowser browser=null;
<br />
boolean cleanupListenerRegistered=false;
<br />
try{
<br />
final boolean topic = connector.getTopicResolver().isTopic(endpoint);
<br />
JmsSupport support = connector.getJmsSupport();
<br />
final TransactionConfig transactionConfig = endpoint.getTransactionConfig();
<br />
final Transaction tx = TransactionCoordination.getInstance().getTransaction();
<br />
boolean transacted = transactionConfig !=null && transactionConfig.isTransacted();
<br />
session=connector.getSession(transacted, topic);
<br />
if(transacted && !tx.isXA()){
<br />
final Session finalSession=session;
<br />
getConnector().getMuleContext().registerListener(new TransactionNotificationListener<TransactionNotification>() {
<br />
public void onNotification(TransactionNotification txNotification){
<br />
final int txAction = txNotification.getAction();
<br />
final String txId=txNotification.getTransactionStringId();
<br />
if((txAction==TransactionNotification.TRANSACTION_COMMITTED
<br />
|| txAction==TransactionNotification.TRANSACTION_ROLLEDBACK)
<br />
&& txId.equals(tx.getId())){
<br />
connector.closeQuietly(finalSession);
<br />
}
<br />
}
<br /><br />
},tx.getId());
<br />
cleanupListenerRegistered=true;
<br />
}
<br /><br />
Destination dest=support.createDestination(session,endpoint);
<br />
//Extract jms selector
<br />
String selector = null;
<br />
JmsSelectorFilter selectorFilter = connector.getSelector(endpoint);
<br />
if (selectorFilter != null)
<br />
{
<br />
final String expressionTemplate = selectorFilter.getExpression();
<br />
if (StringUtils.isNotBlank(expressionTemplate))
<br />
{
<br />
selector = connector.getMuleContext().getExpressionManager().parse(expressionTemplate, null);
<br />
}
<br />
}
<br />
else if (endpoint.getProperties() != null)
<br />
{
<br />
// still allow the selector to be set as a property on the endpoint
<br />
// to be backward compatable
<br />
final String expressionTemplate = (String) endpoint.getProperty(JmsConstants.JMS_SELECTOR_PROPERTY);
<br />
if (StringUtils.isNotBlank(expressionTemplate))
<br />
{
<br />
selector = connector.getMuleContext().getExpressionManager().parse(expressionTemplate, null);
<br />
}
<br />
}
<br />
String tempDurable = (String) endpoint.getProperties().get(JmsConstants.DURABLE_PROPERTY);
<br />
boolean durable = connector.isDurable();
<br />
if (tempDurable != null)
<br />
{
<br />
durable = Boolean.valueOf(tempDurable);
<br />
}
<br /><br />
// Get the durable subscriber name if there is one
<br />
String durableName = (String) endpoint.getProperties().get(JmsConstants.DURABLE_NAME_PROPERTY);
<br />
if (durableName == null && durable && topic)
<br />
{
<br />
durableName = "mule." + connector.getName() + "." + endpoint.getEndpointURI().getAddress();
<br />
if (logger.isDebugEnabled())
<br />
{
<br />
logger.debug("Jms Connector for this receiver is durable but no durable name has been specified. Defaulting to: "
<br />
+ durableName);
<br />
}
<br />
}
<br /><br />
// create browser
<br />
Queue q=(Queue)support.createDestination(session, endpoint);
<br />
browser=session.createBrowser(q);
<br />
// browse message
<br />
@SuppressWarnings("rawtypes")
<br />
Enumeration e = browser.getEnumeration();
<br />
if (null != e) {
<br />
while (e.hasMoreElements()) {
<br />
Message message = (Message)e.nextElement();
<br />
return createMuleMessage(message, endpoint.getEncoding());
<br /><br />
}
<br />
}
<br />
return null;
<br />
}finally{
<br />
if(!cleanupListenerRegistered){
<br />
connector.closeSessionIfNoTransactionActive(session);
<br />
}
<br />
}
<br />
}
<br />
</code>
<br />
and the JmsMessageBrowserFactory is :
<br />
<code>
<br />
public class JmsMessageBrowserFactory extends AbstractMessageBrowserFactory{
<br />
public MessageBrowser create(InboundEndpoint endpoint) throws MuleException{
<br />
return new JmsMessageBrowser(endpoint);
<br />
}
<br /><br />
}
<br />
</code>
<br /><br />
and the config i have :
<br />
<code>
<br />
<jms:connector name="OracleAQConnector" username="**" password="**" connectionFactory-ref="connFactory" doc:name="JMS">
<br />
<spring:property name="requesterFactory">
<br />
<spring:bean class="JmsMessageBrowserFactory" />
<br />
</spring:property>
<br />
</jms:connector>
<br />
</code>
<br /><br />
and the error I receive is a type cast error :
<br />
<code>
<br />
WARN 2012-06-18 15:02:07,421 [main] org.mule.config.spring.parsers.assembly.DefaultBeanAssembler: Cannot assign class org.mule.transport.jms.JmsConnector to interface org.mule.api.AnnotatedObject
<br />
WARN 2012-06-18 15:02:07,437 [main] org.mule.config.spring.parsers.assembly.DefaultBeanAssembler: Cannot assign class java.lang.Object to interface org.mule.api.AnnotatedObject
<br />
INFO 2012-06-18 15:02:08,890 [main] org.mule.lifecycle.AbstractLifecycleManager: Initialising model: _muleSystemModel
<br />
INFO 2012-06-18 15:02:09,031 [main] org.mule.lifecycle.AbstractLifecycleManager: Disposing model: _muleSystemModel
<br />
ERROR 2012-06-18 15:02:09,046 [main] org.mule.tooling.server.application.ApplicationDeployer: null
<br />
java.lang.IllegalStateException: Cannot convert value of type [JmsMessageBrowserFactory] to required type [org.mule.api.transport.MessageRequesterFactory] for property 'requesterFactory': no matching editors or conversion strategy found
<br />
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231)
<br />
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:447)
<br />
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:499)
<br />
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:493)
<br />
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1363)
<br />
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1322)
<br />
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1076)
<br />
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
<br />
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
<br />
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
<br />
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
<br />
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
<br />
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
<br />
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:574)
<br />
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
<br />
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
<br />
at org.mule.config.spring.SpringRegistry.doInitialise(SpringRegistry.java:89)
<br />
at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:109)
<br />
at org.mule.config.spring.SpringXmlConfigurationBuilder.createSpringRegistry(SpringXmlConfigurationBuilder.java:116)
<br />
at org.mule.config.spring.SpringXmlConfigurationBuilder.doConfigure(SpringXmlConfigurationBuilder.java:73)
<br />
at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:46)
<br />
at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78)
<br />
at org.mule.config.builders.AutoConfigurationBuilder.autoConfigure(AutoConfigurationBuilder.java:101)
<br />
at org.mule.config.builders.AutoConfigurationBuilder.doConfigure(AutoConfigurationBuilder.java:57)
<br />
at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:46)
<br />
at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78)
<br />
at org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:80)
<br />
at org.mule.module.launcher.application.DefaultMuleApplication.init(DefaultMuleApplication.java:203)
<br />
at org.mule.module.launcher.application.ApplicationWrapper.init(ApplicationWrapper.java:64)
<br />
at org.mule.tooling.server.application.ApplicationDeployer.main(ApplicationDeployer.java:45)
<br />
Exception in thread "main" org.mule.module.launcher.DeploymentInitException: IllegalStateException: Cannot convert value of type [JmsMessageBrowserFactory] to required type [org.mule.api.transport.MessageRequesterFactory] for property 'requesterFactory': no matching editors or conversion strategy found
<br />
at org.mule.module.launcher.application.DefaultMuleApplication.init(DefaultMuleApplication.java:215)
<br />
at org.mule.module.launcher.application.ApplicationWrapper.init(ApplicationWrapper.java:64)
<br />
at org.mule.tooling.server.application.ApplicationDeployer.main(ApplicationDeployer.java:45)
<br />
Caused by: org.mule.api.config.ConfigurationException: Error creating bean with name 'OracleAQConnector': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'JmsMessageBrowserFactory' to required type 'org.mule.api.transport.MessageRequesterFactory' for property 'requesterFactory'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [JmsMessageBrowserFactory] to required type [org.mule.api.transport.MessageRequesterFactory] for property 'requesterFactory': no matching editors or conversion strategy found (org.mule.api.lifecycle.InitialisationException) (org.mule.api.c
onfig.ConfigurationException)
<br />
at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:52)
<br />
at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78)
<br />
at org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:80)
<br />
at org.mule.module.launcher.application.DefaultMuleApplication.init(DefaultMuleApplication.java:203)
<br />
... 2 more
<br />
Caused by: org.mule.api.config.ConfigurationException: Error creating bean with name 'OracleAQConnector': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'JmsMessageBrowserFactory' to required type 'org.mule.api.transport.MessageRequesterFactory' for property 'requesterFactory'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [JmsMessageBrowserFactory] to required type [org.mule.api.transport.MessageRequesterFactory] for property 'requesterFactory': no matching editors or conversion strategy found (org.mule.api.lifecycle.InitialisationException)
<br />
at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:52)
<br />
at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78)
<br />
at org.mule.config.builders.AutoConfigurationBuilder.autoConfigure(AutoConfigurationBuilder.java:101)
<br />
at org.mule.config.builders.AutoConfigurationBuilder.doConfigure(AutoConfigurationBuilder.java:57)
<br />
at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:46)
<br />
... 5 more
<br />
Caused by: org.mule.api.lifecycle.InitialisationException: Error creating bean with name 'OracleAQConnector': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'JmsMessageBrowserFactory' to required type 'org.mule.api.transport.MessageRequesterFactory' for property 'requesterFactory'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [JmsMessageBrowserFactory] to required type [org.mule.api.transport.MessageRequesterFactory] for property 'requesterFactory': no matching editors or conversion strategy found
<br />
at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:117)
<br />
at org.mule.config.spring.SpringXmlConfigurationBuilder.createSpringRegistry(SpringXmlConfigurationBuilder.java:116)
<br />
at org.mule.config.spring.SpringXmlConfigurationBuilder.doConfigure(SpringXmlConfigurationBuilder.java:73)
<br />
at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:46)
<br />
... 9 more
<br />
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'OracleAQConnector': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'JmsMessageBrowserFactory' to required type 'org.mule.api.transport.MessageRequesterFactory' for property 'requesterFactory'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [JmsMessageBrowserFactory] to required type [org.mule.api.transport.MessageRequesterFactory] for property 'requesterFactory': no matching editors or conversion strategy found
<br />
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
<br />
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
<br />
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
<br />
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
<br />
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
<br />
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
<br />
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:574)
<br />
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
<br />
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
<br />
at org.mule.config.spring.SpringRegistry.doInitialise(SpringRegistry.java:89)
<br />
at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:109)
<br />
... 12 more
<br />
Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'JmsMessageBrowserFactory' to required type 'org.mule.api.transport.MessageRequesterFactory' for property 'requesterFactory'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [JmsMessageBrowserFactory] to required type [org.mule.api.transport.MessageRequesterFactory] for property 'requesterFactory': no matching editors or conversion strategy found
<br />
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:462)
<br />
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:499)
<br />
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:493)
<br />
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1363)
<br />
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1322)
<br />
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1076)
<br />
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
<br />
... 22 more
<br />
Caused by: java.lang.IllegalStateException: Cannot convert value of type [JmsMessageBrowserFactory] to required type [org.mule.api.transport.MessageRequesterFactory] for property 'requesterFactory': no matching editors or conversion strategy found
<br />
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231)
<br />
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:447)
<br />
... 28 more
<br /><br />
</code>
<br /><br />
ami i missing type casting somewhere ?
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email