permaculture playing cards*
The moose likes Struts and the fly likes NoSuchMethodError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "NoSuchMethodError " Watch "NoSuchMethodError " New topic
Author

NoSuchMethodError

Radhika Reddy
Ranch Hand

Joined: Oct 31, 2002
Posts: 30
I am getting following exception when I use struts html,logic ,bean tags on jsp page. This error is occuring only on Tomcat 5.0.25 running on Solaris 5.8 machine. It works fine on Linux running tomcat 5.x and also on windows running tomcat 5.x. problem is only on Solaris machine tomcat server.
I will appreciate if you let know what its missing on Solaris machine or in code ?

java.lang.NoSuchMethodError: javax.servlet.jsp.tagext.TagAttributeInfo.<init>(Ljava/lang/String;ZLjava/lang/String;ZZ)V
org.apache.jasper.compiler.TagLibraryInfoImpl.createAttribute(TagLibraryInfoImpl.java:568)
org.apache.jasper.compiler.TagLibraryInfoImpl.createTagInfo(TagLibraryInfoImpl.java:401)
org.apache.jasper.compiler.TagLibraryInfoImpl.parseTLD(TagLibraryInfoImpl.java:248)
org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:162)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:418)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:483)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1539)
org.apache.jasper.compiler.Parser.parse(Parser.java:126)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:220)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:101)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:203)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:461)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:442)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:430)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:274)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.25 logs.

Regards,
Radhika
[ September 13, 2004: Message edited by: Bear Bibeault ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60822
    
  65

Moving to the Web Frameworks forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Sheldon Fernandes
Ranch Hand

Joined: Aug 18, 2004
Posts: 157
From the stack trace, it appears that the 5 argument constructor for TagAttributeInfo is missing. This should not happen since Tomcat 5.x implements the JavaServer Pages 2.0 specifications (the 5 argument constructor was added in JSP 2.0).

Looks like an environment related issue. You can check to see if maybe an older version of the jar containing the JSP APIs is present somewhere in your classpath. Check in common/lib, or in your webapp if you have accidentally packaged an older version. This error could happen if that jar was being picked up first.

"jsp-api.jar" is the jar file that contains the TagAttributeInfo class. Check if it has a 5 argument constructor
TagAttributeInfo(java.lang.String name, boolean required, java.lang.String type, boolean reqTime, boolean fragment)

I may be way off target here. But this is what came to my mind. Hope it helps.

Sheldon
Radhika Reddy
Ranch Hand

Joined: Oct 31, 2002
Posts: 30
Thanks for your help. Let me make sure that and see how it goes..


Regards,
Radhika
Radhika Reddy
Ranch Hand

Joined: Oct 31, 2002
Posts: 30
Hi Sheldon,

I did checked the jsp-api.jar located in tomcat/common/lib folder. it has TagAttributeInfo with 2 constructors one with 4 parameters and another with 5 parameters which looks good. But still the same issue. I tried to use little latest jsp-api.jar from tomcat version 5.0.27 and added it in webapps/rads/WEB-INF/lib (rads is my app) but still the same error If I use struts html,bean,logic tags.

Regards,
Radhika
Sheldon Fernandes
Ranch Hand

Joined: Aug 18, 2004
Posts: 157
I was not suggesting adding the 'jsp-api.jar' to your application lib. Please do not do this.

From the error it appears that an older version of the class file javax.servlet.jsp.tagext.TagAttributeInfo is present somewhere in the class path and it is being loaded before the class present in 'jsp-api.jar'.

I do not think it has anything to do with the jars packaged as part of your application, as the application runs fine in the other environments. So it must be an environment related issue. In any case, remove unnecessary jars from your lib folder.

I can suggest the following:
- Search for other jars which contain the class 'TagAttributeInfo', that might have been inadvertently placed in tomcat's class path.
- Compare your different tomcat environments.

Sheldon
Sheldon Fernandes
Ranch Hand

Joined: Aug 18, 2004
Posts: 157
I did a search using google and found that quite a few people have reported this problem.

In one of the cases, the error was due to copying an old servlet.jar file in the lib folder of the Tomcat installation.

Do a search using google for javax.servlet.jsp.tagext.TagAttributeInfo.<init>(Ljava/lang/String;ZLjava/lang/String;ZZ)V.

Sheldon
Radhika Reddy
Ranch Hand

Joined: Oct 31, 2002
Posts: 30
Hi Sheldon,

Finally I am able to make my application work smoothly on Tomcat running on Solaris. The problem was as you said some other application running on same server added servlet.jar (which has jsp1.1) in their WEB-INF/lib folder. I removed it and its working fine. Thanks alot for your help. I added jsp-api.jar in my lib as trial and error. I removed that too.

Thanks again
Radhika
Sheldon Fernandes
Ranch Hand

Joined: Aug 18, 2004
Posts: 157
Your welcome, glad I could help.

Sheldon
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NoSuchMethodError
 
Similar Threads
JSTL error
Error in deploying sample application
I am getting this exception
New to JBoss -- NoSuchMethodError
getting java.lang.NoSuchMethodError when attempting to run strut eg