This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Websphere and the fly likes Problem with websphere server regarding java.lang.NoSuchMethodError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "Problem with websphere server regarding java.lang.NoSuchMethodError" Watch "Problem with websphere server regarding java.lang.NoSuchMethodError" New topic
Author

Problem with websphere server regarding java.lang.NoSuchMethodError

NareshAnkuskani Kumar
Ranch Hand

Joined: Sep 15, 2005
Posts: 76
I developed a web application which calls the methods that are part of some third party jar file. I am able to run the application successfully without any issues in APACHE-TOMCAT web server.
When the same web application created as a WAR file and deployed in the websphere application server, i am facing an exception (java.lang.NoSuchMethodError) when a method that is part of the third party jar file is called.

Can you give me any suggestions. What makes it go wrong in case of websphere application server?
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

This is a classloading issue.

There must be multiple versions of the given class on the classpath. A classloader is loading an older or newer version that doesn't have your particular method coded in it.

You might have success my chancing the classloader settings from Parent_first to Parent_Last.

Here's a little tutorial on WebSphere classloading, and how you can configure the various EAR and WAR classloaders. It may also help explain why you are getting the MethodNotFoundException.

WebSphere and J2EE Classloaders Demystified and Explained

Classloader issues are frustrating. I hope you get this solved.

-Cameron McKenzie
NareshAnkuskani Kumar
Ranch Hand

Joined: Sep 15, 2005
Posts: 76
Hi Cameron McKenzie,

Thanks a lot for your valuable input and advice.

Regards,
Naresh.
Jayadev Pulaparty
Ranch Hand

Joined: Mar 25, 2002
Posts: 662
Info provided in the WAS links are some best practices of making all the dependent jars for the webapp available in the WEB-INF/lib folder and making the web classloader policy as PARENT_LAST. This will make your app truly portable across different appservers as you are no longer depending on the runtime for your app-specific needs.

There is much to this. When you compile your classes in your dev environment using 3rd party jars, previously there was no way of mentioning your dependencies, i.e., 1.2 version of commons-logging.jar. Recently, folks came out with a way of doing this in the manifest file. I think you should then write some small script bundled with your app that tests for the required versions of dependent runtime and stops the app from even starting [much better than having a mis-behaving app].
[ June 01, 2008: Message edited by: Jayadev Pulaparty ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with websphere server regarding java.lang.NoSuchMethodError