You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by "Ranjan, Rakesh (Cognizant)" <Ra...@cognizant.com> on 2006/01/02 07:56:59 UTC

RE: FW: Reference to TransactionManager

Thanks Liao,



This GBean name is working. Now I am able to get a reference to
TransactionManager.



Rakesh Ranjan





________________________________

From: Jian Liao [mailto:norwaywoods@gmail.com]
Sent: Friday, December 30, 2005 8:05 PM
To: user@geronimo.apache.org
Subject: Re: FW: Reference to TransactionManager



I think the gbean name should be:
"geronimo.server:J2EEApplication=null,J2EEModule=geronimo/j2ee-server/1.
0/car,J2EEServer=geronimo,
j2eeType=TransactionManager,name=TransactionManager" if you are using
the Geronimo-1.0 built at 2005-12-22.



Hope it helps,



- Jian Liao





On 12/30/05, Ranjan, Rakesh (Cognizant) <Ra...@cognizant.com>
wrote:

Hi friends,

I tried to get a reference to TransactionManager using the code
suggested by David Jencks. But still its not working.



I am giving u a hint  what actually I am doing :



I have a java class that contain the above to return the
TransactionManager. I am calling this class through a JSP Page. I am
using the Geronimo-1.0 server. There is a snippet of the code in the
following line :



