JNDI NameNotFoundException on BTM 1.3-RC2

classic Classic list List threaded Threaded
26 messages Options
12
Reply | Threaded
Open this post in threaded view
|

JNDI NameNotFoundException on BTM 1.3-RC2

danielmeyer
I'm trying out the JNDI lookup features of BTM 1.3-RC2 and I'm getting a NameNotFoundException.

The error

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'queueConnectionFactory' defined in class path resource [spring-beans-bitronix.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: JNDI object with [java:activemq/QueueConnectionFactory] not found: JNDI implementation returned null

What I had expected to happen

I expected my queueConnectionFactory JNDI-lookup bean to be able to find the "java:activemq/QueueConnectionFactory" name since I had set that up in the bitronix-default-config.properties file.

Files and Output

My Spring beans file:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">

	<bean id="btmConfig" factory-method="getConfiguration" class="bitronix.tm.TransactionManagerServices">
		<property name="serverId" value="spring-btm" />
	</bean>

	<bean id="BitronixTransactionManager" factory-method="getTransactionManager" class="bitronix.tm.TransactionManagerServices"
		destroy-method="shutdown" />

	<bean id="JtaTransactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
		<property name="transactionManager" ref="BitronixTransactionManager" />
		<property name="userTransaction" ref="BitronixTransactionManager" />
	</bean>

	<bean id="queueConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
		<property name="jndiName" value="java:activemq/QueueConnectionFactory" />
	</bean>
</beans>

My bitronix-default-config.properties file:

bitronix.tm.resource.bind = true

resource.mq1.className = org.activemq.ActiveMQXAConnectionFactory
resource.mq1.uniqueName = java:activemq/QueueConnectionFactory
resource.mq1.maxPoolSize = 2
resource.mq1.driverProperties.brokerURL = vm://localhost

Console output at INFO log level:

0    [main] INFO  org.springframework.context.support.ClassPathXmlApplicationContext  - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@480457: display name [org.springframework.context.support.ClassPathXmlApplicationContext@480457]; startup date [Fri Aug 15 08:51:33 EDT 2008]; root of context hierarchy
109  [main] INFO  org.springframework.beans.factory.xml.XmlBeanDefinitionReader  - Loading XML bean definitions from class path resource [spring-beans-bitronix.xml]
359  [main] INFO  org.springframework.context.support.ClassPathXmlApplicationContext  - Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext@480457]: org.springframework.beans.factory.support.DefaultListableBeanFactory@1630ab9
422  [main] INFO  org.springframework.beans.factory.support.DefaultListableBeanFactory  - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1630ab9: defining beans [btmConfig,BitronixTransactionManager,JtaTransactionManager,queueConnectionFactory]; root of factory hierarchy
Aug 15, 2008 8:51:34 AM bitronix.tm.BitronixTransactionManager logVersion
INFO: Bitronix Transaction Manager version 1.3-RC2
Aug 15, 2008 8:51:34 AM bitronix.tm.Configuration buildServerIdArray
INFO: JVM unique ID: 
Aug 15, 2008 8:51:34 AM bitronix.tm.recovery.Recoverer run
INFO: recovery committed 0 dangling transaction(s) and rolled back 0 aborted transaction(s) on 0 resource(s) []
687  [main] INFO  org.springframework.transaction.jta.JtaTransactionManager  - Using JTA UserTransaction: a BitronixTransactionManager with 0 in-flight transaction(s)
687  [main] INFO  org.springframework.transaction.jta.JtaTransactionManager  - Using JTA TransactionManager: a BitronixTransactionManager with 0 in-flight transaction(s)
734  [main] INFO  org.springframework.beans.factory.support.DefaultListableBeanFactory  - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1630ab9: defining beans [btmConfig,BitronixTransactionManager,JtaTransactionManager,queueConnectionFactory]; root of factory hierarchy
Aug 15, 2008 8:51:34 AM bitronix.tm.BitronixTransactionManager shutdown
INFO: shutting down Bitronix Transaction Manager

Notes

I didn't follow step 2 of the Spring Integration instructions, because instead I set up the datasource properties in the bitronix-default-config.properties file, following the ResourceLoader instructions on that point.

Can someone tell me if I am understanding the instructions wrong or what I should do so that the name I configure is available to be looked up?

Thanks!
-Daniel-

Reply | Threaded
Open this post in threaded view
|

Re: JNDI NameNotFoundException on BTM 1.3-RC2

danielmeyer
Forgot to mention, I also have a jndi.properties file with one line in it:

jndi.properties file

java.naming.factory.initial = bitronix.tm.jndi.BitronixInitialContextFactory
Reply | Threaded
Open this post in threaded view
|

Re: JNDI NameNotFoundException on BTM 1.3-RC2

Ludovic Orban
Administrator
In reply to this post by danielmeyer
Could you please include the complete stack trace of the BeanCreationException ? Without it I cannot say for sure what the problem is so I'm going to guess here.

There is nothing in BTM that makes it install its JNDI provider as the default context so you should set the JNDI environment on the JndiObjectFactoryBean:

<bean id="queueConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiName" value="java:activemq/QueueConnectionFactory" />
        <property name="jndiEnvironment">
                <props>
                        <prop key="java.naming.factory.initial">bitronix.tm.jndi.BitronixInitialContextFactory</prop>
                </props>
        </property>
</bean>

and I also wonder, since the lookup to the default context threw a NameNotFoundException, it looks like you already have a default context that might be configured to intercept lookups in the java: namespace.

I suggest you to drop the java: prefix of your resource's unique name as the JNDI provider of BTM isn't a full-blown one and that could cause complex lookup issues due to JNDI's architecture.

Ludovic
Reply | Threaded
Open this post in threaded view
|

Re: JNDI NameNotFoundException on BTM 1.3-RC2

danielmeyer
In reply to this post by danielmeyer
Another thing -- when I try to set the bitronix.tm.resource.configuration via the environment:
System.setProperty("bitronix.tm.resource.configuration", "bitronix-default-config.properties");
or via Spring:
	<bean id="btmConfig" factory-method="getConfiguration" class="bitronix.tm.TransactionManagerServices">
		<property name="serverId" value="spring-btm" />
		<property name="resourceConfigurationFilename" value="bitronix-default-config.properties" />
	</bean>
then I get a NullPointerException when the BitronixTransactionManager bean is initializing:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'BitronixTransactionManager' defined in class path resource [spring-beans-bitronix.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public static synchronized bitronix.tm.BitronixTransactionManager bitronix.tm.TransactionManagerServices.getTransactionManager()] threw exception; nested exception is java.lang.NullPointerException

Reply | Threaded
Open this post in threaded view
|

Re: JNDI NameNotFoundException on BTM 1.3-RC2

Ludovic Orban
Administrator
In reply to this post by danielmeyer
With that new information I suspect the java: namespace to be the cause. Try again without it.
Reply | Threaded
Open this post in threaded view
|

Re: JNDI NameNotFoundException on BTM 1.3-RC2

Ludovic Orban
Administrator
In reply to this post by danielmeyer
This looks like a regression introduced in the RC2 release that should hopefully be simple to fix. Again the full stack trace will help troubleshooting this issue, could you please post it ?

Thanks,
Ludovic
Reply | Threaded
Open this post in threaded view
|

Re: JNDI NameNotFoundException on BTM 1.3-RC2

danielmeyer
In reply to this post by Ludovic Orban
Ludovic Orban wrote
Could you please include the complete stack trace of the BeanCreationException ?
Here is the whole stack trace:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'queueConnectionFactory' defined in class path resource [spring-beans-bitronix.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: JNDI object with [QueueConnectionFactory] not found: JNDI implementation returned null
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1337)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
        at com.ontsys.dmn.JndiBitronixTest.TestBitronix(JndiBitronixTest.java:25)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
        at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
        at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
        at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
        at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
        at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
        at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
        at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
        at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
        at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
        at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
        at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
        at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
        at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: javax.naming.NameNotFoundException: JNDI object with [QueueConnectionFactory] not found: JNDI implementation returned null
        at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:157)
        at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:88)
        at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:153)
        at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)
        at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)
        at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105)
        at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:200)
        at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:186)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1368)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
        ... 37 more

Reply | Threaded
Open this post in threaded view
|

Re: JNDI NameNotFoundException on BTM 1.3-RC2

danielmeyer
In reply to this post by Ludovic Orban
Ludovic Orban wrote
With that new information I suspect the java: namespace to be the cause. Try again without it.
I have changed the JNDI name to just QueueConnectionFactory in my Spring bean file:
	<bean id="queueConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
		<property name="jndiName" value="QueueConnectionFactory" />
		<property name="jndiEnvironment">
			<props>
				<prop key="java.naming.factory.initial">bitronix.tm.jndi.BitronixInitialContextFactory</prop>
			</props>
		</property>
	</bean>
and in the bitronix-default-config.properties file:
bitronix.tm.resource.bind = true

resource.mq1.className = org.activemq.ActiveMQXAConnectionFactory
resource.mq1.uniqueName = QueueConnectionFactory
resource.mq1.maxPoolSize = 2
resource.mq1.driverProperties.brokerURL = vm://localhost
But I still get the same stack trace:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'queueConnectionFactory' defined in class path resource [spring-beans-bitronix.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: JNDI object with [QueueConnectionFactory] not found: JNDI implementation returned null at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1337) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381) at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139) at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:93) at com.ontsys.dmn.JndiBitronixTest.TestBitronix(JndiBitronixTest.java:25) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59) at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98) at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79) at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87) at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77) at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42) at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88) at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51) at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44) at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27) at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37) at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Caused by: javax.naming.NameNotFoundException: JNDI object with [QueueConnectionFactory] not found: JNDI implementation returned null at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:157) at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:88) at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:153) at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178) at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95) at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105) at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:200) at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:186) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1368) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334) ... 37 more

Reply | Threaded
Open this post in threaded view
|

Re: JNDI NameNotFoundException on BTM 1.3-RC2

danielmeyer
In reply to this post by Ludovic Orban
Ludovic Orban wrote
There is nothing in BTM that makes it install its JNDI provider as the default context so you should set the JNDI environment on the JndiObjectFactoryBean:

<bean id="queueConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiName" value="java:activemq/QueueConnectionFactory" />
        <property name="jndiEnvironment">
                <props>
                        <prop key="java.naming.factory.initial">bitronix.tm.jndi.BitronixInitialContextFactory</prop>
                </props>
        </property>
</bean>
I thought if I had a jndi.properties file that contained the line:
  java.naming.factory.initial = bitronix.tm.jndi.BitronixInitialContextFactory
then I should not also need to set the java.naming.factory.initial property on the JndiObjectFactoryBean... am I incorrect?

(This matters to me since the JndiObjectFactoryBean will be in the production code and we would like to not have to change it to test in an integration testing environment.)

-Daniel-
Reply | Threaded
Open this post in threaded view
|

Re: JNDI NameNotFoundException on BTM 1.3-RC2

Ludovic Orban
Administrator
That's correct. If you configure BTM's initial context factory in a jndi.properties file you don't need to set the initial context factory property on the JndiObjectFactoryBean.

I think I've found where the problem is. Since you're creating your connection pool via the resource loader, you have to make sure BTM's initialization happens before the JndiObjectFactoryBean tries to look up the object. The resource loader is triggered during BTM startup and only after the resource is created it is made available via JNDI.

Adding a depends-on attribute to your queueConnectionFactory bean definition should solve the issue:

<bean id="queueConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean" depends-on="BitronixTransactionManager"> 
    ...
</bean>

Ludovic
Reply | Threaded
Open this post in threaded view
|

Re: JNDI NameNotFoundException on BTM 1.3-RC2

danielmeyer
Ludovic Orban wrote
Adding a depends-on attribute to your queueConnectionFactory bean definition should solve the issue:

<bean id="queueConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean" depends-on="BitronixTransactionManager"> 
    ...
</bean>
Hmm - I added the depends-on attribute:
        <bean id="queueConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean" depends-on="BitronixTransactionManager">
                <property name="jndiName" value="QueueConnectionFactory" />
        </bean>

But I still get the NameNotFoundException:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'queueConnectionFactory' defined in class path resource [spring-beans-bitronix.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: JNDI object with [QueueConnectionFactory] not found: JNDI implementation returned null
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1337)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
        at com.ontsys.dmn.JndiBitronixTest.TestBitronix(JndiBitronixTest.java:25)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
        at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
        at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
        at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
        at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
        at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
        at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
        at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
        at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
        at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
        at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
        at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
        at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
        at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: javax.naming.NameNotFoundException: JNDI object with [QueueConnectionFactory] not found: JNDI implementation returned null
        at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:157)
        at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:88)
        at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:153)
        at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)
        at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)
        at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105)
        at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:200)
        at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:186)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1368)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
        ... 37 more


Reply | Threaded
Open this post in threaded view
|

Re: JNDI NameNotFoundException on BTM 1.3-RC2

Ludovic Orban
Administrator
Please set your logging level to DEBUG, reproduce the issue and post the log file here. I'll try to find out what is wrong from there.

Ludovic
Reply | Threaded
Open this post in threaded view
|

Re: JNDI NameNotFoundException on BTM 1.3-RC2

danielmeyer
Ludovic Orban wrote
Please set your logging level to DEBUG, reproduce the issue and post the log file here. I'll try to find out what is wrong from there.

