aspose 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: 10102
    
165

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: 10102
    
165

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..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.lang.ClassCastException: