JMX and JNDI

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

JMX and JNDI

Gérald Quintana
Hello everybody,

I don't think this issue is related to Bitronix TM, but as I have been
struggling for several days and still no solution has emerged, I try
here.

Bitronix TM is started with the Tomcat Lifecycle listener and gets
bound to JNDI registry, the web application works perfectly well with
this setup.

The problem only occurs when I access the same business service
(located in the web app) through JMX, I get this error message:
2011-09-15 14:44:58,298 [RMI TCP Connection(172)-10.3.15.81] ERROR
ErrorInterceptor - Could not find UserTransaction in JNDI
[java:comp/UserTransaction]; nested exception is
org.hibernate.TransactionException: Could not find UserTransaction in
JNDI [java:comp/UserTransaction]
org.springframework.orm.hibernate3.HibernateSystemException: Could not
find UserTransaction in JNDI [java:comp/UserTransaction]; nested
exception is org.hibernate.TransactionException: Could not find
UserTransaction in JNDI [java:comp/UserTransaction]
        at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:679)
        at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
        at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411)
        at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:339)
(...)
        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:597)
        at com.sun.jmx.mbeanserver.ConvertingMethod.invokeWithOpenReturn(ConvertingMethod.java:167)
        at com.sun.jmx.mbeanserver.MXBeanIntrospector.invokeM2(MXBeanIntrospector.java:96)
        at com.sun.jmx.mbeanserver.MXBeanIntrospector.invokeM2(MXBeanIntrospector.java:33)
        at com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(MBeanIntrospector.java:208)
        at com.sun.jmx.mbeanserver.PerInterface.invoke(PerInterface.java:120)
        at com.sun.jmx.mbeanserver.MBeanSupport.invoke(MBeanSupport.java:262)
        at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
        at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
        at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1426)
        at javax.management.remote.rmi.RMIConnectionImpl.access$200(RMIConnectionImpl.java:72)
        at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1264)
        at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1359)
        at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:788)
        at sun.reflect.GeneratedMethodAccessor845.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
        at sun.rmi.transport.Transport$1.run(Transport.java:159)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
        at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)Caused by:
org.hibernate.TransactionException: Could not find UserTransaction in
JNDI [java:comp/UserTransaction]
        at org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:173)
        at org.hibernate.transaction.JTATransactionFactory.createTransaction(JTATransactionFactory.java:149)
        at org.hibernate.jdbc.JDBCContext.registerSynchronizationIfPossible(JDBCContext.java:213)
        at org.hibernate.impl.SessionImpl.checkTransactionSynchStatus(SessionImpl.java:2112)
        at org.hibernate.impl.SessionImpl.getNamedQuery(SessionImpl.java:1406)
        at sun.reflect.GeneratedMethodAccessor230.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.orm.hibernate3.HibernateTemplate$CloseSuppressingInvocationHandler.invoke(HibernateTemplate.java:1282)
        at $Proxy668.getNamedQuery(Unknown Source)
(...)
Caused by: javax.naming.NameNotFoundException: Le Nom java:comp n'est
pas li� � ce Contexte
        at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
        at org.apache.naming.SelectorContext.lookup(SelectorContext.java:137)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:163)
        ... 141 more

I have checked the content of the JNDI registry from the webapp,
UserTransaction seems properly bound to java:comp/UserTransaction:
java:
    - comp: org.apache.naming.NamingContext
        - UserTransaction: org.apache.naming.TransactionRef
        - env: org.apache.naming.NamingContext
        - Resources: org.apache.naming.resources.ProxyDirContext

Do you have an idea?

Gerald

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: JMX and JNDI

Ludovic Orban-2
This looks like a Tomcat problem to me but I'm not sure where the exact responsibility lies here.

The fact that the java:comp/UserTransaction name is available from a web context doesn't mean it's available from the context JMX runs within. I don't know what the JEE spec has to say on this subject and I don't know how other app servers would behave in such case.

The very first thing I wonder about is if you configured BTM globally in Tomcat or just in your app' context.xml? In the latter case it sounds rather normal that JMX cannot access the TM.

All I can do is to advise you to experiment with Tomcat's config and see if you can find a working combination. You may also get some help from the Tomcat mailing list.


2011/9/15 Gérald Quintana <[hidden email]>
Hello everybody,

I don't think this issue is related to Bitronix TM, but as I have been
struggling for several days and still no solution has emerged, I try
here.

Bitronix TM is started with the Tomcat Lifecycle listener and gets
bound to JNDI registry, the web application works perfectly well with
this setup.

The problem only occurs when I access the same business service
(located in the web app) through JMX, I get this error message:
2011-09-15 14:44:58,298 [RMI TCP Connection(172)-10.3.15.81] ERROR
ErrorInterceptor - Could not find UserTransaction in JNDI
[java:comp/UserTransaction]; nested exception is
org.hibernate.TransactionException: Could not find UserTransaction in
JNDI [java:comp/UserTransaction]
org.springframework.orm.hibernate3.HibernateSystemException: Could not
find UserTransaction in JNDI [java:comp/UserTransaction]; nested
exception is org.hibernate.TransactionException: Could not find
UserTransaction in JNDI [java:comp/UserTransaction]
       at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:679)
       at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
       at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411)
       at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:339)
(...)
       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:597)
       at com.sun.jmx.mbeanserver.ConvertingMethod.invokeWithOpenReturn(ConvertingMethod.java:167)
       at com.sun.jmx.mbeanserver.MXBeanIntrospector.invokeM2(MXBeanIntrospector.java:96)
       at com.sun.jmx.mbeanserver.MXBeanIntrospector.invokeM2(MXBeanIntrospector.java:33)
       at com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(MBeanIntrospector.java:208)
       at com.sun.jmx.mbeanserver.PerInterface.invoke(PerInterface.java:120)
       at com.sun.jmx.mbeanserver.MBeanSupport.invoke(MBeanSupport.java:262)
       at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
       at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
       at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1426)
       at javax.management.remote.rmi.RMIConnectionImpl.access$200(RMIConnectionImpl.java:72)
       at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1264)
       at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1359)
       at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:788)
       at sun.reflect.GeneratedMethodAccessor845.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
       at sun.rmi.transport.Transport$1.run(Transport.java:159)
       at java.security.AccessController.doPrivileged(Native Method)
       at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
       at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
       at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
       at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
       at java.lang.Thread.run(Thread.java:619)Caused by:
org.hibernate.TransactionException: Could not find UserTransaction in
JNDI [java:comp/UserTransaction]
       at org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:173)
       at org.hibernate.transaction.JTATransactionFactory.createTransaction(JTATransactionFactory.java:149)
       at org.hibernate.jdbc.JDBCContext.registerSynchronizationIfPossible(JDBCContext.java:213)
       at org.hibernate.impl.SessionImpl.checkTransactionSynchStatus(SessionImpl.java:2112)
       at org.hibernate.impl.SessionImpl.getNamedQuery(SessionImpl.java:1406)
       at sun.reflect.GeneratedMethodAccessor230.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at org.springframework.orm.hibernate3.HibernateTemplate$CloseSuppressingInvocationHandler.invoke(HibernateTemplate.java:1282)
       at $Proxy668.getNamedQuery(Unknown Source)
(...)
Caused by: javax.naming.NameNotFoundException: Le Nom java:comp n'est
pas li� � ce Contexte
       at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
       at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
       at org.apache.naming.SelectorContext.lookup(SelectorContext.java:137)
       at javax.naming.InitialContext.lookup(InitialContext.java:392)
       at org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:163)
       ... 141 more

I have checked the content of the JNDI registry from the webapp,
UserTransaction seems properly bound to java:comp/UserTransaction:
java:
   - comp: org.apache.naming.NamingContext
       - UserTransaction: org.apache.naming.TransactionRef
       - env: org.apache.naming.NamingContext
       - Resources: org.apache.naming.resources.ProxyDirContext

Do you have an idea?

Gerald

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email