• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Problem in Struts of java.lang.NoClassDefFoundError

 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am getting an error when i am deploying an struts app
i hav struts2.0 jar and xwork jar in lib folder but still getting an error

java.lang.NoClassDefFoundError: Could not initialize class org.apache.struts2.dispatcher.Dispatcher
at org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java:58)
at org.apache.struts2.views.jsp.StrutsBodyTagSupport.getStack(StrutsBodyTagSupport.java:44)
at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:48)
at jsp_servlet.__index._jsp__tag0(__index.java:108)
at jsp_servlet.__index._jspService(__index.java:80)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3495)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
 
Bartender
Posts: 9587
13
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Struts has a lot more dependencies than just the struts and xwork jar files. Download the latest version of struts (2.3.15.1), look under the apps directory and extract the blank.war file. That's a good starting point for a new project, but what you are interested in is the contents of the web/WEB-INF/lib directory, as those are the dependencies for Struts.
 
Neeraj jain
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but will you please tell me why i am getting this error what actually i have to add in it
 
Joe Ess
Bartender
Posts: 9587
13
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are getting the error because you have not included a JAR file that Struts depends on. I have told you a quick solution to fix the problem. Debugging dependencies is tedious and you are using a very old version of Struts so I think it is easier to upgrade and fix the dependencies with one simple solution.
 
Neeraj jain
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have included
xwork
struts2-core
struts2-convention
spring-test
ognl
junit
freemaker
commons-logging
commnons-io
commons-fileupload

 
Ranch Hand
Posts: 138
Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This class is included in struts2-core-*.jar.
As Joe mentioned, download Struts 2 and you will get all the required libraries.
 
Neeraj jain
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As you have said i included the struts2-core 2.1.2,jar the i was getting the error of logger missing so i included the xwork.jar but now i am getting the error

java.lang.NoClassDefFoundError: Could not initialize class org.apache.struts2.dispatcher.Dispatcher
at org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java:58)
at org.apache.struts2.views.jsp.StrutsBodyTagSupport.getStack(StrutsBodyTagSupport.java:47)
at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:48)
at jsp_servlet.__index._jsp__tag0(__index.java:108)
at jsp_servlet.__index._jspService(__index.java:80)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3495)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)


Now tell me what to do
 
Joe Ess
Bartender
Posts: 9587
13
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Neeraj jain wrote:As you have said i included the struts2-core 2.1.2,jar



Why would you use 2.1.2 when the current version is 2.3.15.1?

Neeraj jain wrote:
Now tell me what to do



Can you show us the entire stack trace?
 
Then YOU must do the pig's work! Read this tiny ad. READ IT!
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!