You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ma...@epamail.epa.gov on 2007/03/06 22:16:38 UTC

Struts configuration error

Hi all

I am configuring a struts enabled web application using ColdFusion MX. 
Please do not ignore this thread as it is ColdFusion, because I feel the 
issue I have is a generic one and could happen in any J2EE servers. I have 
already posted this in ColdFusion forum but I feel the issue has got to do 
with struts. Also please do not suggest alternatives for ColdFusion, 
because that is the only application server we have and I wanted to use 
Struts. I followed this article about Struts on ColdFusion (
http://www.macromedia.com/devnet/mx/coldfusion/articles/struts.html). 

After following all the configuration steps and I tried 
http://localhost:8500/do/welcome, I get "503 null" error. But the CF 
application server is running fine and it displays other pure ColdFusion 
pages.

I am new to struts and I feel that there is a problem in loading the 
ActionServlet. Following the error and configuration information, if you 
need more information please let me know. I would highly appreciate your 
help.

These are the error messages I found in the coldfusion log file:

03/06 12:13:48 error Could not pre-load servlet: action
javax.servlet.UnavailableException
        at 
org.apache.struts.action.ActionServlet.init(ActionServlet.java:399)
        at javax.servlet.GenericServlet.init(GenericServlet.java:258)
        at 
jrun.servlet.WebApplicationService.loadServlet(WebApplicationService.java:1243)
        at 
jrun.servlet.WebApplicationService.preloadServlets(WebApplicationService.java:790)
        at 
jrun.servlet.WebApplicationService.postStart(WebApplicationService.java:297)
        at 
jrun.ea.EnterpriseApplication.start(EnterpriseApplication.java:203)
        at 
jrun.deployment.DeployerService.initModules(DeployerService.java:710)
        at 
jrun.deployment.DeployerService.createWatchedDeployment(DeployerService.java:242)
        at 
jrun.deployment.DeployerService.deploy(DeployerService.java:430)
        at 
jrun.deployment.DeployerService.handleEvent(DeployerService.java:381)
        at 
jrunx.kernel.JRunServiceDeployer.fireEvent(JRunServiceDeployer.java:710)
        at 
jrunx.kernel.JRunServiceDeployer.deployServices(JRunServiceDeployer.java:111)
        at 
jrunx.kernel.DeploymentService.loadServices(DeploymentService.java:46)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at 
com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
        at 
com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
        at jrunx.kernel.JRun.startServer(JRun.java:575)
        at jrunx.kernel.JRun.<init>(JRun.java:493)
        at jrunx.kernel.JRun$1.run(JRun.java:346)
        at java.security.AccessController.doPrivileged(Native Method)
        at jrunx.kernel.JRun.start(JRun.java:343)
        at jrunx.kernel.JRun.startByNTService(JRun.java:427)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at jrunx.kernel.JRun.invoke(JRun.java:180)
        at jrunx.kernel.JRun.main(JRun.java:168)

03/06 12:14:34 error 
javax.servlet.UnavailableException
        at 
org.apache.struts.action.ActionServlet.init(ActionServlet.java:399)
        at javax.servlet.GenericServlet.init(GenericServlet.java:258)
        at 
jrun.servlet.WebApplicationService.loadServlet(WebApplicationService.java:1243)
        at 
jrun.servlet.JRunRequestDispatcher.init(JRunRequestDispatcher.java:748)
        at 
jrun.servlet.JRunRequestDispatcher.<init>(JRunRequestDispatcher.java:98)
        at 
jrun.servlet.WebApplicationService.getDispatcher(WebApplicationService.java:866)
        at 
jrun.servlet.ServletEngineService$1.fetch(ServletEngineService.java:511)
        at jrunx.util.Cache.get(Cache.java:116)
        at 
jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:523)
        at 
jrun.servlet.http.WebService.invokeRunnable(WebService.java:172)
        at 
jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:349)
        at 
jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:457)
        at 
jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:295)
        at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

This is action-mapping excerpt of struts-config.xml:

    <action-mappings>
        <action path="/loginUser"
            type="com.macromedia.article.actions.LoginUserAction"
                name="LoginForm">
            <forward name="success" path="/cfm/welcome.cfm"/>
            <forward name="failure" path="/cfm/login.cfm"/>
        </action>
        <action path="/logoutUser"
            type="com.macromedia.article.actions.LogoutUserAction">
            <forward name="success" path="/cfm/login.cfm"/>
        </action>
        <action path="/welcome" 
                type="org.apache.struts.actions.ForwardAction"
                parameter="/cfm/login.cfm"/>
 
     </action-mappings>

Following is the excerpt included in the web.xml file:
        <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>
                <init-param>
                   <param-name>application</param-name>
                   <param-value>ApplicationResources</param-value>
                </init-param>
                <load-on-startup>2</load-on-startup>
        </servlet>

        <!-- Standard Action Servlet Mapping -->
        <servlet-mapping>
                <servlet-name>action</servlet-name>
                <url-pattern>/do/*</url-pattern>
        </servlet-mapping>
 
        <!-- Struts Tag Library Descriptors -->
        <taglib>
                <taglib-uri>struts-bean</taglib-uri>
 <taglib-location>/WEB-INF/lib/struts-bean.tld</taglib-location>
        </taglib>
 
        <taglib>
                <taglib-uri>struts-html</taglib-uri>
 <taglib-location>/WEB-INF/lib/struts-html.tld</taglib-location>
        </taglib>
 
        <taglib>
                <taglib-uri>struts-logic</taglib-uri>
 <taglib-location>/WEB-INF/lib/struts-logic.tld</taglib-location>
        </taglib>
 
        <taglib>
                <taglib-uri>struts-nested</taglib-uri>
 <taglib-location>/WEB-INF/lib/struts-nested.tld</taglib-location>
        </taglib>


This is how I have configured and I am using ColdFusion MX 7.

1. Downloaded Struts 1.3.5 and placed all the struts jar files in 
[CfusionMX/wwwroot]/WEB-INF/lib folder.
2. Downloaded Tomcat 4.1.34 and placed servlet.jar in 
[CfusionMX/wwwroot]/WEB-INF/lib folder.
3. Downloaded Xalan-j 2.7.0 and placed xalan.jar in 
[CfusionMX/wwwroot]/WEB-INF/lib folder.
4. Downloaded Xerces-j 2.9.0 and placed xercesImpl.jar in 
[CfusionMX/wwwroot]/WEB-INF/lib folder.
5. Placed struts-bean.tld, struts-html.tld, struts-logic.tld, 
struts-nested.tld in [CfusionMX/wwwroot]/WEB-INF/tlds folder.
6. Enabled session variables using J2EE. 
7. Edited web.xml as required.
8. Placed struts-config.xml in [CfusionMX/wwwroot]/WEB-INF folder.
9. Placed *.cfm files in [CfusionMX/wwwroot]/cfm folder.
10. Compiled and jarred the package of all the java classes and placed the 
jar file in [CfusionMX/wwwroot]/WEB-INF/lib folder.
11. Placed accounts.dat in [CfusionMX/wwwroot]/WEB-INF/classes folder.

Am I going wrong anywhere? Please help.

Vignesh Manickam Periaswamy
Web Application Developer Intern, Information Management Section
WPTD,   EPA Region 5         312-886-0887
email: Manickam-Periaswamy.Vignesh@epa.gov

Re: Struts configuration error

Posted by Laurie Harper <la...@holoweb.net>.
I don't know anything about ColdFusion, but here are some things to try:

Manickam-Periaswamy.Vignesh@epamail.epa.gov wrote:
> Hi all
> 
> I am configuring a struts enabled web application using ColdFusion MX. 
> Please do not ignore this thread as it is ColdFusion, because I feel the 
> issue I have is a generic one and could happen in any J2EE servers. I have 
> already posted this in ColdFusion forum but I feel the issue has got to do 
> with struts. Also please do not suggest alternatives for ColdFusion, 
> because that is the only application server we have and I wanted to use 
> Struts. I followed this article about Struts on ColdFusion (
> http://www.macromedia.com/devnet/mx/coldfusion/articles/struts.html). 
> 
> After following all the configuration steps and I tried 
> http://localhost:8500/do/welcome, I get "503 null" error. But the CF 
> application server is running fine and it displays other pure ColdFusion 
> pages.
> 
> I am new to struts and I feel that there is a problem in loading the 
> ActionServlet. Following the error and configuration information, if you 
> need more information please let me know. I would highly appreciate your 
> help.
> 
> These are the error messages I found in the coldfusion log file:

Check you logs again and see if there are 'Root Cause' traces associated 
with those, or any earlier stack traces that may be relevant. There's 
nothing here to indicate why the action servlet is unabailable.

> This is action-mapping excerpt of struts-config.xml:

Shouldn't matter, provided the file is well-formed and valid according 
to the DTD. Try validating it in an XML-aware editor/IDE to make sure.

> Following is the excerpt included in the web.xml file:
>         <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>
>                 <init-param>
>                    <param-name>application</param-name>
>                    <param-value>ApplicationResources</param-value>
>                 </init-param>
>                 <load-on-startup>2</load-on-startup>
>         </servlet>

Most of those init params aren't needed/used with Struts 1.3.5; they 
come from a much older (1.0? 1.1?) version. They shouldn't hurt but, for 
example, the resource bundle configuration will need to be moved into 
your struts-config.xml once you get things up and running.

>         <!-- Standard Action Servlet Mapping -->
>         <servlet-mapping>
>                 <servlet-name>action</servlet-name>
>                 <url-pattern>/do/*</url-pattern>
>         </servlet-mapping>
>  
>         <!-- Struts Tag Library Descriptors -->
>         <taglib>
>                 <taglib-uri>struts-bean</taglib-uri>
>  <taglib-location>/WEB-INF/lib/struts-bean.tld</taglib-location>
>         </taglib>
>  
>         <taglib>
>                 <taglib-uri>struts-html</taglib-uri>
>  <taglib-location>/WEB-INF/lib/struts-html.tld</taglib-location>
>         </taglib>
>  
>         <taglib>
>                 <taglib-uri>struts-logic</taglib-uri>
>  <taglib-location>/WEB-INF/lib/struts-logic.tld</taglib-location>
>         </taglib>
>  
>         <taglib>
>                 <taglib-uri>struts-nested</taglib-uri>
>  <taglib-location>/WEB-INF/lib/struts-nested.tld</taglib-location>
>         </taglib>

What version of the Servlet spec does ColdFusion implement? Those taglib 
entries shouldn't be necessary if CF is at all current in its servlet 
support.

> This is how I have configured and I am using ColdFusion MX 7.
> 
> 1. Downloaded Struts 1.3.5 and placed all the struts jar files in 
> [CfusionMX/wwwroot]/WEB-INF/lib folder.
> 2. Downloaded Tomcat 4.1.34 and placed servlet.jar in 
> [CfusionMX/wwwroot]/WEB-INF/lib folder.

You shouldn't include servlet.jar in your web app; it's the container's 
responsibility to provide that.

> 3. Downloaded Xalan-j 2.7.0 and placed xalan.jar in 
> [CfusionMX/wwwroot]/WEB-INF/lib folder.
> 4. Downloaded Xerces-j 2.9.0 and placed xercesImpl.jar in 
> [CfusionMX/wwwroot]/WEB-INF/lib folder.

What version of the JDK are you using? I doubt you need Xalan and 
Xerces. If you're on JDK 1.4 or later, they may be conflicting with the 
bundled JAXP implementation.

> 5. Placed struts-bean.tld, struts-html.tld, struts-logic.tld, 
> struts-nested.tld in [CfusionMX/wwwroot]/WEB-INF/tlds folder.

Again, unless CF implements an older version of the Servlet spec, you 
shouldn't need these files. Including them shouldn't hurt, either, though.

> 6. Enabled session variables using J2EE. 
> 7. Edited web.xml as required.
> 8. Placed struts-config.xml in [CfusionMX/wwwroot]/WEB-INF folder.
> 9. Placed *.cfm files in [CfusionMX/wwwroot]/cfm folder.
> 10. Compiled and jarred the package of all the java classes and placed the 
> jar file in [CfusionMX/wwwroot]/WEB-INF/lib folder.
> 11. Placed accounts.dat in [CfusionMX/wwwroot]/WEB-INF/classes folder.
> 
> Am I going wrong anywhere? Please help.

Try those suggestions and see if it helps. You might also want to look 
for a more up-to-date howto article, since I suspect the one you're 
following is quite out of date based on some of your configuration steps.

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org