Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.lang.NoClassDefFoundError: initialization failure

 
Ganesh Sundaresan
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Mohamed Inayath
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this "com.xxxx.exxx.web.action.homepage.HomepageAction" available in the EAR?

Please verify once.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ganesh Sundaresan
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21133
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply Paul. Any idea why initialization failure occurs?
 
Paul Clapham
Sheriff
Posts: 21133
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Kunal Teckchandani
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic