Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Transaction and Websphere - problems

 
Rafal Mrozik
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I'am trying to use transaction in my webService which is installed on Websphere Application Server.

I've found pice of code

Code which is connect to the database is working when i not use transaction.

When I invoke my service (with this code) i have error:
javax.naming.NameNotFoundException: Name "comp/env/UserTransaction" not found in context "java:"

What should I do else to start use transaction in my webService?

thanks
rafal
 
Edvins Reisons
Ranch Hand
Posts: 364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The exception message suggests strongly that the JNDI name is wrong.
Try "java:comp/UserTransaction".
 
Rafal Mrozik
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First thanks for replay

I have one JNDI which i have defined in my web.xml file


In Webshere i configured this JNDI too (it was necessary) by
Resources -> JDBC Providers -> ...

I am using it to connect to the Oracle database and it works fine.

The JNDI name is wrong so where should i define them?
How should look inscription im my web.xml for this JNDI?

Thanks
Rafal
 
Edvins Reisons
Ranch Hand
Posts: 364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was trying to say that you are looking up the UserTransaction in a wrong place.
 
Rafal Mrozik
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Edvins Reisons - it works!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic