wood burning stoves 2.0*
The moose likes Struts and the fly likes Struts Help for JBoss Eclipse IDE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Help for JBoss Eclipse IDE" Watch "Struts Help for JBoss Eclipse IDE" New topic
Author

Struts Help for JBoss Eclipse IDE

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9350
    
    2

Guys,

I have been using netBeans for quite a long time and recently I started using Eclipse and I'm using JBoss Eclipse IDE and I wanted to know how to make a Struts app running. Here is what I did. Created a new Dynamic web project, added the necessary files for Struts. Created a welcome.jsp page and when I tried to run the application, I'm getting the following error message,

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: Cannot create rewrite URL: java.net.MalformedURLException: Cannot retrieve ActionForward named logon
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.welcome_jsp._jspService(welcome_jsp.java:113)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
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:802)


root cause

javax.servlet.jsp.JspException: Cannot create rewrite URL: java.net.MalformedURLException: Cannot retrieve ActionForward named logon
org.apache.struts.taglib.html.LinkTag.calculateURL(LinkTag.java:450)
org.apache.struts.taglib.html.LinkTag.doEndTag(LinkTag.java:353)
org.apache.jsp.welcome_jsp._jspx_meth_html_link_0(welcome_jsp.java:246)
org.apache.jsp.welcome_jsp._jspService(welcome_jsp.java:98)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
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:802)


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


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

Apache Tomcat/5.0.28

Here is my struts-config.xml file,

<?xml version="1.0" encoding="UTF-8" ?>

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


<struts-config>
<form-beans>

</form-beans>

<global-exceptions>

</global-exceptions>

<global-forwards>
<forward name="welcome" path="/Welcome.do"/>
</global-forwards>

<action-mappings>
<action path="/Welcome" forward="/welcomeStruts.jsp"/>
</action-mappings>

<controller processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>

<!-- <message-resources parameter="com/myapp/struts/ApplicationResource"/> -->

<!-- ========================= Tiles plugin ===============================-->
<!--
This plugin initialize Tiles definition factory. This later can takes some
parameters explained here after. The plugin first read parameters from
web.xml, thenoverload them with parameters defined here. All parameters
are optional.
The plugin should be declared in each struts-config file.
- definitions-config: (optional)
Specify configuration file names. There can be several comma
separated file names (default: ?? )
- moduleAware: (optional - struts1.1)
Specify if the Tiles definition factory is module aware. If true
(default), there will be one factory for each Struts module.
If false, there will be one common factory for all module. In this
later case, it is still needed to declare one plugin per module.
The factory will be initialized with parameters found in the first
initialized plugin (generally the one associated with the default
module).
true : One factory per module. (default)
false : one single shared factory for all modules
- definitions-parser-validate: (optional)
Specify if xml parser should validate the Tiles configuration file.
true : validate. DTD should be specified in file header (default)
false : no validation

Paths found in Tiles definitions are relative to the main context.
-->

<!-- ========================= Validator plugin ================================= -->

</struts-config>

My Web.xml file,

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>
ExampleStruts</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<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>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

</web-app>

Both of the above two files are in the WEB-INF folder. Why is that I'm getting this error?? Please help guys!


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Nick Williamson
Ranch Hand

Joined: Jan 06, 2007
Posts: 73
check your jsp for a link that looks like this:

<html:rewrite action="/logon"/> or something like that.

Your error messages tell you what's wrong. Your error has nothing to do with eclipse or netbeans or the ide you're using, it's your code.

I'm guessing your welcome jsp page has a link to logon action that doesn't exist.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9350
    
    2

Nick, I got that verified. Thanks for the help!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts Help for JBoss Eclipse IDE