This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Websphere and the fly likes java.lang.NoClassDefFoundError: initialization failure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "java.lang.NoClassDefFoundError: initialization failure" Watch "java.lang.NoClassDefFoundError: initialization failure" New topic
Author

java.lang.NoClassDefFoundError: initialization failure

Ganesh Sundaresan
Ranch Hand

Joined: Feb 09, 2006
Posts: 36
Hi,

I am currently migrating websphere App server from 5.1 to 6.1.


After the successful deployment of the application ear I am getting the following exception:

java.lang.NoClassDefFoundError: com.xxxx.exxx.web.action.homepage.HomepageAction (initialization failure)

at java.lang.J9VMInternals.initialize(J9VMInternals.java:132)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1328)
at org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.java:145)
at org.apache.struts.action.RequestProcessor.processActionCreate(RequestProcessor.java:282)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:220)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1102)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1037)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:118)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:832)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:679)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:566)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:321)
at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:518)
at com.ibm._jsp._index._jspService(_index.java:64)
at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:87)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1102)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1037)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:118)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:832)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:679)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:566)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:122)
at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:226)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:321)
at com.ibm.ws.webcontainer.servlet.FilterProxyServlet.dispatch(FilterProxyServlet.java:78)
at com.ibm.ws.webcontainer.servlet.FilterProxyServlet.service(FilterProxyServlet.java:57)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1102)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1037)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:118)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:832)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:742)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:695)
at com.ibm.ws.wswebcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:101)
at com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.invokeFilters(DefaultExtensionProcessor.java:833)
at com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:560)
at com.ibm.ws.wswebcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:113)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3444)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:267)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:815)
at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1466)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:119)


My classpath has the following entries

Classpath =
/opt/was61/AppServer/profiles/AppSrv01/properties:
/opt/was61/AppServer/lib/startup.jar:
/opt/was61/AppServer/deploytool/itp/batchboot.jar:
/opt/was61/AppServer/deploytool/itp/batch2.jar:
/opt/was61/AppServer/java/lib/tools.jar:
/opt/was61/AppServer/properties:
/opt/was61/AppServer/lib/bootstrap.jar:
/opt/was61/AppServer/lib/j2ee.jar:
/opt/was61/AppServer/lib/lmproxy.jar:
/opt/was61/AppServer/lib/urlprotocols.jar:

Can anyone please help me in resolving this issue? Should we give the aplication ear file also in the classpath?

Regards,
Ganesh


Thanks, Ganesh
SJCP (95%), SCWCD (75%), SCDJWS (Planning to take....)
Mohamed Inayath
Ranch Hand

Joined: Nov 22, 2004
Posts: 124
Is this "com.xxxx.exxx.web.action.homepage.HomepageAction" available in the EAR?

Please verify once.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41626
    
  55
Is the missing class available in one of these jar files? The class/package name actually sounds as if it should be in WEB-INF/lib or WEB-INF/classes, not in the app server classpath.


Ping & DNS - my free Android networking tools app
Ganesh Sundaresan
Ranch Hand

Joined: Feb 09, 2006
Posts: 36
yes "com.xxxx.exxx.web.action.homepage.HomepageAction" is available in the application ear under a warfile/WEB-INF/classes

and I can see the application in websphere admin console
Ganesh Sundaresan
Ranch Hand

Joined: Feb 09, 2006
Posts: 36
I am also getting the following exception


0000001d WebExtensionP E Error occured while preparing the servlet for initialization.
javax.servlet.ServletException: SRVE0207E: Uncaught initialization exception thrown by servlet
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:271)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.init(ServletWrapper.java:319)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.initialize(ServletWrapper.java:1251)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.initialize(ServletWrapper.java:152)
at com.ibm.wsspi.webcontainer.extension.WebExtensionProcessor.createServletWrapper(WebExtensionProcessor.java:99)
Mohamed Inayath
Ranch Hand

Joined: Nov 22, 2004
Posts: 124
I believe its a Struts application.

Could you confirm whether the struts-config.xml holds correct entry of the the action class.
I mean with right package definition.

Ganesh Sundaresan
Ranch Hand

Joined: Feb 09, 2006
Posts: 36
yes it is Struts application

and struts-config.xml has proper entries

Should the application ear be also in the classpath?
Mohamed Inayath
Ranch Hand

Joined: Nov 22, 2004
Posts: 124
Ganesh Sundaresan wrote:
Should the application ear be also in the classpath?



No way.
It shouldn't be in the classpath.

Ganesh Sundaresan
Ranch Hand

Joined: Feb 09, 2006
Posts: 36
the ear file is not in the classpath..any other reason why it is not able to find the class?

1. I have chekced the class exixts in the correct package
2. JAVA_HOME is set
3. tools.jar is in the classpath
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Who says the class is missing? All the error messages suggest that there is an initialization failure when trying to load the class. If that's the case, you should be able to find the stack trace in your Websphere logs.

And regarding the classpath: don't touch Websphere's classpath. Just install your application in the normal way and let Websphere run it in the normal way. You shouldn't have to concern yourself with low-level details like the classpath, ever, with Websphere.
Ganesh Sundaresan
Ranch Hand

Joined: Feb 09, 2006
Posts: 36
Thanks for your reply Paul. Any idea why initialization failure occurs?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Usually it's because there is some code which is run when the class is initialized, and it fails at that time.
Ola Daniel
Ranch Hand

Joined: Jul 27, 2005
Posts: 105
Hi all,

i am getting this same error that the author of this thread had. Any idea how to resolve the issue.

Same problem.

Help.

Thanks.
Ola


SCJP 1.4, SCWCD 1.4
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
- Martin Fowler et al, Refactoring: Improving the Design of Existing Code, 1999
Kunal Teckchandani
Greenhorn

Joined: Apr 26, 2011
Posts: 1
Its almost a year now since this issue was posted here on this forum. Hope this helps any user like me who come across this exception. So as Paul suggested that the issue is not the ClassDefNotFound Error from the WebSphere logs I saw the exception "java.util.MissingResourceException" and found that I was missing a resource bundle entry in the Constants properties file. Once I updated the file, restarted the app server it was all working fine.

Hope this helps.

Cheers,
Kunal
Ramesh Sunkara
Ranch Hand

Joined: Mar 01, 2010
Posts: 78
It can also because of failure in class initialization.

Check whether there are nay static blocks in that class and verify whether that code in static block runs.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.lang.NoClassDefFoundError: initialization failure