Atomikos Forum

Resource already register using JMS

Hi, i have JDBC and JMS resource

I register all AtomikosConnectionFactoryBean and AtomikosDataSourceBean in JDNI

In my J2EE application when i make a lookup and then
when I use AtomikosDataSourceBean.getConnection() it's all rigth instead when I use AtomikosConnectionFactoryBean.createConnection() it throws and NameAlreadyBoundException("resource with name '" + resourceName + "' already registered").

It work only if before JDNI bind I invoke
AtomikosConnectionFactoryBean.init(), this only with JMS factory.

Seeking source code I have notice that code of doInit() are very similar between AtomikosConnectionFactoryBean and AbstractDataSourceBean except these row

public synchronized void init() throws AtomikosSQLException
...
try {
  //initialize JNDI infrastructure for lookup
  getReference();
  ConnectionFactory cf = doInit();
  connectionPool = new ConnectionPool(cf, this);



} catch ( AtomikosSQLException e ) {
...


public synchronized void init() throws JMSException
...
try {
// ADD getReference(); as code above
  ConnectionFactory cf = doInit();
  connectionPool = new ConnectionPool(cf, this);

  IntraVmObjectRegistry.addResource ( getUniqueResourceName() , this ); // <- DELETE THIS ROW

} catch ( AtomikosJMSException e ) {
...
Nikolas Falco Send private email
Wednesday, February 11, 2009
 
 
Sorry for errors.
JDNI -> JNDI

Seeking source code .... -> Looking source code I have notice that init() method of AtomikosConnectionFactoryBean is similar to init() of AbstractDataSourceBean except these rows:
Nikolas Falco Send private email
Wednesday, February 11, 2009
 
 
Thanks - I created a case to look into this.

Guy
Guy Pardon Send private email
Wednesday, February 11, 2009
 
 
I'am happy of new 3.5.3 but has the same "bug"

the code of AtomikosConnectionFactoryBean.init() is changed but doesn't work :<
actual code is:

public synchronized void init() throws JMSException {
...
try {
  ConnectionFactory cf = doInit();
  connectionPool = new ConnectionPool(cf, this);

  getReference();
            
} catch ( AtomikosJMSException e ) {
...
}

as AbstractDataSourceBean, getReference() call must be performed before call doInit() as main message

public synchronized void init() throws JMSException {
...
try {
  //initialize JNDI infrastructure for lookup
  getReference();
  ConnectionFactory cf = doInit();
  connectionPool = new ConnectionPool(cf, this);
} catch ( AtomikosJMSException e ) {
...
}

also we go into exception

com.atomikos.jms.AtomikosJMSException: Cannot initialize AtomikosConnectionFactoryBean
    at com.atomikos.jms.AtomikosJMSException.throwAtomikosJMSException(AtomikosJMSException.java:29)
    at com.atomikos.jms.AtomikosConnectionFactoryBean.throwAtomikosJMSException(AtomikosConnectionFactoryBean.java:147)
    at com.atomikos.jms.AtomikosConnectionFactoryBean.init(AtomikosConnectionFactoryBean.java:318)
    at com.atomikos.jms.AtomikosConnectionFactoryBean.createConnection(AtomikosConnectionFactoryBean.java:554)
...
Caused by: javax.naming.NameAlreadyBoundException: resource with name 'jms/B_CFResource' already registered
    at com.atomikos.util.IntraVmObjectRegistry.addResource(IntraVmObjectRegistry.java:23)
    at com.atomikos.jms.AtomikosConnectionFactoryBean.init(AtomikosConnectionFactoryBean.java:310)
    ... 7 more
Nikolas Falco Send private email
Wednesday, March 11, 2009
 
 
Hi,

Thanks - we did add a test for the first problem and it does work now, so this must be a variant.

Anyway, I scheduled this for release 3.5.4 of TransactionsEssentials.

HTH
Guy Pardon Send private email
Wednesday, March 11, 2009
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics