aspose file tools*
The moose likes Struts and the fly likes Configuring First Struts Application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Configuring First Struts Application" Watch "Configuring First Struts Application" New topic
Author

Configuring First Struts Application

C Kushtawar
Ranch Hand

Joined: Jan 20, 2009
Posts: 37

Hi Everyone,

I am configuring my first struts application using struts-1.3.10 and jakarta-tomcat-5.0.28.
I am using the "MiniHR" example from the book Struts_The_Complete_Reference.I have done exactly the same thing as written in the example.
I compiled the application successfully and then created a war file and then placed under webapps directory of tomcat.Still when accessing the application,I get the following error:

[Error]

HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

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

exception

javax.servlet.ServletException: javax/servlet/jsp/tagext/TagExtraInfo
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:244)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/TagExtraInfo
java.lang.ClassLoader.defineClass1(Native Method)
java.lang.ClassLoader.defineClass(ClassLoader.java:621)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
java.net.URLClassLoader.access$000(URLClassLoader.java:56)
java.net.URLClassLoader$1.run(URLClassLoader.java:195)
java.security.AccessController.doPrivileged(Native Method)
java.net.URLClassLoader.findClass(URLClassLoader.java:188)
sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
java.lang.ClassLoader.loadClass(ClassLoader.java:307)
java.lang.ClassLoader.loadClass(ClassLoader.java:300)
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
java.lang.ClassLoader.loadClass(ClassLoader.java:252)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1255)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189)
org.apache.jasper.compiler.TagLibraryInfoImpl.createTagInfo(TagLibraryInfoImpl.java:419)
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:470)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
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:802)



[/Error]


Please help me how to get over it.I am still to create my first struts webapplication.
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9313
    
  17

java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/TagExtraInfo

the javax.servlet.jsp.tagext.TagExtraInfo is a JSTL class. You'll need to add JSTL jars into your application. Look at this tutorial to know how to do it...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
C Kushtawar
Ranch Hand

Joined: Jan 20, 2009
Posts: 37
Hi Ankit,

I have downloaded javax.servlet-5.1.11.jar for this and put under the Tomcat/Webapps/lib directory.Still I am getting this error.
What else should I do?Any help would be appreciated.

Regards,
Chandan
Lorand Komaromi
Ranch Hand

Joined: Oct 08, 2009
Posts: 276
C Kushtawar wrote:
I have downloaded javax.servlet-5.1.11.jar for this and put under the Tomcat/Webapps/lib directory.Still I am getting this error.


Have you checked Ankit's link..? A quote from the tutorial:

To use JSTL, you must install JSTL into Tomcat. JSTL can be obtained from the same source as Tomcat. The main URL for JSTL is http://java.sun.com/products/jsp/jstl/. To use JSTL, you must unzip the distribution files and install them into the correct locations within Tomcat.


OCJP 6 (93%)
C Kushtawar
Ranch Hand

Joined: Jan 20, 2009
Posts: 37
Hi,

I am able to get over this problem thanks to you guys but I am now encounering a new exception:

[Error]

type Exception report

message

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

exception

org.apache.jasper.JasperException: Module 'null' not found.
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
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:689)


root cause

java.lang.NullPointerException: Module 'null' not found.
org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:755)
org.apache.struts.taglib.TagUtils.computeURLWithCharEncoding(TagUtils.java:364)
org.apache.struts.taglib.TagUtils.computeURLWithCharEncoding(TagUtils.java:285)
org.apache.struts.taglib.html.LinkTag.calculateURL(LinkTag.java:445)
org.apache.struts.taglib.html.LinkTag.doEndTag(LinkTag.java:353)
org.apache.jsp.index_jsp._jspx_meth_html_link_0(index_jsp.java:113)
org.apache.jsp.index_jsp._jspService(index_jsp.java:70)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
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:689)



[/Error]


Below is my web.xml and struts-config.xml for your reference:Please help me.

########################################################################################

<?xml version="1.0"?>

<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

<!-- Action Servlet Configuration -->
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

<!-- Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

<!-- The Welcome File List -->
<welcome-file-list>
<welcome-file>/index.jsp</welcome-file>
</welcome-file-list>

<!-- Struts Tag Library Descriptors -->
<taglib>
<taglib-uri>/WEB-INF/tlds/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/tlds/struts-bean.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/tlds/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/tlds/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/tlds/struts-logic.tld</taglib-uri>
<taglib-location>/WEB-INF/tlds/struts-logic.tld</taglib-location>
</taglib>

</web-app>

######################################################################################
<?xml version="1.0"?>

<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">

<struts-config>

<!-- Form Beans Configuration -->
<form-beans>
<form-bean name="searchForm"
type="com.jamesholmes.minihr.SearchForm"/>
</form-beans>

<!-- Global Forwards Configuration -->
<global-forwards>
<forward name="search" path="/search.jsp"/>
</global-forwards>

<!-- Action Mappings Configuration -->
<action-mappings>
<action path="/search"
type="com.jamesholmes.minihr.SearchAction"
name="searchForm"
scope="request"
validate="true"
input="/search.jsp">
</action>
</action-mappings>

<!-- Message Resources Configuration -->
<message-resources
parameter="com.jamesholmes.minihr.ApplicationResources"/>

</struts-config>





















C Kushtawar
Ranch Hand

Joined: Jan 20, 2009
Posts: 37
Hi Guys,

Any idea on this?Will be thankful to you all.

Regards,
Chandan
C Kushtawar
Ranch Hand

Joined: Jan 20, 2009
Posts: 37
I have zeroed on this :


In index.jsp when I inlude the below line html:link only then the NPE Exception is thrown.Please suggest where should I look into for correcting this?

<%@ taglib uri="WEB-INF/tlds/struts-html.tld" prefix="html" %>

<html>
<head>
<title>ABC, Inc. Human Resources Portal</title>
</head>
<body>

<font size="+1">ABC, Inc. Human Resources Portal</font><br>
<hr width="100%" noshade="true">

• Add an Employee<br>
• <html:link forward="search">Search for Employees</html:link><br>
</body>
</html>






Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9313
    
  17

Please Use Code Tags when you post a source code. Non-formatted code is very hard to read. You can edit your message using button and then add code tags to it.

You earlier said that there was a "Module 'null' not found" and now you are saying about NullPointerException. This is a bit confusing. Read this to know about the html:link tag. I'm not good at struts 1.x, but I think you should use searchForm instead of search as the value of forward attribute of html:link tag...
C Kushtawar
Ranch Hand

Joined: Jan 20, 2009
Posts: 37
Hi Ankit,

Module "Null" and "NPE" are part of the same exception.I am pasting all the dumps all over again in the correct format.Also I tried SearchForm but that also did not work.Can some body please help me?

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++







++++++++++++++++web.xml++++++++++++++++++++++++++++++++++++++++++++++







++++++++++++++++++++++++++++++++struts-config.xml+++++++++++++++++++++++



+++++++++++++++++++++++++++++++++++++++++











 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Configuring First Struts Application