cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Schneider <ch...@die-schneider.net>
Subject Re: cxf 3.0.1 don't let me configure local lookup of jms ConnectionFactory
Date Tue, 04 Nov 2014 21:51:41 GMT
You can use the ConnectionFactoryFeature to manually set a connection 
factory. You can find some examples here: 
http://cxf.apache.org/docs/soap-over-jms-10-support.html

Using java code it should be easy to do the lookup and spring allows to 
lookup the connection
factory from jndi too.

For the next version we could implement the changes you did if they have 
no side effects. Can you open a jira issue for this?

Best regards

Christian


Am 04.11.2014 21:51, schrieb atokle:
> I did earlier use cxf 2.4.3, and configured soap over jms using the
> JMSConfiguration style which is deprecated in cxf 3.0.
>
> Now I use the new SOAP / JMS spec compliant configuration - recommended
> style for CXF 3.
> I deploy my application on a weblogic server version 10.3.3.6, on a ExaLogic
> server.
>
> If the queue is located on a remote cluster, I use an URI like this:
> jms:jndi:jms.myapplication.queue?jndiInitialContextFactory=weblogic.jndi.WLInitialContextFactory&jndiURL=t3://server1:8001,server2:8001,server2:8001&jndiConnectionFactoryName=weblogic.jms.XAConnectionFactory
>
> This works fine, but when connection to the queue from an application on the
> local cluster, I don't want to do a remote lookup. It's a more complicated
> configuration, and it's slower since the request have to leave the internal
> infiniband, and try the different servers on the cluster until it find one
> that is up.
> I tried this URI:
> jms:jndi:jms.myapplication.queue?jndiConnectionFactoryName=weblogic.jms.XAConnectionFactory
>
> But then I get this Exception:
> java.lang.IllegalArgumentException: connectionFactory may not be null
> 	at
> org.apache.cxf.transport.jms.JMSConfiguration.ensureProperlyConfigured(JMSConfiguration.java:97)
> ~[_wl_cls_gen.jar:3.0.1]
> 	at
> org.apache.cxf.transport.jms.JMSDestination.activate(JMSDestination.java:106)
> ~[cxf-rt-transports-jms-3.0.1.jar:3.0.1]
> 	at
> org.apache.cxf.transport.AbstractObservable.setMessageObserver(AbstractObservable.java:49)
> ~[cxf-core-3.0.1.jar:3.0.1]
> 	at
> org.apache.cxf.binding.AbstractBindingFactory.addListener(AbstractBindingFactory.java:96)
> ~[cxf-core-3.0.1.jar:3.0.1]
>
> I was able to make it work by changing two classes:
> org.apache.cxf.transport.jms.JMSConfigFactory.createFromEndpoint(....)
> Changed from:
>          if (endpoint.getJndiURL() != null) {
>              // Configure Connection Factory using jndi
>             
> jmsConfig.setJndiEnvironment(JMSConfigFactory.getInitialContextEnv(endpoint));
>             
> jmsConfig.setConnectionFactoryName(endpoint.getJndiConnectionFactoryName());
> Changed to:
>         
> jmsConfig.setConnectionFactoryName(endpoint.getJndiConnectionFactoryName());
>          if (endpoint.getJndiURL() != null) {
>              // Configure Connection Factory using jndi
>             
> jmsConfig.setJndiEnvironment(JMSConfigFactory.getInitialContextEnv(endpoint));
>
>
> org.apache.cxf.transport.jms.JMSFactory.getConnectionFactoryFromJndi(....)
> Changed from:
>          if (jmsConfig.getJndiEnvironment() == null ||
> jmsConfig.getConnectionFactoryName() == null) {
>              return null;
>          }
> Changed to:
>          if(jmsConfig.getConnectionFactoryName() == null){
>              LOG.error("ConnectionFactoryName is not specified.");
>              return null;
>          }
>          if (jmsConfig.getJndiEnvironment() == null) {
>              LOG.warn("JndiEnvironment is not specified. Trying local
> lookup");
>              try {
>                  Context ctx = new InitialContext();
>                  Object located =
> ctx.lookup(jmsConfig.getConnectionFactoryName());
>                  if (located == null) {
>                      throw new NameNotFoundException("JNDI object with [" +
> jmsConfig.getConnectionFactoryName() + "] not found");
>                  }
>                  return (ConnectionFactory) located;
>              } catch (NamingException e) {
>                  throw new RuntimeException(e);
>              }
>          }
>
> Have two questions:
> 1. Did I configure the URI wrong when trying to lookup from JNDI locally. If
> so, what is the correct syntax.
> 2. If there is no solution to look up CF from JNDI locally, can you please
> implement a fix that give the same functionality as the one with the code
> posted above.
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/cxf-3-0-1-don-t-let-me-configure-local-lookup-of-jms-ConnectionFactory-tp5750700.html
> Sent from the cxf-user mailing list archive at Nabble.com.


-- 
  
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
Talend Application Integration Division http://www.talend.com


Mime
View raw message