public TransactionManager getTransactionManager() {

 TransactionManager tm=null;

 try {

   ObjectName TM_NAME = new
ObjectName("geronimo.server:J2EEApplication=null,J2EEModule=geronimo/j2e
e-server/1.0-SNAPSHOT


/car,J2EEServer=geronimo,j2eeType=TransactionManager,name=TransactionMan
ager");

   Kernel kernel = KernelRegistry.getSingleKernel();

   tm = (TransactionManager)
kernel.getProxyManager().createProxy(TM_NAME,TransactionManager.class);

   }

   catch (Exception e) {

            System.out.println("Could not obtain Transaction Manager\n"+
e);

   }

   return tm;

}



But still its not working. Now the error is :



Could not obtain Transaction Manager

java.lang.IllegalArgumentException: Could not get GBeanInfo for target
object:
geronimo.server:J2EEApplication=null,J2EEModule=geronimo/j2ee-server/1.0
-SNAPSHOT/car,J2EEServer=geronimo,
j2eeType=TransactionManager,name=TransactionManager



I think the above GBean name is incorrect. Can anybody suggest me to how
to get the correct GBean name or any other way to get a reference to
transaction manager.



Thanks and Regard,

Rakesh Ranjan





-----Original Message-----
From: David Jencks [mailto: david_jencks@yahoo.com
<ma...@yahoo.com> ]
Sent: Thursday, December 08, 2005 11:41 AM
To: user@geronimo.apache.org
Subject: Re: Reference to TransactionManager



If I understand correctly your java code is in a j2ee application 

rather than a gbean?  If your code is in or called by a gbean you 

should use the technique Guglielmo mentions.  If your code is in a j2ee


application you have to work harder, and you have to find or know the 

gbean name of the transaction manager.



static final ObjectName TM_NAME = new 

ObjectName("geronimo.server:J2EEApplication=null,J2EEModule=geronimo/

j2ee-server/1.0-SNAPSHOT/

car,J2EEServer=geronimo,j2eeType=TransactionManager,name=TransactionMana


ger");





Kernel kernel = KernelRegistry.getSingleKernel();

TransactionManager tm = kernel.getProxyManager().createProxy(TM_NAME, 

TransactionManager.class);



I just wrote this code right here in this email so it is probably full 

of typos and bugs but it shows the technique to use.  If you want to 

allow the transaction manager to be found even it it is in a different 

module you can use a object name pattern, list the names satisfying it 

and pick one.



thanks

david jencks









On Dec 7, 2005, at 8:19 PM, Ranjan, Rakesh ((Cognizant)) wrote:



>

> Thanks Guglielmo,

> But I want to get the reference to TransactionManager through java 

> code only. Isn't it possible to get it using the Transaction manager 

> GBean name.

> With Regards,

> Rakess Ranjan

> 

>

> From: Guglielmo.Lichtner@instinet.com  

> [mailto:Guglielmo.Lichtner@instinet.com ]

> Sent: Wednesday, December 07, 2005 10:41 PM

> To: user@geronimo.apache.org

> Cc: user@geronimo.apache.org

> Subject: Re: Reference to TransactionManager

> 

>

>

> I had the same question. As per David Jencks:

>

> ==================================

>

>  In your gbean info building code include something like this:

>

>          infoFactory.addReference("TransactionManager",

>  ExtendedTransactionManager.class, NameFactory.TRANSACTION_MANAGER);

>

>

>  Then you won't have to specify the <type> in the reference.

>

>  In the xml plan,

>

>          <reference name="TransactionManager">

>              <module>org/apache/geronimo/Server</module>

>              <name>TransactionManager</name>

>          </reference>

>

>  assuming you are not using the patch I posted a few days ago that

>  includes new-style configIds.

>

>

> 

> "Ranjan, Rakesh  \(Cognizant\)" < Rakesh.Ranjan@cognizant.com
<ma...@cognizant.com> >

>

> 12/07/2005 05:11 AM

> Please  respond to user

>       

>          To:        <user@geronimo.apache.org >

>          cc:       

>          Subject:        Reference to  TransactionManager

>

>

>

> Hi,

> I need a reference to the TransactionManager in one of java class. But


> I don't know the GBean name corresponding to the TransactionManager. 

> Can anybody please help me how to get a reference to 

> TransactionManager in Java code.

> Regards,

> Rakesh Ranjan

> This e-mail and any files transmitted with it are  for the sole use of


> the intended recipient(s) and may contain confidential and privileged


> information.

>  If you are not the intended recipient, please contact the sender by 

> reply  e-mail and destroy all copies of the original message.

>  Any unauthorized review, use, disclosure, dissemination, forwarding,


> printing  or copying of this email or any action taken in reliance on


> this e-mail is strictly

>  prohibited and may be unlawful.

>

>  Visit us at http://www.cognizant.com <http://www.cognizant.com/> 

>

>

>

>

>

>

>  *****************************************************************

>  <<>>

>

>  In compliance with applicable rules and regulations, Instinet

>  reviews and archives incoming and outgoing email communications,

>  copies of which may be produced at the request of regulators.

>  This message is intended only for the personal and confidential

>  use of the recipients named above. If the reader of this email

>  is not the intended recipient, you have received this email in

>  error and any review, dissemination, distribution or copying is

>  strictly prohibited. If you have received this email in error,

>  please notify the sender immediately by return email and

>  permanently delete the copy you received.

>

>  Instinet accepts no liability for any content contained in the

>  email, or any errors or omissions arising as a result of email

>  transmission. Any opinions contained in this email constitute

>  the sender's best judgment at this time and are subject to change

>  without notice. Instinet does not make recommendations of a

>  particular security and the information contained in this email

>  should not be considered as a recommendation, an offer or a

>  solicitation of an offer to buy and sell securities.

>

>  *****************************************************************

> This e-mail and any files transmitted with it are for the sole use of


> the intended recipient(s) and may contain confidential and privileged


> information.

>  If you are not the intended recipient, please contact the sender by 

> reply e-mail and destroy all copies of the original message.

>  Any unauthorized review, use, disclosure, dissemination, forwarding,


> printing or copying of this email or any action taken in reliance on 

> this e-mail is strictly

>  prohibited and may be unlawful.

>

>  Visit us at http://www.cognizant.com <http://www.cognizant.com/> 



This e-mail and any files transmitted with it are for the sole use of
the intended recipient(s) and may contain confidential and privileged
information.
If you are not the intended recipient, please contact the sender by
reply e-mail and destroy all copies of the original message.
Any unauthorized review, use, disclosure, dissemination, forwarding,
printing or copying of this email or any action taken in reliance on
this e-mail is strictly
prohibited and may be unlawful.

Visit us at http://www.cognizant.com <http://www.cognizant.com/>





This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly
prohibited and may be unlawful.

  Visit us at http://www.cognizant.com