File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JBoss/WildFly and the fly likes java.lang.ClassCastException: Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "java.lang.ClassCastException: " Watch "java.lang.ClassCastException: " New topic
Author

java.lang.ClassCastException:

shradha sharma
Greenhorn

Joined: Jan 09, 2007
Posts: 5
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
Marshal

Joined: Jul 20, 2005
Posts: 10418
    
175

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.


[My Blog] [JavaRanch Journal]
shradha sharma
Greenhorn

Joined: Jan 09, 2007
Posts: 5
Tried with your suggestion also. I still face the same exception.

Is there any change required in the Jboss server properties ?
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10418
    
175

Post the entire exception stacktrace that you are seeing.
shradha sharma
Greenhorn

Joined: Jan 09, 2007
Posts: 5
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.
 
subject: java.lang.ClassCastException: