Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Deploy time exception - Key Attribute required for element exception

 
Parameswaran Thangavel
Ranch Hand
Posts: 485
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
i am getting the following exceptions when i deployed my struts application

1) java.lang.NoClassDefFoundError:
org/apache/commons/collections/FastHashMap$KeySet

2) org.xml.sax.SAXParseException:
Attribute "key" is required and must be specified for element type "exception".
--- Is the key attribute requried? i informed it is optional.

Any idea why?
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This error would occur if the commons-collections.jar is not in your WEB-INF/lib directory. Make sure that this jar file as well as all other jar files that came with the Struts download are in your WEB-INF/lib directory.
 
Parameswaran Thangavel
Ranch Hand
Posts: 485
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
I downloaded struts from apache. but the zip file i downloaded doesn't contains the jar file mentioned by you.

So it would be helpful if you can mention me the link or location where i can find out all the commons-* .jar files (as a bunch), needed for the struts application.

And also i wonder why particular commons=*.jar files are missed in latest version of struts. The latest version i downloaded is 1.2.9. (struts-1.2.9-bin.zip)
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, commons-collectins.jar is from an earlier version. If you're using the latest version, the jar file containing the class reported in the error is commons-beanutils.jar.

Another thing that could cause the problem you reported is using a struts.jar file that is from a different version than the commons-xxx.jar files. Make sure they all come from the same download.

I would suggest you re-download the file from here. When you unzip the file, there will be a lib directory. Copy all the jar files in the lib directory to your WEB-INF/lib directory. There will be eight of them:
antlr.jar
commons-beanutils.jar
commons-digester.jar
commons-fileupload.jar
commons-logging.jar
commons-validator.jar
jakarta-oro.jar
struts.jar

An even better way to make sure you have everything you need is to find the struts-blank.war file in the webapps directory, unpack it, and use it as a template for your application.
 
Parameswaran Thangavel
Ranch Hand
Posts: 485
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi i copied all the jar files from the location mentioned by you.

but the problem is i am getting the below error.

Parsing of JSP File '/reprocessCriteria.jsp' failed:
--------------------------------------------------------------------------------
/reprocessCriteria.jsp(2): Error in using tag library uri='/WEB-INF/tlds/struts-html.tld' prefix='html': The Tag class 'org.apache.struts.taglib.html.FormTag' has no setter method corresponding to TLD declared attribute 'name', (JSP 1.1 spec, 5.4.1)
probably occurred due to an error in /reprocessCriteria.jsp line 2:
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>

i doubt after copying the latest jar files, the tld is in mismatch can you tell me whats the problem and how to fix it.?
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suspect the problem is with your <html:form> tag. In Struts 1.2.9, the name and type attributes of this tag are deprecated. All you need to specify now is "action". You are probably looking at tutorials or instructions that tell you to define a name and type attribute for the <html:form> tag. These were created for earlier versions of Struts. Just remove the name and type attributes and it should work.
[ July 22, 2006: Message edited by: Merrill Higginson ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic