aspose file tools*
The moose likes Struts and the fly likes Error creating form bean of class Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Error creating form bean of class Problem " Watch "Error creating form bean of class Problem " New topic
Author

Error creating form bean of class Problem

Harry Tiu
Greenhorn

Joined: Jun 21, 2006
Posts: 3
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

Joined: Feb 15, 2005
Posts: 4864
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.


Merrill
Consultant, Sima Solutions
Harry Tiu
Greenhorn

Joined: Jun 21, 2006
Posts: 3
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

Joined: Jun 21, 2006
Posts: 3
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.
 
subject: Error creating form bean of class Problem