Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Error creating form bean of class Problem  RSS feed

 
Harry Tiu
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im encountering this problem in struts for several days

18:47:21,954 ERROR [RequestUtils] Error creating form bean of class com.xcare.meta.web.DatabaseForm
java.lang.NoClassDefFoundError: org/apache/struts/action/ActionForm

My struts-config.xml contains:


My DatabaseForm.java contains:


My DatabaseAction.java contains:



What should I do to fix this?
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The important part of this error message is:

java.lang.NoClassDefFoundError: org/apache/struts/action/ActionForm

Here are some possible causes of this error:

1- Check to make sure struts.jar is in your WEB-INF/lib directory
2- Check to make sure that the commons-xxx.jar files and the struts.jar file are for the same version of struts, meaning that they all came from the same struts download package.
3- Make sure that there is not another struts.jar or one of the commons-xxx.jar files being loaded by another Class Loader. This could happen if there's a copy of one of these jar files in some common area used by your App Server.
 
Harry Tiu
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here are some possible causes of this error:

1- Check to make sure struts.jar is in your WEB-INF/lib directory [check!]

2- Check to make sure that the commons-xxx.jar files and the struts.jar
file are for the same version of struts, meaning that they all came
from the same struts download package. [check!]

3- Make sure that there is not another struts.jar or one of the commons-xxx.jar
files being loaded by another Class Loader. This could happen if there's a copy
of one of these jar files in some common area used by your App Server. [check!]

>> But Im still encountering the same error. Actually I removed struts.jar in WEB-INF/lib
then I encountered java.lang.ClassNotFoundException: org.apache.struts.action.ActionServlet
that means my app is only looking at one struts.jar and it is in WEB-INF/lib.

Before I only encountered this:
ERROR [RequestUtils] Error creating form bean of class com.xcare.meta.web.DatabaseAction
java.lang.NoClassDefFoundError: org/apache/struts/action/Action

DatabaseAction extends Action. I found out that my DatabaseAction and other relevant classes were not copied in its package jar file.
After fixing it, I now have two errors:

[RequestUtils] Error creating form bean of class com.xcare.meta.web.DatabaseForm
java.lang.NoClassDefFoundError: org/apache/struts/action/ActionForm

and

ERROR [RequestProcessor] No action instance for path /meta/search could be created
java.lang.NoClassDefFoundError: org/apache/struts/action/Action


Please help

[ June 21, 2006: Message edited by: Harry Tiu ]
[ June 21, 2006: Message edited by: Harry Tiu ]
 
Harry Tiu
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've found the problem and was able to fix it.

The cause of the problem was that I was duplicatedly deploying my classes (DatabaseAction, DatabaseForm) to different jar files that is causing the NoClassDefFound Exception. This is actually fixed in my build.xml.

Thanks Merrill Higginson!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!