Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

java.lang.ClassCastException:  RSS feed

 
shradha sharma
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My servlet program code

Context ctx = null;
ctx = new ContextLoader().getContext();
UserTransaction utx = (UserTransaction)ctx.lookup("java:comp/UserTransaction");

throws the below exception

java.lang.ClassCastException: org.jboss.tm.usertx.client.ServerVMClientUserTransaction

am using jboss 4.0.4

any idea ???
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure what a ContextLoader is. Usually you do the lookup as follows:



Try it out. Let us know if it does not fix the issue.
 
shradha sharma
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tried with your suggestion also. I still face the same exception.

Is there any change required in the Jboss server properties ?
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Post the entire exception stacktrace that you are seeing.
 
shradha sharma
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
was able to find out the reason..
my lib included both servlet.jar and javax.servlet.jar...so was throwing the error.....

thnks for the help yaar..
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!