aspose file tools*
The moose likes Struts and the fly likes Showing not able to find FormTag .please help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Showing not able to find FormTag .please help" Watch "Showing not able to find FormTag .please help" New topic
Author

Showing not able to find FormTag .please help

vinkee kaul
Greenhorn

Joined: May 19, 2009
Posts: 6
i am using MyEclipse 5.1.0GA
Struts1.1
Tomcat 5.5

i made a small struts file in myeclipse
when i deploy and run my jsp

submit.jsp



I get this error

javax.servlet.ServletException: java.lang.NoClassDefFoundError: Could not initialize class org.apache.struts.taglib.html.FormTag

though i checked in window-->preferences-->ProjectCapabilities-->Struts-->struts1.1-->I can see all jar files
i also extracted struts.jar and checked to find form tag available there
I guess its no able to read my tlds
what to do

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Exception in JSP: /submit.jsp:13

10: <h3>Example Submit Page</h3>
11:
12:
13: <html:form action="/submit">
14: Last Name: <html:text property="lastName"/><br>
15: Address: <html:textarea property="address"/><br>
16: Sex: <html:radio property="sex" value="M"/>Male


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


root cause

javax.servlet.ServletException: java.lang.NoClassDefFoundError: Could not initialize class org.apache.struts.taglib.html.FormTag
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
org.apache.jsp.submit_jsp._jspService(submit_jsp.java:116)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


root cause

java.lang.NoClassDefFoundError: Could not initialize class org.apache.struts.taglib.html.FormTag
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
java.lang.reflect.Constructor.newInstance(Constructor.java:513)
java.lang.Class.newInstance0(Class.java:355)
java.lang.Class.newInstance(Class.java:308)
org.apache.jasper.runtime.TagHandlerPool.get(TagHandlerPool.java:117)
org.apache.jsp.submit_jsp._jspx_meth_html_005fform_005f0(submit_jsp.java:128)
org.apache.jsp.submit_jsp._jspService(submit_jsp.java:101)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


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


David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

My first assumption would be a deploy error.
vinkee kaul
Greenhorn

Joined: May 19, 2009
Posts: 6
David Newton wrote:My first assumption would be a deploy error.


I don't think so
as a simple file of JSP and servlet is working with same myeclipse and tomcat ..i was able to deploy it and run fine

even when i use simple html tags it gives error in line where logic tag is used
meaning it is not able to read tlds..

any idea why this issue?


..when all the jar files and tlds are present in there respective location
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9293
    
  17

Well I don't know much about custom tags, so I don't know if this is mandatory, but I have always seen the tld files in tlds folder in web-inf. That may be the cause but I could be wrong. Also please go through this article to see if you are doing something wrong while using the taglib directive (I hope the required struts jars are in the web-inf/lib folder)...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

It means Tomcat can't find the class--it's going to be pretty difficult to help beyond that.

Have you absolutely verified that the jar files are in the *deploy location*'s lib directory?

@Ankit: Extracting the TLD files hasn't been necessary for quite some time.
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9293
    
  17

David Newton wrote:@Ankit: Extracting the TLD files hasn't been necessary for quite some time.


You mean to say that tlds can be kept inside jars or something else?? I was talking about the path given to the tlds in her code



What I think is that tomcat will look for these tlds in WEB-INF directory of the web application. But I may be wrong...
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Yes, using an absolute path will look for TLDs in that directory. In order for that to work the TLD files must actually be on the filepath. This isn't necessary.
vinkee kaul
Greenhorn

Joined: May 19, 2009
Posts: 6
Ankit Garg wrote:
David Newton wrote:@Ankit: Extracting the TLD files hasn't been necessary for quite some time.


You mean to say that tlds can be kept inside jars or something else?? I was talking about the path given to the tlds in her code



What I think is that tomcat will look for these tlds in WEB-INF directory of the web application. But I may be wrong...


hi guys

C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\Submit\WEB-INF\lib
this link contains all the jar files for my project
commons-beanutils.jar
commons-collections.jar
commons-digester.jar
commons-fileupload.jar
commons-lang.jar
commons-validator.jar
jakarta-oro.jar
struts.jar
struts-legacy.jar


C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\Submit\WEB-INF
this link contains all the tlds and xmls
struts-beans.tld
strut-config.xml
struts-html.tld
struts-logic.tld
struts-nested.tld
struts-template.tld
struts-tiles.tld
tiles-def.xml
validator-rules
web.xml

i think this where they shud be . am I rite ?
these files are loaded up by myeclipse only when you click on struts capababilities
i even tried copying the jar files and tlds of working example(which was running fine in my institute directly on a server)in to my project but its is not just understanding at run time

when i am making my jsp page and declare taglib uri on top
and start using html:text or html:form etc
myEclipse does prompt me with options of all possible html:*
it looks fine in design view as well

then why doesn't it understand at runtime

i just can't get it :argh:

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Are there any further log messages in the Tomcat log?

It's been nearly seven years since I've used S1.1 so I don't really remember much about it, but everything *seems* okay at first glance.
vinkee kaul
Greenhorn

Joined: May 19, 2009
Posts: 6
David Newton wrote:Are there any further log messages in the Tomcat log?

It's been nearly seven years since I've used S1.1 so I don't really remember much about it, but everything *seems* okay at first glance.


INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Apache Software Foundation\Tomcat 5.5\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Alias\Maya8.0\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Intel\Wireless\Bin\;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;C:\Program Files\Common Files\Teleca Shared;;C:\Program Files\QuickTime\QTSystem\



this is first few lines of a huge logfile just few mins back generated ..
when i was trying to start tomcat server independently so that i cud try running the project directly
I failed to do it

most of the log files were blank

david my intention is to make a web project at home in struts using tomcat 5.5
now as myeclipse having these issues should i use netbeans ..
or what do you suggest I should do..i am stuck on this for more than a week now
my institute sir has also put his head in to it ..we can't find whats wrong

what do you suggest ?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

If nothing else I'd suggest not using such an old version of Struts, unless you have a compelling reason to do so.

Without being able to sit down and actually see what's going on there's not much more I can suggest, although maybe somebody else has an idea. There's either a deploy issue, a missing dependency, or *something* that's making it unable to load that class--other than that I don't really know.

If you can host a WAR file of the failing application somewhere if I have a chance I'll look at it later.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Showing not able to find FormTag .please help