[JBoss JIRA] Created: (JBESB-1851) JAXRConnectionFactory should not rely on System properties when creating a Connection
by Daniel Bevenius (JIRA)
JAXRConnectionFactory should not rely on System properties when creating a Connection
-------------------------------------------------------------------------------------
Key: JBESB-1851
URL: http://jira.jboss.com/jira/browse/JBESB-1851
Project: JBoss ESB
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: Examples, Registry and Repository
Reporter: Daniel Bevenius
The quickstarts that use the ServiceInvoker all seem to do this (atleast the ones that I've looked at) :
System.setProperty("javax.xml.registry.ConnectionFactoryClass","org.apache.ws.scout.registry.ConnectionFactoryImpl");
Now, we have this property in the jbossesb-properties.xml as:
<property name="org.jboss.soa.esb.registry.factoryClass" value="org.apache.ws.scout.registry.ConnectionFactoryImpl"/>
This property is read by JAXRConnectionFactory constructor and saved into a Properties object as:
props.setProperty("javax.xml.registry.factoryClass", Configuration.getRegistryFactoryClass());
The 'props' are set on the ConnectionFactory object that is created in the getConnection() method:
protected Connection getConnection()
{
Connection connection = null;
try
{ // Create the connection, passing it the configuration properties
ConnectionFactory factory = ConnectionFactory.newInstance();
factory.setProperties(props);
connection = factory.createConnection();
connection.setCredentials(creds);
} catch (JAXRException e) {
logger.log(Level.ERROR, "Could not set up a connection to the Registry. " + e.getMessage(), e);
}
return connection;
}
Here we can see that ConnectionFactory.newInstance() method will be called prior to the properties getting set on the factory, which is
natural. But the problem is that ConnectionFactory.newInstance() method looks like this:
private static final String SYS_PROP_NAME = "javax.xml.registry.ConnectionFactoryClass";
public static ConnectionFactory newInstance() throws JAXRException
{
String factoryName = null;
ConnectionFactory factory = null;
try
{
String defaultName = null;
factoryName = System.getProperty(SYS_PROP_NAME, defaultName);
ClassLoader loader =Thread.currentThread().getContextClassLoader();
Class factoryClass = loader.loadClass(factoryName);
factory = (ConnectionFactory) factoryClass.newInstance();
}
catch(Throwable e)
{
throw new JAXRException("Failed to create instance of:"+factoryName, e);
}
return factory;
}
We should not be relying on the system properties in order to do this.
Our JAXRConnectionFactory should be creating the factory directly and
not using ConnectionFactory, this is the real error IMO. If we do this
then we will not be affected by anyone else in the AS overriding JAXR.
Kev
See also this googlegroups thread for more background info: http://groups.google.se/group/jbossesb/browse_frm/thread/3a5ce28b4a0f6bca
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 10 months
[JBoss JIRA] Created: (JBESB-3204) JBESB 4.7 and IBM MQ 6.0 - topics accessed via a jms-jca-provider fail to deploy - java.lang.ClassCastException raised
by Len DiMaggio (JIRA)
JBESB 4.7 and IBM MQ 6.0 - topics accessed via a jms-jca-provider fail to deploy - java.lang.ClassCastException raised
----------------------------------------------------------------------------------------------------------------------
Key: JBESB-3204
URL: https://jira.jboss.org/jira/browse/JBESB-3204
Project: JBoss ESB
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: Rosetta
Affects Versions: 4.7
Environment: 4.7 GA, IBM MQ 6.0.2, RHEL5, Java 1.6
Reporter: Len DiMaggio
See the attached quickstart - helloworld modified to use IBM MQ.
With this jms-jca-provider definition:
<jms-jca-provider
name="JBossMQ"
jndi-URL="dev75.mw.lab.eng.bos.redhat.com:1414/SYSTEM.DEF.SVRCONN"
jndi-context-factory="com.ibm.mq.jms.context.WMQInitialContextFactory"
connection-factory="ConnectionFactory"
providerAdapterJNDI="java:/WSMQProvider" >
<jms-bus busid="ibmGwChannel">
<jms-message-filter
dest-type="TOPIC"
dest-name="ACTION_TOPIC"
/>
</jms-bus>
This exception is raised when the quickstart is deployed:
10:58:01,512 WARN [JmsActivation] Failure in jms activation org.jboss.resource.adapter.jms.inflow.JmsActivationSpec@89c1ee(ra=org.jboss.resource.adapter.jms.JmsResourceAdapter(a)884c0e destination=ACTION_TOPIC isTopic=true tx=true durable=false reconnect=10 provider=java:/WSMQProvider user=null maxMessages=1 minSession=1 maxSession=1 keepAlive=60000 useDLQ=true DLQHandler=org.jboss.resource.adapter.jms.inflow.dlq.GenericDLQHandler DLQJndiName=queue/DLQ DLQUser=null DLQMaxResent=5)
java.lang.ClassCastException: Object at 'ACTION_TOPIC' in context {java.naming.factory.initial=com.ibm.mq.jms.context.WMQInitialContextFactory, java.naming.provider.url=dev75.qa.atl.jboss.com:1414/SYSTEM.DEF.SVRCONN, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces:org.jboss.naming:org.jnp.interfaces} is not an instance of [class=javax.jms.Topic classloader=org.jboss.mx.loading.UnifiedClassLoader3@17f409c{ url=null ,addedOrder=2} interfaces={interface=javax.jms.Destination classloader=org.jboss.mx.loading.UnifiedClassLoader3@17f409c{ url=null ,addedOrder=2}}] object class is [class=com.ibm.mq.jms.MQQueue classloader=org.jboss.mx.loading.UnifiedClassLoader3@17f409c{ url=null ,addedOrder=2} interfaces={interface=javax.jms.Queue classloader=org.jboss.mx.loading.UnifiedClassLoader3@17f409c{ url=null ,addedOrder=2}, interface=javax.naming.Referenceable classloader=null, interface=java.io.Serializable classloader=null}]
at org.jboss.util.naming.Util.checkObject(Util.java:329)
at org.jboss.util.naming.Util.lookup(Util.java:216)
at org.jboss.resource.adapter.jms.inflow.JmsActivation.setupDestination(JmsActivation.java:409)
at org.jboss.resource.adapter.jms.inflow.JmsActivation.setup(JmsActivation.java:316)
at org.jboss.resource.adapter.jms.inflow.JmsActivation$SetupActivation.run(JmsActivation.java:635)
at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:204)
at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:275)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:756)
at java.lang.Thread.run(Thread.java:619)
The exception is not seen if a jms-provider is used.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 10 months