RE: Client access to UserTransaction
Transactions on the client are an optional feature which Orion chooses not to support. In general, client transactions are dangerous since they could lock up the server for a long time. Instead of doing client transactions, create a session bean, and wrap that with the transaction attribute of your choice. -AP_ -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Shawn Pourchot Sent: Wednesday, January 23, 2002 11:08 AM To: Orion-Interest Subject: Client access to UserTransaction I sent this to support but maybe someone on this list has already come across this problem: I'm having problems getting the UserTransaction for external clients. The following is basically how I'm trying to get at it: env.put(Context.PROVIDER_URL,"ormi://localhost/app"); Context ctx = new InitalContext(env); UserTransaction ut = (UserTransaction)ctx.lookup("java:comp/UserTransaction"); I've noticed via running the console ("java -jar orion.jar -console") that the server does have a UserTransaction listed for my app, but the "ormi//localhost/app" does not. Is there a way to remotely get a hold of the UserTransaction?
Client access to UserTransaction
I sent this to support but maybe someone on this list has already come across this problem: I'm having problems getting the UserTransaction for external clients. The following is basically how I'm trying to get at it: env.put(Context.PROVIDER_URL,"ormi://localhost/app"); Context ctx = new InitalContext(env); UserTransaction ut = (UserTransaction)ctx.lookup("java:comp/UserTransaction"); I've noticed via running the console ("java -jar orion.jar -console") that the server does have a UserTransaction listed for my app, but the "ormi//localhost/app" does not. Is there a way to remotely get a hold of the UserTransaction?
RE: Using UserTransaction from a standalone client
This was answered at www.elephantwalker.com/rfa?id=271 regards, the elephantwalker -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of [EMAIL PROTECTED] Sent: Tuesday, December 18, 2001 9:48 AM To: Orion-Interest Subject: Using UserTransaction from a standalone client Can someone tell me how to configure properly to lookup a UserTransaction? I have a standalone client that references a jndi.properties file to connect to our app server and make use of EJB's. When I try to add a UserTransaction lookup I get name not found. Do I have to add UserTransaction to an xml config file somewhere? What does the entry have to look like? Thanks.
Using UserTransaction from a standalone client
Can someone tell me how to configure properly to lookup a UserTransaction? I have a standalone client that references a jndi.properties file to connect to our app server and make use of EJB's. When I try to add a UserTransaction lookup I get name not found. Do I have to add UserTransaction to an xml config file somewhere? What does the entry have to look like? Thanks.
UserTransaction lookup from client
Is there anything special I need to specify in the Orion configuration to get a value UserTransaction from a lookup? I have tried both the following: public static UserTransaction getTransaction() throws javax.naming.NamingException { String name = //java:com/env/UserTransaction "java:comp/UserTransaction"; Context context = JndiInterface.getContext(); return (UserTransaction) context.lookup( name ); } No matter which lookup name I use, I get the following exception javax.naming.NameNotFoundException: java:comp/UserTransaction not found Thanks, Tim
RE: How can I get UserTransaction or TransactionManager
Thank you Heinz. I tried in other ways to manage a transaction, but I still have other problems about Orion TXN. What I wanted to do in my App. is as follows; Let's assume that user class and address class exist and their relationship is 1-to-1. 1. Create a user 2. Create an address object of the user if creating the address object is failed, I'd like to rollback "creating a user". Trial 1>> I used entity bean and session bean to manage the transaction as follows; 1. newUser method is one of the methods of a session bean, and the method's transaction attribute is set to "RequiresNew" 2. newAddress method is one of the methods of User entity bean, and the mehtod's transaction attribute is set to "Supports" 3. newUser method calls newAddress method. But, even though creating the address failed, creating a user was not rollbacked, i.e. new user was still in the database. Tiral 2>> I used ejbContext to get UserTransaction in newUser method of a session bean as follows; ejbContext.getUserTransaction().begin(); create a user newAddress(); ejbContext.getUserTransaction().commit(); And set the session bean's TXN attribute to "Bean" but, the result was the same as above. Any advice appreciated. -HK -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Haeussler, Heinz Sent: Monday, July 09, 2001 2:32 PM To: Orion-Interest Subject: RE: How can I get UserTransaction or TransactionManager Hi HK, you can't get UserTransaction from an Application-Client-or RMI-Client-Context. This (optional) feature is not supported by Orion. Heinz -Ursprüngliche Nachricht- Von: HyungKee Hwang [mailto:[EMAIL PROTECTED]] Gesendet am: Montag, 9. Juli 2001 02:35 An: Orion-Interest Betreff: RE: How can I get UserTransaction or TransactionManager Thank you Aby I tried "java:comp/env/UserTransaction", but the same error occurred. Any advice appreciated. Regards, -HK -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of [EMAIL PROTECTED] Sent: Saturday, July 07, 2001 3:47 PM To: Orion-Interest Subject: Re: How can I get UserTransaction or TransactionManager Hi HK, I think you should try "java:comp/env/UserTransaction" Regards Aby "HyungKee Hwang" <[EMAIL PROTECTED]>@orionserver.com on 07-07-2001 09:10:55 AM Please respond to Orion-Interest <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] To: Orion-Interest <[EMAIL PROTECTED]> cc: Subject: How can I get UserTransaction or TransactionManager Hello, all. Can you give me some advice how to get UserTransaction or TrasactionManger? I wrote some codes in my application as follows; // Below codes are from Orion FAQ import javax.naming.*; import javax.transaction.*; ... TransactionManager manager = (TransactionManager)new InitialContext ().lookup("java:comp/UserTransaction"); I didn't have any problem compiling my codes, but I met below error while running my application avax.naming.NameNotFoundException: java:comp/UserTransaction not found at com.evermind.server.rmi.RMIContext.lookup(JAX) Thank you in advance. -HK
RE: How can I get UserTransaction or TransactionManager
Hi HK, you can't get UserTransaction from an Application-Client-or RMI-Client-Context. This (optional) feature is not supported by Orion. Heinz -Ursprüngliche Nachricht- Von: HyungKee Hwang [mailto:[EMAIL PROTECTED]] Gesendet am: Montag, 9. Juli 2001 02:35 An: Orion-Interest Betreff: RE: How can I get UserTransaction or TransactionManager Thank you Aby I tried "java:comp/env/UserTransaction", but the same error occurred. Any advice appreciated. Regards, -HK -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of [EMAIL PROTECTED] Sent: Saturday, July 07, 2001 3:47 PM To: Orion-Interest Subject: Re: How can I get UserTransaction or TransactionManager Hi HK, I think you should try "java:comp/env/UserTransaction" Regards Aby "HyungKee Hwang" <[EMAIL PROTECTED]>@orionserver.com on 07-07-2001 09:10:55 AM Please respond to Orion-Interest <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] To: Orion-Interest <[EMAIL PROTECTED]> cc: Subject: How can I get UserTransaction or TransactionManager Hello, all. Can you give me some advice how to get UserTransaction or TrasactionManger? I wrote some codes in my application as follows; // Below codes are from Orion FAQ import javax.naming.*; import javax.transaction.*; ... TransactionManager manager = (TransactionManager)new InitialContext ().lookup("java:comp/UserTransaction"); I didn't have any problem compiling my codes, but I met below error while running my application avax.naming.NameNotFoundException: java:comp/UserTransaction not found at com.evermind.server.rmi.RMIContext.lookup(JAX) Thank you in advance. -HK
RE: How can I get UserTransaction or TransactionManager
Hi HK, I am getting puzzled now on this. Maybe you could try UserTransaction ut = context.getUserTransaction(); where 'context' is the SessionContext or EntityContext variable which is declared at the top of the EJB as a variable. Kind Regards Aby
RE: How can I get UserTransaction or TransactionManager
Thank you Aby I tried "java:comp/env/UserTransaction", but the same error occurred. Any advice appreciated. Regards, -HK -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of [EMAIL PROTECTED] Sent: Saturday, July 07, 2001 3:47 PM To: Orion-Interest Subject: Re: How can I get UserTransaction or TransactionManager Hi HK, I think you should try "java:comp/env/UserTransaction" Regards Aby "HyungKee Hwang" <[EMAIL PROTECTED]>@orionserver.com on 07-07-2001 09:10:55 AM Please respond to Orion-Interest <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] To: Orion-Interest <[EMAIL PROTECTED]> cc: Subject: How can I get UserTransaction or TransactionManager Hello, all. Can you give me some advice how to get UserTransaction or TrasactionManger? I wrote some codes in my application as follows; // Below codes are from Orion FAQ import javax.naming.*; import javax.transaction.*; ... TransactionManager manager = (TransactionManager)new InitialContext ().lookup("java:comp/UserTransaction"); I didn't have any problem compiling my codes, but I met below error while running my application avax.naming.NameNotFoundException: java:comp/UserTransaction not found at com.evermind.server.rmi.RMIContext.lookup(JAX) Thank you in advance. -HK
Re: How can I get UserTransaction or TransactionManager
Hi HK, I think you should try "java:comp/env/UserTransaction" Regards Aby "HyungKee Hwang" <[EMAIL PROTECTED]>@orionserver.com on 07-07-2001 09:10:55 AM Please respond to Orion-Interest <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] To: Orion-Interest <[EMAIL PROTECTED]> cc: Subject: How can I get UserTransaction or TransactionManager Hello, all. Can you give me some advice how to get UserTransaction or TrasactionManger? I wrote some codes in my application as follows; // Below codes are from Orion FAQ import javax.naming.*; import javax.transaction.*; ... TransactionManager manager = (TransactionManager)new InitialContext ().lookup("java:comp/UserTransaction"); I didn't have any problem compiling my codes, but I met below error while running my application avax.naming.NameNotFoundException: java:comp/UserTransaction not found at com.evermind.server.rmi.RMIContext.lookup(JAX) Thank you in advance. -HK
How can I get UserTransaction or TransactionManager
Hello, all. Can you give me some advice how to get UserTransaction or TrasactionManger? I wrote some codes in my application as follows; // Below codes are from Orion FAQ import javax.naming.*; import javax.transaction.*; ... TransactionManager manager = (TransactionManager)new InitialContext().lookup("java:comp/UserTransaction"); I didn't have any problem compiling my codes, but I met below error while running my application avax.naming.NameNotFoundException: java:comp/UserTransaction not found at com.evermind.server.rmi.RMIContext.lookup(JAX) Thank you in advance. -HK
Re: UserTransaction
> Phan Anh Tran wrote: > > Yeah, but can I do that from a stand-alone APP running in separate no, you can't. (and it is a better design to handle transactions on the server side. for example you can use sessionbeans for your businesslogic(+transactions) from your standalone-app) Am Montag, 18. Juni 2001 16:23 schrieben Sie: > I don't know, I've never tried it. I would try it and let the list > know the result. You're going to need to set the jndi properties > using a jndi.properties file in your client. This is well documented > elsewhere in this list. Once the jndi context is set up correctly, I > see no reason why it wouldn't work. > > Jeff. > > Phan Anh Tran wrote: > > Yeah, but can I do that from a stand-alone APP running in separate > > VM? > > > > Anh > > > > - Original Message - > > From: "Jeff Hubbach" <[EMAIL PROTECTED]> > > To: "Orion-Interest" <[EMAIL PROTECTED]> > > Sent: Friday, June 15, 2001 6:05 AM > > Subject: Re: UserTransaction > > > > > Check www.orionserver.com, under the FAQ link: > > > > > > How do I get a reference to the TransactionManager? > > > > > > > > >import javax.naming.*; > > >import javax.transaction.*; > > >... > > >TransactionManager manager = (TransactionManager)new > > > InitialContext().lookup("java:comp/UserTransaction"); > > > > > > Jeff Hubbach > > > > > > Phan Anh Tran wrote: > > > > With orion, Is it possible to look up a user transaction > > > > outside an EJB (a stand-alone app for example)? Thanks > > > > > > -- > > > Jeff Hubbach > > > Internet Developer > > > New Media Designs, Inc. > > > www.nmd.com > > > > _ > > Do You Yahoo!? > > Get your free @yahoo.com address at http://mail.yahoo.com > > -- > Jeff Hubbach > Internet Developer > New Media Designs, Inc. > www.nmd.com -- Klaus Thiele - Personal & Informatik AG mailto:[EMAIL PROTECTED] "Your mouse has moved. Windows must be restarted for the change to take effect."
Auto-reply: Re: UserTransaction
I am on holiday returning back to the office on Tuesday the 19th June. For administrative enquiries please contact Sian Norrie at [EMAIL PROTECTED] or (+44/0) 118 9246080, for technology enquiries please contact Mark Reeves at [EMAIL PROTECTED] or (+44/0) 207 816 7865. I don't know, I've never tried it. I would try it and let the list know the result. You're going to need to set the jndi properties using a jndi.properties file in your client. This is well documented elsewhere in this list. Once the jndi context is set up correctly, I see no reason why it wouldn't work. Jeff. Phan Anh Tran wrote: > Yeah, but can I do that from a stand-alone APP running in separate VM? > > Anh > > - Original Message - > From: "Jeff Hubbach" <[EMAIL PROTECTED]> > To: "Orion-Interest" <[EMAIL PROTECTED]> > Sent: Friday, June 15, 2001 6:05 AM > Subject: Re: UserTransaction > > > Check www.orionserver.com, under the FAQ link: > > > > How do I get a reference to the TransactionManager? > > > > > >import javax.naming.*; > >import javax.transaction.*; > >... > >TransactionManager manager = (TransactionManager)new > > InitialContext().lookup("java:comp/UserTransaction"); > > > > Jeff Hubbach > > > > Phan Anh Tran wrote: > > > > > With orion, Is it possible to look up a user transaction outside an > > > EJB (a stand-alone app for example)? Thanks > > > > -- > > Jeff Hubbach > > Internet Developer > > New Media Designs, Inc. > > www.nmd.com > > > > > > > > _ > Do You Yahoo!? > Get your free @yahoo.com address at http://mail.yahoo.com -- Jeff Hubbach Internet Developer New Media Designs, Inc. www.nmd.com
Re: UserTransaction
I don't know, I've never tried it. I would try it and let the list know the result. You're going to need to set the jndi properties using a jndi.properties file in your client. This is well documented elsewhere in this list. Once the jndi context is set up correctly, I see no reason why it wouldn't work. Jeff. Phan Anh Tran wrote: > Yeah, but can I do that from a stand-alone APP running in separate VM? > > Anh > > - Original Message - > From: "Jeff Hubbach" <[EMAIL PROTECTED]> > To: "Orion-Interest" <[EMAIL PROTECTED]> > Sent: Friday, June 15, 2001 6:05 AM > Subject: Re: UserTransaction > > > Check www.orionserver.com, under the FAQ link: > > > > How do I get a reference to the TransactionManager? > > > > > >import javax.naming.*; > >import javax.transaction.*; > >... > >TransactionManager manager = (TransactionManager)new > > InitialContext().lookup("java:comp/UserTransaction"); > > > > Jeff Hubbach > > > > Phan Anh Tran wrote: > > > > > With orion, Is it possible to look up a user transaction outside an > > > EJB (a stand-alone app for example)? Thanks > > > > -- > > Jeff Hubbach > > Internet Developer > > New Media Designs, Inc. > > www.nmd.com > > > > > > > > _ > Do You Yahoo!? > Get your free @yahoo.com address at http://mail.yahoo.com -- Jeff Hubbach Internet Developer New Media Designs, Inc. www.nmd.com
RE: UserTransaction
I think the easiest way to learn is to use the visual tools that come with orion and create a project with the 'orion specific' directory structure. Use the tool for a little bit to see where it saves the classes, jsps and descriptors. Once you are confortable, put the visual tool away and do it manually (it still has a lot of bugs). I'm talking about the earassembler.jar -Original Message- From: David- [mailto:[EMAIL PROTECTED]] Sent: Friday, June 15, 2001 9:32 PM To: Orion-Interest Subject:Re: UserTransaction hi guys, i m new to ejb and want to develop them using the orion server...could someone explain where do i put up my ejbs and my jsps..i mean what im looking for is a directory pattern...I tried alot of combos but...does not seem to work... thanks in advance David
Re: UserTransaction
hi Devid you have to prepare 3 files: 1) a .jar file containig the ejbs classes and the .xml descriptor (under Meta-inf) 2) a .war file containig your jsps, static files, and the web.xml file (under web-inf) 3) a .ear file containing the ejb .jar file the .war file and the application.xml file (under Meta-inf) 4) copy the .ear file under $ORION_HOME/applications 5) start orion hope this helps ciao Paolo David- wrote: > hi guys, > > i m new to ejb and want to develop them using the orion server...could > someone explain where do i put up my ejbs and my jsps..i mean what im > looking for is a directory pattern...I tried alot of combos but...does not > seem to work... > > thanks in advance > > David begin:vcard n:;nome x-mozilla-html:FALSE adr:;; version:2.1 email;internet:[EMAIL PROTECTED] fn:nome cognome end:vcard
Re: UserTransaction
hi guys, i m new to ejb and want to develop them using the orion server...could someone explain where do i put up my ejbs and my jsps..i mean what im looking for is a directory pattern...I tried alot of combos but...does not seem to work... thanks in advance David
Re: UserTransaction
Yeah, but can I do that from a stand-alone APP running in separate VM? Anh - Original Message - From: "Jeff Hubbach" <[EMAIL PROTECTED]> To: "Orion-Interest" <[EMAIL PROTECTED]> Sent: Friday, June 15, 2001 6:05 AM Subject: Re: UserTransaction > Check www.orionserver.com, under the FAQ link: > > How do I get a reference to the TransactionManager? > > >import javax.naming.*; >import javax.transaction.*; >... >TransactionManager manager = (TransactionManager)new > InitialContext().lookup("java:comp/UserTransaction"); > > Jeff Hubbach > > Phan Anh Tran wrote: > > > With orion, Is it possible to look up a user transaction outside an > > EJB (a stand-alone app for example)? Thanks > > -- > Jeff Hubbach > Internet Developer > New Media Designs, Inc. > www.nmd.com > > > _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
Re: UserTransaction
Check www.orionserver.com, under the FAQ link: How do I get a reference to the TransactionManager? import javax.naming.*; import javax.transaction.*; ... TransactionManager manager = (TransactionManager)new InitialContext().lookup("java:comp/UserTransaction"); Jeff Hubbach Phan Anh Tran wrote: > With orion, Is it possible to look up a user transaction outside an > EJB (a stand-alone app for example)? Thanks -- Jeff Hubbach Internet Developer New Media Designs, Inc. www.nmd.com
UserTransaction
With orion, Is it possible to look up a user transaction outside an EJB (a stand-alone app for example)? Thanks
UserTransaction Once Again!
Hello, My name is Sameer and I am trying to figure out how to start a new transaction from the client of a stateful session bean. After reading the previous mails on this issue, it is evident that getting a reference to the UserTransaction interface is the only way of doing it! (Or is there some other way out as well!!!). But when I try lookup on the initial context it gives an exception stating "java:comp/UserTransaction not found". Please help if you have encountered a similar problem and have found a way of doing it! Please do specify as to how and which xml files have to be modified. Bye for now. Sameer
Re: get reference to UserTransaction fails
Hello Klaus, Getting the TransactionManager from an app-client is not yet supported. It is not required by the J2EE spec but the spec doesn't forbid supporting it either. However, if we implement it and you use it, it will potentially not be portable to other J2EE servers. It's also generally a bad idea to do transaction demarcation from the client, since you want your transactions to be short. Network latency makes the transaction much longer than it would need to be if a session bean controlled it. So it's not implemented, it's a portability problem and it's a performance/stability problem, so I would try to do it in some other way. Regards, Karl Avedal Klaus Thiele wrote: > Hello, > > i'm using transactions within servlets, sessionbeans > with no problems. > > now i'm trying this from an ordinary app-client but it > caught an exception: >"java:comp/UserTransaction not found" > > what goes wrong? > > thanks a lot > klaus > > import javax.naming.*; > import javax.transaction.*; > ... > TransactionManager tm = >(TransactionManager)new > InitialContext().lookup("java:comp/UserTransaction"); > > -- > Klaus Thiele - Personal & Informatik AG > mailto:[EMAIL PROTECTED] > > "There's got to be more to life than compile-and-go."
RE: get reference to UserTransaction fails
a) yes, I do call Entity Beans directly... no programatic security there (yet, but can be acomplished especially with CMP, which is what I work with) yes I also place some BL within Session Beans with a facade pattern... b) Yes, you may use session beans not only as in a facade pattern, but also in a Activity-Owner pattern: Stateful SB -> Stateless SB -> Entity Beans TransactionRoot -> Facade/BL -> Persistence in this pattern, you have an object which its purpose is transaction demarcation remember that transaction demarcation is best done at tier boundaries My 2c, JP -Original Message- From: Greg Matthews [mailto:[EMAIL PROTECTED]] Sent: Martes, 24 de Octubre de 2000 21:08 To: Orion-Interest Subject: Re: get reference to UserTransaction fails i was trying to do the same thing, and it sort of makes sense that you can't control a transaction (UserTransaction) from outside orion (i.e. the ejb container). it does raise the question however about how you would ever maintain any decent level of control over transactions if entity beans were involved unless you *always*: 1. set the trans-attribute of every entity bean to Mandatory 2. used stateless session beans as a facade to controlling entity beans. i've been using stateless session beans for a while and trying to come up to speed with entity beans. there's probably something stupid i'm doing but i've been unable to find a solid way to control database transaction boundaries unless i use the above pattern (slsb call entity beans). a) does anyone call entity beans directly from a JSP? or do you call stateless server beans which wrap entity beans? b) is it possible to control database transaction boundaries without wrapping EJB methods calls in a UserTransaction.begin() and UserTransaction.commit() ? thanks, greg - Original Message - From: "Juan Lorandi (Chile)" <[EMAIL PROTECTED]> To: "Orion-Interest" <[EMAIL PROTECTED]> Sent: Wednesday, October 25, 2000 3:49 AM Subject: RE: get reference to UserTransaction fails > Are your trying to retrieve something from "java:comp" DIRECTLY from code > not running on Orion? > > I have looked (very quickly) at the specs, and I don't think that's > allowed(seems pretty unsafe to me) > Perhaps you can build a session bean that preforms the lookup, then passes > the reference to the client > > > But I think it's a bad idea anyway... it's kinda like "one and a half" layer > programming... > > > My 2c, > > JP > > -Original Message- > From: Klaus Thiele [mailto:[EMAIL PROTECTED]] > Sent: Martes, 24 de Octubre de 2000 7:10 > To: Orion-Interest > Subject: get reference to UserTransaction fails > > > Hello, > > i'm using transactions within servlets, sessionbeans > with no problems. > > now i'm trying this from an ordinary app-client but it > caught an exception: >"java:comp/UserTransaction not found" > > what goes wrong? > > thanks a lot > klaus > > > import javax.naming.*; > import javax.transaction.*; > ... > TransactionManager tm = >(TransactionManager)new > InitialContext().lookup("java:comp/UserTransaction"); > > -- > Klaus Thiele - Personal & Informatik AG > mailto:[EMAIL PROTECTED] > > "There's got to be more to life than compile-and-go." > >
Re: get reference to UserTransaction fails
i was trying to do the same thing, and it sort of makes sense that you can't control a transaction (UserTransaction) from outside orion (i.e. the ejb container). it does raise the question however about how you would ever maintain any decent level of control over transactions if entity beans were involved unless you *always*: 1. set the trans-attribute of every entity bean to Mandatory 2. used stateless session beans as a facade to controlling entity beans. i've been using stateless session beans for a while and trying to come up to speed with entity beans. there's probably something stupid i'm doing but i've been unable to find a solid way to control database transaction boundaries unless i use the above pattern (slsb call entity beans). a) does anyone call entity beans directly from a JSP? or do you call stateless server beans which wrap entity beans? b) is it possible to control database transaction boundaries without wrapping EJB methods calls in a UserTransaction.begin() and UserTransaction.commit() ? thanks, greg - Original Message - From: "Juan Lorandi (Chile)" <[EMAIL PROTECTED]> To: "Orion-Interest" <[EMAIL PROTECTED]> Sent: Wednesday, October 25, 2000 3:49 AM Subject: RE: get reference to UserTransaction fails > Are your trying to retrieve something from "java:comp" DIRECTLY from code > not running on Orion? > > I have looked (very quickly) at the specs, and I don't think that's > allowed(seems pretty unsafe to me) > Perhaps you can build a session bean that preforms the lookup, then passes > the reference to the client > > > But I think it's a bad idea anyway... it's kinda like "one and a half" layer > programming... > > > My 2c, > > JP > > -Original Message- > From: Klaus Thiele [mailto:[EMAIL PROTECTED]] > Sent: Martes, 24 de Octubre de 2000 7:10 > To: Orion-Interest > Subject: get reference to UserTransaction fails > > > Hello, > > i'm using transactions within servlets, sessionbeans > with no problems. > > now i'm trying this from an ordinary app-client but it > caught an exception: >"java:comp/UserTransaction not found" > > what goes wrong? > > thanks a lot > klaus > > > import javax.naming.*; > import javax.transaction.*; > ... > TransactionManager tm = >(TransactionManager)new > InitialContext().lookup("java:comp/UserTransaction"); > > -- > Klaus Thiele - Personal & Informatik AG > mailto:[EMAIL PROTECTED] > > "There's got to be more to life than compile-and-go." > >
RE: get reference to UserTransaction fails
Are your trying to retrieve something from "java:comp" DIRECTLY from code not running on Orion? I have looked (very quickly) at the specs, and I don't think that's allowed(seems pretty unsafe to me) Perhaps you can build a session bean that preforms the lookup, then passes the reference to the client But I think it's a bad idea anyway... it's kinda like "one and a half" layer programming... My 2c, JP -Original Message- From: Klaus Thiele [mailto:[EMAIL PROTECTED]] Sent: Martes, 24 de Octubre de 2000 7:10 To: Orion-Interest Subject: get reference to UserTransaction fails Hello, i'm using transactions within servlets, sessionbeans with no problems. now i'm trying this from an ordinary app-client but it caught an exception: "java:comp/UserTransaction not found" what goes wrong? thanks a lot klaus import javax.naming.*; import javax.transaction.*; ... TransactionManager tm = (TransactionManager)new InitialContext().lookup("java:comp/UserTransaction"); -- Klaus Thiele - Personal & Informatik AG mailto:[EMAIL PROTECTED] "There's got to be more to life than compile-and-go."
Re: get reference to UserTransaction fails
>now i'm trying this from an ordinary app-client but it >caught an exception: > "java:comp/UserTransaction not found" In the JNDI properties, are you specifying the application name as well as the server? e.g. java.naming.provider.url=ormi://localhost/myapp (Correct) java.naming.provider.url=ormi://localhost (Wrong) -Joe Walnes
get reference to UserTransaction fails
Hello, i'm using transactions within servlets, sessionbeans with no problems. now i'm trying this from an ordinary app-client but it caught an exception: "java:comp/UserTransaction not found" what goes wrong? thanks a lot klaus import javax.naming.*; import javax.transaction.*; ... TransactionManager tm = (TransactionManager)new InitialContext().lookup("java:comp/UserTransaction"); -- Klaus Thiele - Personal & Informatik AG mailto:[EMAIL PROTECTED] "There's got to be more to life than compile-and-go."
java:comp/UserTransaction not found
dear all, i'm sort of still learning about entity beans and wondered if anyone had any pointers for an error i'm getting. i receive *no* error when i try to obtain a reference to a UserTransaction from a stateless server bean under orion. i receive the following error when i try to obtain a reference to a UserTransaction from a java program running *outside* orion, that is similar to CartClient in the orion examples. javax.naming.NameNotFoundException: java:comp/UserTransaction not found i can get around this error by having a stateless session bean do the UserTransaction stuff, and act as a facade to the other various entity and session bean methods but was wondering if there was a way around the above problem. thanks, greg.
Can't use UserTransaction
I have Orion 1.0, patched with orion.jar 1.1.24, and Cloudscape 3 on a Windows NT system. I'm trying to use transactions with my Stateless Session Bean (yes, Bean managed transaction is specified in ejb deployment descriptor), but I can't obtain a reference to the UserTransaction object associated with my SessionContext because if I call sessioncontext.getUserTransaction(), sessionContext returns a null Object. So, if I try to invoke a method of UserTransaction on my [null] instance, a NullPointerException is thrown. What's wrong? Please help me! Thanks, Stefano.
DeadLock in UserTransaction
Hi I have discovered a deadlock problem with Orion 1.1.16 which I suspect is a bug: I do the following (in the servlet tier): 1. Begin a user transaction (getting the userTransaction from java:comp/UserTransaction). 2. Then create a new entity bean 3. Then execute a finder method which should return, among others, the newly created entity bean. 4. Commit the transaction The finder method locks in the database access. All bean methods are set to the "Required" transaction property. This means that they should participate in the user transaction (and not create their own). The database access isolation level is set to "committed". I am using SQL Server 7.0 and used the Enterprise Manager to investigate the problem. It appears that the create and finder methods are associated with different sessions in the database and therefore cause the lock. When I change the isolation level to "uncommitted" the deadlock disappears. This is as expected when the two methods run in different sessions. As far as I can see this should not happen, i.e. the container should use the same session (and transaction) for both methods. Please correct me if I am wrong but this is what I understand that the J2EE framework is suppose to do. Thanks Hans Barnard PS. I get the same behaviour with the stable version, 1.0.3b
RE: UserTransaction.
Hi Karl, Well, you really have a way to make us users feel special, don't you... ;) Rui Gil > > Hello Rui, > > Ok, since you want it, we'll implement it. It's put up as a > feature request, so expect it in about a week. >
Re: UserTransaction.
Hello Rui, Ok, since you want it, we'll implement it. It's put up as a feature request, so expect it in about a week. Rui Gil wrote: > Hi Karl, > > Well, you're right, as far as I know the specification doesn't say > that this should be implemented, but it doesn't say the opposite > either... and this is a common feature around J2EE servers. So I > really hope that the Orion team implement this one quickly... > > I don't understand why the implementation is not going to be portable, > aren't we talking about standard interfaces here ? It will not be portable since it's outside the specification of the platform. You're looking somethign up from the environment that the specification isn't saying will be there. That's like relying on System properties that might be there on some platforms, but not on some. You are using a standard interface to access the systerm properties, but they will not always be there. This means that your application will not be "pure J2EE" and work on every J2EE server, but as long as you're ok with that, it's no problem, except for the usual problems of transaction demarcation from the client (network latency making the transactions long, and with many clients, you could get many long transactions going...) Moving your transaction demarcation across the network to the session beans on the server will usually help your application to perform better. Regards, Karl Avedal
RE: UserTransaction.
Hi Karl, Well, you're right, as far as I know the specification doesn't say that this should be implemented, but it doesn't say the opposite either... and this is a common feature around J2EE servers. So I really hope that the Orion team implement this one quickly... I don't understand why the implementation is not going to be portable, aren't we talking about standard interfaces here ? Thanks, Rui Gil -Original Message- From: Karl Avedal [mailto:[EMAIL PROTECTED]] Sent: quarta-feira, 5 de Julho de 2000 10:26 To: Rui Gil Cc: Orion-Interest Subject: Re: UserTransaction. Hello Rui, Currently we do not support getting a UserTransaction reference from an application client (the specification does not say that clients should have access to it). We will probably implement it in a future release, but it will then be Orion specific and not portable to every J2EE server. Also, it's usually not a good choice to do transaction demarcation on the client. I would recommend doing the transaction demarcation from a session bean. If you want to, you can see the session bean as a part of your client logically, just that it's residing on the server, and you can probably put the kind of logic you want client transaction demarcation for in the session bean (but since I don't know exactly what you're using it for, I can't say for sure...) Regards, Karl Avedal Rui Gil wrote: > Hi ! > > I'm trying to use an UserTransaction in a client code. > None of the usuals JNDI names work, like, > UserTransaction utx = > (UserTransaction)initialContext.lookup("java:comp/UserTransaction") > > What is the default JNDI name where the UserTransaction is bound for clients > ? > Do I have to include it as a resource in my application-client.xml to bind > it to JNDI ? > And how do I configure this ? > > thx for the help. > > Rui Gil
Re: UserTransaction.
Hello Rui, Currently we do not support getting a UserTransaction reference from an application client (the specification does not say that clients should have access to it). We will probably implement it in a future release, but it will then be Orion specific and not portable to every J2EE server. Also, it's usually not a good choice to do transaction demarcation on the client. I would recommend doing the transaction demarcation from a session bean. If you want to, you can see the session bean as a part of your client logically, just that it's residing on the server, and you can probably put the kind of logic you want client transaction demarcation for in the session bean (but since I don't know exactly what you're using it for, I can't say for sure...) Regards, Karl Avedal Rui Gil wrote: > Hi ! > > I'm trying to use an UserTransaction in a client code. > None of the usuals JNDI names work, like, > UserTransaction utx = > (UserTransaction)initialContext.lookup("java:comp/UserTransaction") > > What is the default JNDI name where the UserTransaction is bound for clients > ? > Do I have to include it as a resource in my application-client.xml to bind > it to JNDI ? > And how do I configure this ? > > thx for the help. > > Rui Gil
UserTransaction.
Hi ! I'm trying to use an UserTransaction in a client code. None of the usuals JNDI names work, like, UserTransaction utx = (UserTransaction)initialContext.lookup("java:comp/UserTransaction") What is the default JNDI name where the UserTransaction is bound for clients ? Do I have to include it as a resource in my application-client.xml to bind it to JNDI ? And how do I configure this ? thx for the help. Rui Gil
Re: Orion UserTransaction
Hi Theo, long time ago i got following answer: :> We'll check this out, it does seem weird, :> Regards,Karl Avedal the problem is not solved yet. klaus > I'm having exactly the same problem as you. > May I ask you if (and how) you have solved it? > > Hello, > > > > i have a SessionBean: > > > >public class PersonBean implements SessionBean { > > private UserTransaction ut = null; > > private SessionContext ctx; > > [...] > >public void ejbCreate() throws RemoteException, CreateException { > > ut = ctx.getUserTransaction(); > > > > ejb-jar.xml: > > Bean > > > > when my client calls the create-method, i get following exception: > > "Only beans with user-managed transaction can invoke getUserTransaction()" > > > > did i miss something? -- Klaus Thiele - Personal & Informatik AG mailto:[EMAIL PROTECTED] "There's got to be more to life than compile-and-go."
Re: UserTransaction not found
Hello Klaus, from what kind of module are you doing this? From a Servlet? Something else? Only certain modules have access to the TransactionManager... Regards, Karl Avedal Klaus Thiele wrote: > Hello, > > as described in your FAQ i tried the > (TransactionManager)context.lookup("java:comp/UserTransaction"); > but i get always the exception > "java:comp/UserTransaction not found" > what goes wrong? > > questions: > - why to do > tm = (TransactionManager)initial.lookup("java:comp/UserTransaction"); > and not >ut = (UserTransaction)initial.lookup("java:comp/UserTransaction"); ? > - can i change my code to >ut = (UserTransaction)tm; ? > > thanks > klaus > > -- > Klaus Thiele - Personal & Informatik AG > mailto:[EMAIL PROTECTED] > > "There's got to be more to life than compile-and-go."
UserTransaction not found
Hello, as described in your FAQ i tried the (TransactionManager)context.lookup("java:comp/UserTransaction"); but i get always the exception "java:comp/UserTransaction not found" what goes wrong? questions: - why to do tm = (TransactionManager)initial.lookup("java:comp/UserTransaction"); and not ut = (UserTransaction)initial.lookup("java:comp/UserTransaction"); ? - can i change my code to ut = (UserTransaction)tm; ? thanks klaus -- Klaus Thiele - Personal & Informatik AG mailto:[EMAIL PROTECTED] "There's got to be more to life than compile-and-go."
Re: UserTransaction in SessionBean
Hello Klaus, We'll check this out, it does seem weird, Regards, Karl Avedal Klaus Thiele wrote: > Hello, > > i have a SessionBean: > >public class PersonBean implements SessionBean { > private UserTransaction ut = null; > private SessionContext ctx; > [...] >public void ejbCreate() throws RemoteException, CreateException { > ut = ctx.getUserTransaction(); > > ejb-jar.xml: > Bean > > when my client calls the create-method, i get following exception: > "Only beans with user-managed transaction can invoke getUserTransaction()" > > did i miss something? > > thanks > klaus > > -- > Klaus Thiele - Personal & Informatik AG > mailto:[EMAIL PROTECTED] > > "There's got to be more to life than compile-and-go."
UserTransaction
Hello, as described in your FAQ i tried the (TransactionManager)context.lookup("java:comp/UserTransaction"); but i get always the exception "java:comp/UserTransaction not found" questions: - why to do tm = (TransactionManager)initial.lookup("java:comp/UserTransaction"); and not ut = (UserTransaction)initial.lookup("java:comp/UserTransaction"); ? - can i change my code to ut = (UserTransaction)tm; ? thanks klaus -- Klaus Thiele - Personal & Informatik AG mailto:[EMAIL PROTECTED] "There's got to be more to life than compile-and-go."
UserTransaction in SessionBean
Hello, i have a SessionBean: public class PersonBean implements SessionBean { private UserTransaction ut = null; private SessionContext ctx; [...] public void ejbCreate() throws RemoteException, CreateException { ut = ctx.getUserTransaction(); ejb-jar.xml: Bean when my client calls the create-method, i get following exception: "Only beans with user-managed transaction can invoke getUserTransaction()" did i miss something? thanks klaus -- Klaus Thiele - Personal & Informatik AG mailto:[EMAIL PROTECTED] "There's got to be more to life than compile-and-go."
UserTransaction
Hi all, I've seen this posted quite a few times before but no-one seems to know the answer. How do you get a handle to a UserTransaction (on the client, not in a bean)? I've tried the following but with no luck: UserTransaction utx = (UserTransaction)context.lookup("javax.transaction.UserTransaction"); UserTransaction utx = (UserTransaction)context.lookup("java:comp:env/UserTransaction"); Anybody? Regards, Rob Hargreaves
UserTransaction lookup
Hi all, How do you get a handle to a UserTransaction (on the client, not in a bean)? I've tried the following but with no luck: UserTransaction utx = (UserTransaction)context.lookup("javax.transaction.UserTransaction"); UserTransaction utx = (UserTransaction)context.lookup("java:comp:env/UserTransaction"); Regards, Rob Hargreaves
UserTransaction Handle
I'm sorry if this is obvious but after going through the docs and the examples I can not find how to get the JTA UserTransaction handle from Orion. The J2EE docs give an example in terms of a SessionBean calling an EntityBean, but not an EJB client. Any pointers would be greatly appreciated. Thanks Dan Pritchett