Issue while Remote Connection to Hornet queue from Switchyard .
ravi21588 May 25, 2016 1:42 PMHi All,
I need to connect to a remote Hornet Queue in different server.
I have the following configuratiuon.
package com.example.switchyard.switchyard_example_MQ_Test2;
import java.util.Properties;
import javax.enterprise.inject.Produces;
import javax.inject.Named;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.resource.cci.ConnectionFactory;
public class namedRemoteConnectionFactory {
public namedRemoteConnectionFactory() {
// TODO Auto-generated constructor stub
}
@Produces @Named("namedRemoteConnectionFactory")
public ConnectionFactory create() {
try {
final Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
env.put(Context.PROVIDER_URL, "remote://127.0.0.1:5445");
env.put(Context.SECURITY_PRINCIPAL, "hornetquser1");
env.put(Context.SECURITY_CREDENTIALS, "hornetqpwd.1");
InitialContext ic = new InitialContext(env);
return (ConnectionFactory) ic.lookup("java:jboss/exported/jms/RemoteConnectionFactory");
}
catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
Switchyard XML:
<sca:service name="ESBService" promote="Component/ESBService">
<sy:interface.esb inputType="java.lang.String"/>
<jms:binding.jms name="jms1">
<jms:queue>SampleClusterQ</jms:queue>
<jms:connectionFactory>#namedRemoteConnectionFactory</jms:connectionFactory>
</jms:binding.jms>
</sca:service>
Iam getting error while doing deployment attached error logs and standlone-full-ha config xml.
Caused by: org.jboss.weld.exceptions.IllegalArgumentException: WELD-001305 The given type interface javax.jms.ConnectionFactory is not a type of the bean Producer Method [ConnectionFactory] with qualifiers [@Any @Default @Named] declared as [[method] @Produces @Named public com.example.switchyard.switchyard_example_MQ_Test2.namedRemoteConnectionFactory.create()]
at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:633)
at org.apache.deltaspike.core.api.provider.BeanProvider.getContextualReference(BeanProvider.java:391)
at org.apache.deltaspike.core.api.provider.BeanProvider.getContextualReference(BeanProvider.java:200)
at org.apache.camel.component.cdi.CdiBeanRegistry.lookup(CdiBeanRegistry.java:51)
at org.apache.camel.impl.CompositeRegistry.lookup(CompositeRegistry.java:51)
... 34 more
-
standalone-full-ha.xml.zip 7.4 KB
-
ErrorLog.txt.zip 1.6 KB