Ludovic
Log file:
0    [main] INFO  org.springframework.context.support.ClassPathXmlApplicationContext  - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@480457: display name [org.springframework.context.support.ClassPathXmlApplicationContext@480457]; startup date [Fri Aug 15 11:04:01 EDT 2008]; root of context hierarchy
47   [main] DEBUG org.springframework.core.CollectionFactory  - Creating [java.util.concurrent.ConcurrentHashMap]
47   [main] DEBUG org.springframework.core.CollectionFactory  - Creating [java.util.concurrent.ConcurrentHashMap]
47   [main] DEBUG org.springframework.core.CollectionFactory  - Creating [java.util.concurrent.ConcurrentHashMap]
47   [main] DEBUG org.springframework.core.CollectionFactory  - Creating [java.util.concurrent.ConcurrentHashMap]
47   [main] DEBUG org.springframework.core.CollectionFactory  - Creating [java.util.concurrent.ConcurrentHashMap]
47   [main] DEBUG org.springframework.core.CollectionFactory  - Creating [java.util.concurrent.ConcurrentHashMap]
62   [main] DEBUG org.springframework.core.CollectionFactory  - Creating [java.util.concurrent.ConcurrentHashMap]
62   [main] DEBUG org.springframework.core.CollectionFactory  - Creating [java.util.concurrent.ConcurrentHashMap]
109  [main] INFO  org.springframework.beans.factory.xml.XmlBeanDefinitionReader  - Loading XML bean definitions from class path resource [spring-beans-bitronix.xml]
140  [main] DEBUG org.springframework.beans.factory.xml.DefaultDocumentLoader  - Using JAXP provider [com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl]
187  [main] DEBUG org.springframework.beans.factory.xml.PluggableSchemaResolver  - Trying to resolve XML entity with public id [null] and system id [http://www.springframework.org/schema/beans/spring-beans-2.5.xsd]
203  [main] DEBUG org.springframework.beans.factory.xml.PluggableSchemaResolver  - Loading schema mappings from [META-INF/spring.schemas]
203  [main] DEBUG org.springframework.beans.factory.xml.PluggableSchemaResolver  - Loaded schema mappings: {http://activemq.apache.org/schema/core=activemq.xsd, http://www.springframework.org/schema/lang/spring-lang.xsd=org/springframework/scripting/config/spring-lang-2.5.xsd, http://www.springframework.org/schema/lang/spring-lang-2.5.xsd=org/springframework/scripting/config/spring-lang-2.5.xsd, http://www.springframework.org/schema/context/spring-context-2.5.xsd=org/springframework/context/config/spring-context-2.5.xsd, http://www.springframework.org/schema/jms/spring-jms-2.5.xsd=org/springframework/jms/config/spring-jms-2.5.xsd, http://www.springframework.org/schema/context/spring-context.xsd=org/springframework/context/config/spring-context-2.5.xsd, http://www.springframework.org/schema/aop/spring-aop.xsd=org/springframework/aop/config/spring-aop-2.5.xsd, http://www.springframework.org/schema/util/spring-util-2.0.xsd=org/springframework/beans/factory/xml/spring-util-2.0.xsd, http://www.springframework.org/schema/util/spring-util-2.5.xsd=org/springframework/beans/factory/xml/spring-util-2.5.xsd, http://www.springframework.org/schema/tx/spring-tx-2.0.xsd=org/springframework/transaction/config/spring-tx-2.0.xsd, http://www.springframework.org/schema/tool/spring-tool-2.0.xsd=org/springframework/beans/factory/xml/spring-tool-2.0.xsd, http://activemq.org/config/1.0/1.0.xsd=activemq.xsd, http://www.springframework.org/schema/tx/spring-tx-2.5.xsd=org/springframework/transaction/config/spring-tx-2.5.xsd, http://www.springframework.org/schema/beans/spring-beans-2.0.xsd=org/springframework/beans/factory/xml/spring-beans-2.0.xsd, http://www.springframework.org/schema/tool/spring-tool-2.5.xsd=org/springframework/beans/factory/xml/spring-tool-2.5.xsd, http://www.springframework.org/schema/jms/spring-jms.xsd=org/springframework/jms/config/spring-jms-2.5.xsd, http://www.springframework.org/schema/jee/spring-jee.xsd=org/springframework/ejb/config/spring-jee-2.5.xsd, http://www.springframework.org/schema/beans/spring-beans-2.5.xsd=org/springframework/beans/factory/xml/spring-beans-2.5.xsd, http://www.springframework.org/schema/beans/spring-beans.xsd=org/springframework/beans/factory/xml/spring-beans-2.5.xsd, http://www.springframework.org/schema/tool/spring-tool.xsd=org/springframework/beans/factory/xml/spring-tool-2.5.xsd, http://activemq.apache.org/schema/core/activemq-core.xsd=activemq.xsd, http://www.springframework.org/schema/tx/spring-tx.xsd=org/springframework/transaction/config/spring-tx-2.5.xsd, http://www.springframework.org/schema/jee/spring-jee-2.0.xsd=org/springframework/ejb/config/spring-jee-2.0.xsd, http://www.springframework.org/schema/aop/spring-aop-2.0.xsd=org/springframework/aop/config/spring-aop-2.0.xsd, http://www.springframework.org/schema/jee/spring-jee-2.5.xsd=org/springframework/ejb/config/spring-jee-2.5.xsd, http://www.springframework.org/schema/aop/spring-aop-2.5.xsd=org/springframework/aop/config/spring-aop-2.5.xsd, http://activemq.org/config/1.0=activemq.xsd, http://www.springframework.org/schema/lang/spring-lang-2.0.xsd=org/springframework/scripting/config/spring-lang-2.0.xsd, http://www.springframework.org/schema/util/spring-util.xsd=org/springframework/beans/factory/xml/spring-util-2.5.xsd}
218  [main] DEBUG org.springframework.beans.factory.xml.PluggableSchemaResolver  - Found XML schema [http://www.springframework.org/schema/beans/spring-beans-2.5.xsd] in classpath: org/springframework/beans/factory/xml/spring-beans-2.5.xsd
328  [main] DEBUG org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader  - Loading bean definitions
390  [main] DEBUG org.springframework.beans.factory.xml.XmlBeanDefinitionReader  - Loaded 4 bean definitions from location pattern [spring-beans-bitronix.xml]
390  [main] INFO  org.springframework.context.support.ClassPathXmlApplicationContext  - Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext@480457]: org.springframework.beans.factory.support.DefaultListableBeanFactory@17ee8b8
390  [main] DEBUG org.springframework.context.support.ClassPathXmlApplicationContext  - 4 beans defined in org.springframework.context.support.ClassPathXmlApplicationContext@480457: display name [org.springframework.context.support.ClassPathXmlApplicationContext@480457]; startup date [Fri Aug 15 11:04:01 EDT 2008]; root of context hierarchy
437  [main] DEBUG org.springframework.context.support.ClassPathXmlApplicationContext  - Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.DelegatingMessageSource@1b9ce4b]
437  [main] DEBUG org.springframework.context.support.ClassPathXmlApplicationContext  - Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [org.springframework.context.event.SimpleApplicationEventMulticaster@5329c5]
437  [main] INFO  org.springframework.beans.factory.support.DefaultListableBeanFactory  - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@17ee8b8: defining beans [btmConfig,BitronixTransactionManager,JtaTransactionManager,queueConnectionFactory]; root of factory hierarchy
437  [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory  - Creating shared instance of singleton bean 'btmConfig'
437  [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory  - Creating instance of bean 'btmConfig'
500  [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory  - Eagerly caching bean 'btmConfig' to allow for resolving potential circular references
515  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Getting BeanInfo for class [bitronix.tm.Configuration]
515  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Caching PropertyDescriptors for class [bitronix.tm.Configuration]
515  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'asynchronous2Pc' of type [boolean]
515  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'backgroundRecoveryInterval' of type [int]
515  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'class' of type [java.lang.Class]
515  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'defaultTransactionTimeout' of type [int]
515  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'disableJmx' of type [boolean]
515  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'filterLogStatus' of type [boolean]
515  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'forceBatchingEnabled' of type [boolean]
515  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'forcedWriteEnabled' of type [boolean]
515  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'gracefulShutdownInterval' of type [int]
515  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'jndiUserTransactionName' of type [java.lang.String]
515  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'journal' of type [java.lang.String]
515  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'logPart1Filename' of type [java.lang.String]
515  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'logPart2Filename' of type [java.lang.String]
515  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'maxLogSizeInMb' of type [int]
515  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'resourceConfigurationFilename' of type [java.lang.String]
515  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'retryUnrecoverableResourcesRegistrationInterval' of type [int]
515  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'serverId' of type [java.lang.String]
515  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'skipCorruptedLogs' of type [boolean]
515  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'warnAboutZeroResourceTransaction' of type [boolean]
515  [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory  - Finished creating instance of bean 'btmConfig'
515  [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory  - Creating shared instance of singleton bean 'BitronixTransactionManager'
515  [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory  - Creating instance of bean 'BitronixTransactionManager'
Aug 15, 2008 11:04:02 AM bitronix.tm.BitronixTransactionManager logVersion
INFO: Bitronix Transaction Manager version 1.3-RC2
Aug 15, 2008 11:04:02 AM bitronix.tm.Configuration buildServerIdArray
INFO: JVM unique ID: <spring-btm>
Aug 15, 2008 11:04:02 AM bitronix.tm.recovery.Recoverer run
INFO: recovery committed 0 dangling transaction(s) and rolled back 0 aborted transaction(s) on 0 resource(s) []
687  [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory  - Eagerly caching bean 'BitronixTransactionManager' to allow for resolving potential circular references
687  [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory  - Finished creating instance of bean 'BitronixTransactionManager'
687  [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory  - Creating shared instance of singleton bean 'JtaTransactionManager'
687  [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory  - Creating instance of bean 'JtaTransactionManager'
718  [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory  - Eagerly caching bean 'JtaTransactionManager' to allow for resolving potential circular references
718  [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory  - Returning cached instance of singleton bean 'BitronixTransactionManager'
718  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Getting BeanInfo for class [org.springframework.transaction.jta.JtaTransactionManager]
718  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Caching PropertyDescriptors for class [org.springframework.transaction.jta.JtaTransactionManager]
718  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'allowCustomIsolationLevels' of type [boolean]
718  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'autodetectTransactionManager' of type [boolean]
718  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'autodetectUserTransaction' of type [boolean]
718  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'cacheUserTransaction' of type [boolean]
718  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'class' of type [java.lang.Class]
718  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'defaultTimeout' of type [int]
718  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'failEarlyOnGlobalRollbackOnly' of type [boolean]
718  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'globalRollbackOnParticipationFailure' of type [boolean]
718  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'jndiEnvironment' of type [java.util.Properties]
718  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'jndiTemplate' of type [org.springframework.jndi.JndiTemplate]
718  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'nestedTransactionAllowed' of type [boolean]
718  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'rollbackOnCommitFailure' of type [boolean]
718  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'transactionManager' of type [javax.transaction.TransactionManager]
718  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'transactionManagerName' of type [java.lang.String]
718  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'transactionSynchronization' of type [int]
718  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'transactionSynchronizationName' of type [java.lang.String]
718  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'transactionSynchronizationRegistryName' of type [java.lang.String]
718  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'userTransaction' of type [javax.transaction.UserTransaction]
718  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'userTransactionName' of type [java.lang.String]
718  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'validateExistingTransaction' of type [boolean]
718  [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory  - Returning cached instance of singleton bean 'BitronixTransactionManager'
718  [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory  - Invoking afterPropertiesSet() on bean with name 'JtaTransactionManager'
718  [main] INFO  org.springframework.transaction.jta.JtaTransactionManager  - Using JTA UserTransaction: a BitronixTransactionManager with 0 in-flight transaction(s)
718  [main] INFO  org.springframework.transaction.jta.JtaTransactionManager  - Using JTA TransactionManager: a BitronixTransactionManager with 0 in-flight transaction(s)
718  [main] DEBUG org.springframework.transaction.jta.JtaTransactionManager  - JTA 1.1 [javax.transaction.TransactionSynchronizationRegistry] not available
718  [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory  - Finished creating instance of bean 'JtaTransactionManager'
718  [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory  - Returning cached instance of singleton bean 'BitronixTransactionManager'
718  [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory  - Creating shared instance of singleton bean 'queueConnectionFactory'
718  [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory  - Creating instance of bean 'queueConnectionFactory'
718  [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory  - Eagerly caching bean 'queueConnectionFactory' to allow for resolving potential circular references
718  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Getting BeanInfo for class [org.springframework.jndi.JndiObjectFactoryBean]
734  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Caching PropertyDescriptors for class [org.springframework.jndi.JndiObjectFactoryBean]
734  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'beanClassLoader' of type [java.lang.ClassLoader]
734  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'cache' of type [boolean]
734  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'class' of type [java.lang.Class]
734  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'defaultObject' of type [java.lang.Object]
734  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'expectedType' of type [java.lang.Class]
734  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'exposeAccessContext' of type [boolean]
734  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'jndiEnvironment' of type [java.util.Properties]
734  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'jndiName' of type [java.lang.String]
734  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'jndiTemplate' of type [org.springframework.jndi.JndiTemplate]
734  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'lookupOnStartup' of type [boolean]
734  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'object' of type [java.lang.Object]
734  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'objectType' of type [java.lang.Class]
734  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'proxyInterface' of type [java.lang.Class]
734  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'proxyInterfaces' of type [[Ljava.lang.Class;]
734  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'resourceRef' of type [boolean]
734  [main] DEBUG org.springframework.beans.CachedIntrospectionResults  - Found bean property 'singleton' of type [boolean]
734  [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory  - Invoking afterPropertiesSet() on bean with name 'queueConnectionFactory'
734  [main] DEBUG org.springframework.jndi.JndiTemplate  - Looking up JNDI object with name [QueueConnectionFactory]
750  [main] INFO  org.springframework.beans.factory.support.DefaultListableBeanFactory  - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@17ee8b8: defining beans [btmConfig,BitronixTransactionManager,JtaTransactionManager,queueConnectionFactory]; root of factory hierarchy
750  [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory  - Retrieved dependent beans for bean 'BitronixTransactionManager': [JtaTransactionManager, queueConnectionFactory]
750  [main] DEBUG org.springframework.beans.factory.support.DisposableBeanAdapter  - Invoking destroy method 'shutdown' on bean with name 'BitronixTransactionManager'
Aug 15, 2008 11:04:02 AM bitronix.tm.BitronixTransactionManager shutdown
INFO: shutting down Bitronix Transaction Manager

Stack trace:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'queueConnectionFactory' defined in class path resource [spring-beans-bitronix.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: JNDI object with [QueueConnectionFactory] not found: JNDI implementation returned null
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1337)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
        at com.ontsys.dmn.JndiBitronixTest.TestBitronix(JndiBitronixTest.java:25)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
        at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
        at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
        at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
        at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
        at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
        at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
        at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
        at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
        at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
        at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
        at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
        at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
        at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: javax.naming.NameNotFoundException: JNDI object with [QueueConnectionFactory] not found: JNDI implementation returned null
        at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:157)
        at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:88)
        at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:153)
        at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)
        at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)
        at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105)
        at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:200)
        at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:186)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1368)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
        ... 37 more

Reply | Threaded
Open this post in threaded view
|

Re: JNDI NameNotFoundException on BTM 1.3-RC2

Ludovic Orban
Administrator
Daniel,

The BTM debug logs are not included in what you sent me. Looking at the difference of the log formats I guess you're using log4j for Spring but included slf4j-jdk14-1.4.3.jar for BTM which then forward its logs to the JDK logger. Remove slf4j-jdk14-1.4.3.jar and replace it with slf4j-log4j12-1.4.3.jar that you can find here: http://docs.codehaus.org/display/BTM/DebugLogging 
You can then add a new category 'bitronix.tm' to your log4j configuration to control BTM logs.

Nevertheless, I think I've found yet another cause of the problem.

Since you're using the resource loader, your connection factory should be created when BTM starts up and immediately be recovered but the recoverer did not run on a single resource:

Aug 15, 2008 11:04:02 AM bitronix.tm.recovery.Recoverer run
INFO: recovery committed 0 dangling transaction(s) and rolled back 0 aborted transaction(s) on 0 resource(s) []

Since you've reported a problem with the resourceConfigurationFilename property of the configuration object and you called you resources file 'bitronix-default-config.properties' I suspect that you're trying to configure your connection factory from the transaction manager's config file.

First, the NullPointerException you get when you set the resourceConfigurationFilename property of the configuration object is because BTM cannot find your properties file (I've fixed that to report a decent message BTW). The path is relative to the folder in which you started the virtual machine and that file is never read from the classpath.

Second, the transaction manager config file and the resource loader config file are totally separate. You cannot mix properties between the two. In clear: trying to configure your connection factory using the bitronix-default-config.properties won't work.

Finally, why don't you just create your connection factory in the Spring configuration ? That would be much easier and more maintainable as you would only have one config file containing everything: the Spring one.


Ludovic
Reply | Threaded
Open this post in threaded view
|

Re: JNDI NameNotFoundException on BTM 1.3-RC2

danielmeyer
Ludovic Orban wrote
Daniel, The BTM debug logs are not included in what you sent me. Looking at the difference of the log formats I guess you're using log4j for Spring but included slf4j-jdk14-1.4.3.jar for BTM
Great guess! I did as you suggest, and now I'm getting more BTM debug messages in my console output.
Ludovic Orban wrote
Since you've reported a problem with the resourceConfigurationFilename property of the configuration object and you called you resources file 'bitronix-default-config.properties' I suspect that you're trying to configure your connection factory from the transaction manager's config file.
Aha - I missed the difference between the bitronix.tm.configuration and bitronix.tm.resource.configuration properties.
Finally, why don't you just create your connection factory in the Spring configuration ? That would be much easier and more maintainable as you would only have one config file containing everything: the Spring one.
I was thinking that the connection factory had to be defined in the resource loader config file in order to make use of the bitronix.tm.resource.bind = true setting there (I misunderstood the JNDI binding section -- I now think the bitronix.tm.resource.bind = true setting belongs in the transaction manager config file -- correct?)

I've moved the connection factory definition into the Spring bean file as you suggest:

My updated Spring bean file

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">

	<bean id="activeMQConnectionFactory" class="bitronix.tm.resource.jms.PoolingConnectionFactory">
		<property name="className" value="org.activemq.ActiveMQXAConnectionFactory" />
		<property name="uniqueName" value="QueueConnectionFactory" />
		<property name="minPoolSize" value="0" />
		<property name="maxPoolSize" value="2" />
		<property name="driverProperties">
			<props>
				<prop key="brokerURL">vm://localhost</prop>
			</props>
		</property>
	</bean>

	<bean id="btmConfig" factory-method="getConfiguration" class="bitronix.tm.TransactionManagerServices">
		<property name="serverId" value="spring-btm" />
	</bean>

	<bean id="BitronixTransactionManager" factory-method="getTransactionManager" class="bitronix.tm.TransactionManagerServices"
		depends-on="btmConfig,activeMQConnectionFactory" destroy-method="shutdown" />

	<bean id="JtaTransactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
		<property name="transactionManager" ref="BitronixTransactionManager" />
		<property name="userTransaction" ref="BitronixTransactionManager" />
	</bean>

	<bean id="queueConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean"
		depends-on="BitronixTransactionManager">
		<property name="jndiName" value="QueueConnectionFactory" />
	</bean>
</beans>

Updated bitronix-default-config.properties

My transaction manager config file (bitronix-default-config.properties in the root of the classpath) is now reduced to a single line:
bitronix.tm.resource.bind = true

Resource Loader not finding the connection factory

The resource loader still doesn't seem to be finding the connection factory, though. It's still reporting zero resources loaded:
INFO  org.springframework.context.support.ClassPathXmlApplicationContext  - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@480457: display name [org.springframework.context.support.ClassPathXmlApplicationContext@480457]; startup date [Fri Aug 15 13:23:26 EDT 2008]; root of context hierarchy
INFO  org.springframework.beans.factory.xml.XmlBeanDefinitionReader  - Loading XML bean definitions from class path resource [spring-beans-bitronix.xml]
INFO  org.springframework.context.support.ClassPathXmlApplicationContext  - Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext@480457]: org.springframework.beans.factory.support.DefaultListableBeanFactory@1630ab9
INFO  org.springframework.beans.factory.support.DefaultListableBeanFactory  - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1630ab9: defining beans [activeMQConnectionFactory,btmConfig,BitronixTransactionManager,JtaTransactionManager,queueConnectionFactory]; root of factory hierarchy
DEBUG bitronix.tm.Configuration  - loading default configuration
INFO  bitronix.tm.BitronixTransactionManager  - Bitronix Transaction Manager version 1.3-RC2
DEBUG bitronix.tm.BitronixTransactionManager  - JVM version 1.5.0_15
INFO  bitronix.tm.Configuration  - JVM unique ID: 
DEBUG bitronix.tm.BitronixTransactionManager  - starting BitronixTransactionManager using a Configuration with [asynchronous2Pc=false, backgroundRecoveryInterval=0, defaultTransactionTimeout=60, disableJmx=false, filterLogStatus=false, forceBatchingEnabled=true, forcedWriteEnabled=true, gracefulShutdownInterval=60, jndiUserTransactionName=null, journal=disk, logPart1Filename=btm1.tlog, logPart2Filename=btm2.tlog, maxLogSizeInMb=2, resourceConfigurationFilename=null, retryUnrecoverableResourcesRegistrationInterval=0, serverId=spring-btm, skipCorruptedLogs=false, warnAboutZeroResourceTransaction=true]
DEBUG bitronix.tm.TransactionManagerServices  - using journal disk
DEBUG bitronix.tm.journal.DiskJournal  - disk journal files max length: 2097173
DEBUG bitronix.tm.journal.TransactionLogHeader  - read header a Bitronix TransactionLogHeader with timestamp=1218722551549, state=CLEAN_LOG_STATE, position=21
DEBUG bitronix.tm.journal.TransactionLogAppender  - spawning disk force batcher thread
DEBUG bitronix.tm.journal.DiskForceBatcherThread  - disk force thread is up and running
DEBUG bitronix.tm.journal.DiskForceBatcherThread  - waiting for the wait queue to fill up
DEBUG bitronix.tm.journal.TransactionLogHeader  - read header a Bitronix TransactionLogHeader with timestamp=1218722551502, state=CLEAN_LOG_STATE, position=21
DEBUG bitronix.tm.journal.DiskForceWaitQueue  - waiting for some TransactionLogAppender to get enqueued
DEBUG bitronix.tm.journal.DiskJournal  - logging to file 1: a TransactionLogAppender on btm1.tlog
DEBUG bitronix.tm.journal.DiskJournal  - log file activated, forcing file state to disk
DEBUG bitronix.tm.journal.DiskForceWaitQueue  - enqueued a TransactionLogAppender on btm1.tlog, 1 TransactionLogAppender waiting for a disk force
DEBUG bitronix.tm.journal.DiskForceBatcherThread  - batching disk force, there are 1 TransactionLogAppender in the wait queue
DEBUG bitronix.tm.journal.DiskForceBatcherThread  - wait queue is not empty anymore (1 in queue)
DEBUG bitronix.tm.journal.DiskForceWaitQueue  - waiting for a TransactionLogAppender on btm1.tlog to get dequeued
DEBUG bitronix.tm.journal.DiskForceBatcherThread  - forcing...
DEBUG bitronix.tm.journal.DiskForceWaitQueue  - returning head TransactionLogAppender
DEBUG bitronix.tm.journal.TransactionLogAppender  - forcing log writing
DEBUG bitronix.tm.journal.TransactionLogAppender  - done forcing log
DEBUG bitronix.tm.journal.DiskForceWaitQueue  - clearing list of waiting TransactionLogAppender
DEBUG bitronix.tm.journal.DiskForceBatcherThread  - waiting for the wait queue to fill up
DEBUG bitronix.tm.journal.DiskForceBatcherThread  - wait queue got emptied, disk force is done
DEBUG bitronix.tm.journal.DiskForceWaitQueue  - waiting for some TransactionLogAppender to get enqueued
DEBUG bitronix.tm.journal.DiskJournal  - disk journal opened
DEBUG bitronix.tm.resource.ResourceLoader  - no resource configuration file specified
DEBUG bitronix.tm.recovery.Recoverer  - 0 resource(s) recovered
DEBUG bitronix.tm.recovery.Recoverer  - not retrying unrecoverable resources registration
DEBUG bitronix.tm.journal.TransactionLogCursor  - end of transaction log file reached at 21
DEBUG bitronix.tm.journal.DiskJournal  - collected dangling records of a TransactionLogAppender on btm1.tlog, committing: 0, committed: 0, delta: 0
DEBUG bitronix.tm.recovery.Recoverer  - found 0 dangling record(s) in journal
DEBUG bitronix.tm.recovery.Recoverer  - committed 0 dangling transaction(s)
DEBUG bitronix.tm.recovery.Recoverer  - rolling back aborted branch(es)
DEBUG bitronix.tm.recovery.Recoverer  - rolled back 0 aborted branch(es)
INFO  bitronix.tm.recovery.Recoverer  - recovery committed 0 dangling transaction(s) and rolled back 0 aborted transaction(s) on 0 resource(s) []
INFO  org.springframework.transaction.jta.JtaTransactionManager  - Using JTA UserTransaction: a BitronixTransactionManager with 0 in-flight transaction(s)
INFO  org.springframework.transaction.jta.JtaTransactionManager  - Using JTA TransactionManager: a BitronixTransactionManager with 0 in-flight transaction(s)
DEBUG bitronix.tm.jndi.BitronixContext  - binding transaction manager under name 'java:comp/UserTransaction'
DEBUG bitronix.tm.jndi.BitronixContext  - looking up 'QueueConnectionFactory'
INFO  org.springframework.beans.factory.support.DefaultListableBeanFactory  - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1630ab9: defining beans [activeMQConnectionFactory,btmConfig,BitronixTransactionManager,JtaTransactionManager,queueConnectionFactory]; root of factory hierarchy
INFO  bitronix.tm.BitronixTransactionManager  - shutting down Bitronix Transaction Manager
DEBUG bitronix.tm.BitronixTransactionManager  - dumping 0 transaction context(s)
DEBUG bitronix.tm.BitronixTransactionManager  - all transactions finished, resuming shutdown
DEBUG bitronix.tm.BitronixTransactionManager  - shutting down resource loader
DEBUG bitronix.tm.resource.ResourceLoader  - resource loader has registered 0 resource(s), unregistering them now
DEBUG bitronix.tm.BitronixTransactionManager  - shutting down executor
DEBUG bitronix.tm.TransactionManagerServices  - using SyncExecutor
DEBUG bitronix.tm.BitronixTransactionManager  - shutting task scheduler
DEBUG bitronix.tm.timer.TaskScheduler  - graceful scheduler shutdown interval: 60000ms
DEBUG bitronix.tm.BitronixTransactionManager  - shutting down disk journal
DEBUG bitronix.tm.journal.TransactionLogAppender  - requesting disk force batcher thread to shutdown
DEBUG bitronix.tm.journal.TransactionLogAppender  - waiting for disk force batcher thread to die
DEBUG bitronix.tm.journal.DiskForceBatcherThread  - interrupted while waiting for the queue to fill up
DEBUG bitronix.tm.journal.DiskForceBatcherThread  - disk force thread has terminated
DEBUG bitronix.tm.journal.TransactionLogAppender  - disk force batcher thread has shutdown
DEBUG bitronix.tm.journal.DiskJournal  - disk journal closed
DEBUG bitronix.tm.BitronixTransactionManager  - shutting down recoverer
DEBUG bitronix.tm.BitronixTransactionManager  - shutting down configuration
DEBUG bitronix.tm.BitronixTransactionManager  - shutdown ran successfully
Is there something I'm still not hooking up right?

-Daniel-

Reply | Threaded
Open this post in threaded view
|

Re: JNDI NameNotFoundException on BTM 1.3-RC2

danielmeyer
I neglected to set the init-method and destroy-method on my PoolingConnectionFactory bean.  Now that I do that, I get a new error:

Stack Trace
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'activeMQConnectionFactory' defined in class path resource [spring-beans-bitronix.xml]: Invocation of init method failed; nested exception is bitronix.tm.resource.ResourceConfigurationException: cannot create JMS connection factory named QueueConnectionFactory
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1337)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
        at com.ontsys.dmn.JndiBitronixTest.TestBitronix(JndiBitronixTest.java:25)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
        at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
        at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
        at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
        at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
        at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
        at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
        at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
        at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
        at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
        at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
        at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
        at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
        at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: bitronix.tm.resource.ResourceConfigurationException: cannot create JMS connection factory named QueueConnectionFactory
        at bitronix.tm.resource.jms.PoolingConnectionFactory.init(PoolingConnectionFactory.java:50)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1413)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1374)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
        ... 37 more
Caused by: java.lang.ClassNotFoundException: org.activemq.ActiveMQXAConnectionFactory
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at bitronix.tm.resource.common.XAPool.createXAFactory(XAPool.java:209)
        at bitronix.tm.resource.common.XAPool.<init>(XAPool.java:47)
        at bitronix.tm.resource.jms.PoolingConnectionFactory.buildXAPool(PoolingConnectionFactory.java:92)
        at bitronix.tm.resource.jms.PoolingConnectionFactory.init(PoolingConnectionFactory.java:47)
        ... 44 more

Log Output
INFO  org.springframework.context.support.ClassPathXmlApplicationContext  - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@480457: display name [org.springframework.context.support.ClassPathXmlApplicationContext@480457]; startup date [Fri Aug 15 13:38:05 EDT 2008]; root of context hierarchy
INFO  org.springframework.beans.factory.xml.XmlBeanDefinitionReader  - Loading XML bean definitions from class path resource [spring-beans-bitronix.xml]
INFO  org.springframework.context.support.ClassPathXmlApplicationContext  - Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext@480457]: org.springframework.beans.factory.support.DefaultListableBeanFactory@1630ab9
INFO  org.springframework.beans.factory.support.DefaultListableBeanFactory  - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1630ab9: defining beans [activeMQConnectionFactory,btmConfig,BitronixTransactionManager,JtaTransactionManager,queueConnectionFactory]; root of factory hierarchy
DEBUG bitronix.tm.resource.jms.PoolingConnectionFactory  - building JMS XA pool for QueueConnectionFactory with 0 connection(s)
DEBUG bitronix.tm.timer.TaskScheduler  - scheduling pool shrinking task on an XAPool of resource QueueConnectionFactory with 0 connection(s) (0 still available) for Fri Aug 15 13:39:06 EDT 2008
DEBUG bitronix.tm.timer.TaskScheduler  - removing task by an XAPool of resource QueueConnectionFactory with 0 connection(s) (0 still available)
DEBUG bitronix.tm.timer.TaskScheduler  - scheduled a PoolShrinkingTask scheduled for Fri Aug 15 13:39:06 EDT 2008 on an XAPool of resource QueueConnectionFactory with 0 connection(s) (0 still available), total task(s) queued: 1
INFO  org.springframework.beans.factory.support.DefaultListableBeanFactory  - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1630ab9: defining beans [activeMQConnectionFactory,btmConfig,BitronixTransactionManager,JtaTransactionManager,queueConnectionFactory]; root of factory hierarchy

I also tried a uniqueName of "myQueueConnectionFactory" in case QueueConnectionFactory was conflicting with something internal, but same result.
Reply | Threaded
Open this post in threaded view
|

Re: JNDI NameNotFoundException on BTM 1.3-RC2

danielmeyer
danielmeyer wrote
I get a new error:
Hey hey, I had org.activemq.ActiveMQXAConnectionFactory, but it's actually org.apache.activemq.ActiveMQXAConnectionFactory. Now that I fix that, my JNDI lookup works! Here's the log (back to INFO level), and notice that happy line,
INFO  bitronix.tm.recovery.Recoverer  - recovery committed 0 dangling transaction(s) and rolled back 0 aborted transaction(s) on 1 resource(s) [QueueConnectionFactory]
Log File
INFO  org.springframework.context.support.ClassPathXmlApplicationContext  - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@480457: display name [org.springframework.context.support.ClassPathXmlApplicationContext@480457]; startup date [Fri Aug 15 13:48:28 EDT 2008]; root of context hierarchy
INFO  org.springframework.beans.factory.xml.XmlBeanDefinitionReader  - Loading XML bean definitions from class path resource [spring-beans-bitronix.xml]
INFO  org.springframework.context.support.ClassPathXmlApplicationContext  - Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext@480457]: org.springframework.beans.factory.support.DefaultListableBeanFactory@1630ab9
INFO  org.springframework.beans.factory.support.DefaultListableBeanFactory  - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1630ab9: defining beans [activeMQConnectionFactory,btmConfig,BitronixTransactionManager,JtaTransactionManager,queueConnectionFactory]; root of factory hierarchy
INFO  bitronix.tm.BitronixTransactionManager  - Bitronix Transaction Manager version 1.3-RC2
INFO  bitronix.tm.Configuration  - JVM unique ID: 
INFO  org.apache.activemq.broker.BrokerService  - Using Persistence Adapter: AMQPersistenceAdapter(activemq-data\localhost)
INFO  org.apache.activemq.broker.BrokerService  - ActiveMQ 5.1.0 JMS Message Broker (localhost) is starting
INFO  org.apache.activemq.broker.BrokerService  - For help or more information please see: http://activemq.apache.org/
INFO  org.apache.activemq.store.amq.AMQPersistenceAdapter  - AMQStore starting using directory: activemq-data\localhost
INFO  org.apache.activemq.kaha.impl.KahaStore  - Kaha Store using data directory activemq-data\localhost\kr-store\state
INFO  org.apache.activemq.store.amq.AMQPersistenceAdapter  - Active data files: []
INFO  org.apache.activemq.kaha.impl.KahaStore  - Kaha Store using data directory activemq-data\localhost\kr-store\data
INFO  org.apache.activemq.broker.BrokerService  - ActiveMQ JMS Message Broker (localhost, ID:osc8373-3100-1218822509696-0:0) started
INFO  org.apache.activemq.broker.TransportConnector  - Connector vm://localhost Started
INFO  bitronix.tm.recovery.Recoverer  - recovery committed 0 dangling transaction(s) and rolled back 0 aborted transaction(s) on 1 resource(s) [QueueConnectionFactory]
INFO  org.springframework.transaction.jta.JtaTransactionManager  - Using JTA UserTransaction: a BitronixTransactionManager with 0 in-flight transaction(s)
INFO  org.springframework.transaction.jta.JtaTransactionManager  - Using JTA TransactionManager: a BitronixTransactionManager with 0 in-flight transaction(s)
INFO  org.apache.activemq.broker.jmx.ManagementContext  - JMX consoles can connect to service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
INFO  org.springframework.context.support.ClassPathXmlApplicationContext  - Closing org.springframework.context.support.ClassPathXmlApplicationContext@480457: display name [org.springframework.context.support.ClassPathXmlApplicationContext@480457]; startup date [Fri Aug 15 13:48:28 EDT 2008]; root of context hierarchy
INFO  org.springframework.beans.factory.support.DefaultListableBeanFactory  - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1630ab9: defining beans [activeMQConnectionFactory,btmConfig,BitronixTransactionManager,JtaTransactionManager,queueConnectionFactory]; root of factory hierarchy
INFO  bitronix.tm.BitronixTransactionManager  - shutting down Bitronix Transaction Manager
INFO  org.apache.activemq.broker.TransportConnector  - Connector vm://localhost Stopped
INFO  org.apache.activemq.broker.BrokerService  - ActiveMQ Message Broker (localhost, ID:osc8373-3100-1218822509696-0:0) is shutting down
INFO  org.apache.activemq.broker.BrokerService  - ActiveMQ JMS Message Broker (localhost, ID:osc8373-3100-1218822509696-0:0) stopped
Reply | Threaded
Open this post in threaded view
|

Re: JNDI NameNotFoundException on BTM 1.3-RC2

Ludovic Orban
Administrator
It looks like you finally managed to get everything running fine, good !

About the bitronix.tm.resource.bind property: it actually is a setting of the resource loader, not the transaction manager. That feature of BTM 1.2 and lower wasn't very useful and quite awkward from a design perspective so I replaced it in 1.3 with the JNDI provider you're using. Remove it from your config file, it's useless since all created resources are automatically exposed via JNDI, there is nothing to configure to get this.

The documentation does not reflect that yet because since 1.3 final hasn't been released, the doc only explains 1.2 features.

Another suggestion: delete the bitronix-default-config.properties file and configure all your settings directly on the Configuration object in your Spring file. That'll be yet another file you won't have to maintain.

Ludovic
Reply | Threaded
Open this post in threaded view
|

Re: JNDI NameNotFoundException on BTM 1.3-RC2

danielmeyer
Ludovic Orban wrote
It looks like you finally managed to get everything running fine, good !

About the bitronix.tm.resource.bind property: ....Remove it from your config file, it's useless since all created resources are automatically exposed via JNDI, there is nothing to configure to get this.
Done!

Another suggestion: delete the bitronix-default-config.properties file and configure all your settings directly on the Configuration object in your Spring file. That'll be yet another file you won't have to maintain.
Done!

And thanks again for all the help.
-Daniel-
Reply | Threaded
Open this post in threaded view
|

Re: JNDI NameNotFoundException on BTM 1.3-RC2

steveAtSignet
Hi Daniel, is there any chance you could share your final Spring configuration now that you've got everything working.

I have the JDBC stuff done, but now need to add the JMS configuration (I'll be using Websphere-MQ rather than ActiveMQ, but it's probably pretty similar).

It seems that you've solved all the things I'm now trying to work out how to do, and it would help to not have to ask Ludovic all the questions he's already answered for you.

For info, here's my current Spring config:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
        xmlns:context="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/schema/util"
        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
       http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd">

        <context:annotation-config />
        <tx:annotation-driven/>

       
        <context:component-scan base-package="com.signetgroupplc.edm"/>

       
        <bean id="dataSource" class="bitronix.tm.resource.jdbc.PoolingDataSource" init-method="init" destroy-method="close">
                <property name="className" value="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource"/>
                <property name="uniqueName" value="xaDbms"/>
                <property name="maxPoolSize" value="8"/>
               
                <property name="allowLocalTransactions" value="true"/>
                <property name="driverProperties">
                        <props>
                                <prop key="URL">jdbc:mysql://localhost:3306/sandpit</prop>
                                <prop key="user">root</prop>
                                <prop key="password">root</prop>
                        </props>
                </property>
        </bean>

       
        <bean id="btmConfig" factory-method="getConfiguration" class="bitronix.tm.TransactionManagerServices">
                <property name="serverId" value="spring-btm"/>
        </bean>

       
        <bean id="bitronixTransactionManager" factory-method="getTransactionManager"
                class="bitronix.tm.TransactionManagerServices" depends-on="btmConfig,dataSource"
                destroy-method="shutdown"/>

       
        <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
                <property name="transactionManager" ref="bitronixTransactionManager"/>
                <property name="userTransaction" ref="bitronixTransactionManager"/>
        </bean>

       
        <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
                <property name="dataSource" ref="dataSource"/>
                <property name="annotatedClasses">
                        <list>
                                <value>com.signetgroupplc.edm.domain.TestEntity</value>
                        </list>
                </property>
                <property name="hibernateProperties">
                        <props>
                                <prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
                                <prop key="hibernate.hbm2ddl.auto">update</prop>

                                <prop key="hibernate.current_session_context_class">jta</prop>
                                <prop key="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</prop>
                                <prop key="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.BTMTransactionManagerLookup</prop>
                               
                                <prop key="hibernate.jndi.class">bitronix.tm.jndi.BitronixInitialContextFactory</prop>
                               
                                <prop key="hibernate.connection.release_mode">after_statement</prop>
                                <prop key="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</prop>
                                <prop key="hibernate.show_sql">false</prop>
                        </props>
                </property>
        </bean>

</beans>


Thanks.
Steve.
12