Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NoSuchMethodError

 
Radhika Reddy
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64827
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to the Web Frameworks forum.
 
Sheldon Fernandes
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your help. Let me make sure that and see how it goes..


Regards,
Radhika
 
Radhika Reddy
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your welcome, glad I could help.

Sheldon
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic