• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Problem in Struts Dispatcher

 
Greenhorn
Posts: 2
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am new to struts2. I have configured struts2 in Netbeans/Glassfish. Now i am trying to run a simple application. I am getting this error. Please let me know where am i missing.

Find the error that i am getting. Thanks in advance.


HTTP Status 500 - Internal Server Error

type Exception report

messageInternal Server Error

descriptionThe server encountered an internal error that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location]

root cause

The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location]

note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 4.1 logs.
GlassFish Server Open Source Edition 4.1



This is my web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
<init-param>
<param-name>struts.ognl.allowStaticMethodAccess</param-name>
<param-value>true</param-value>
</init-param>
</filter>

<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<session-config>
<session-timeout>30</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>

And there is my struts.xml

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

<struts>
<!-- Configuration for the default package. -->
<package name="DBAF_pract6ognl" extends="struts-default">
<action name="saludo" class="acciones.SaludoAction">
<result>index.jsp</result>
</action>
<action name="stack" class="acciones.StackAction">
<result>stack.jsp</result>
</action>
<action name="datos" class="acciones.DatosAction">
<result>datos.jsp</result>
</action>
<action name="constantes" class="acciones.ConstantesAction">
<result>constantes.jsp</result>
</action>
</package>
</struts>
 
Ranch Hand
Posts: 417
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

Make sure struts2-core-X.X.X.jar is available to your application and/or tomcat. web.xml looks OK at first glance.

Look at your server logs when it starts up and when it handles the request, you may find more there.
 
Alberto Rodriguez
Greenhorn
Posts: 2
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

A.J. Côté wrote:Hello,

Make sure struts2-core-X.X.X.jar is available to your application and/or tomcat. web.xml looks OK at first glance.

Look at your server logs when it starts up and when it handles the request, you may find more there.



Hi, thanks for you time.
All in my project looks OK; Searching, i commented this line in my jps file <%@taglib uri="/struts-tags" prefix="s" %> and it works, but that isn't what i want, can you help me?
 
A.J. Côté
Ranch Hand
Posts: 417
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Alberto Rodriguez wrote:

A.J. Côté wrote:Hello,

Make sure struts2-core-X.X.X.jar is available to your application and/or tomcat. web.xml looks OK at first glance.

Look at your server logs when it starts up and when it handles the request, you may find more there.



Hi, thanks for you time.
All in my project looks OK; Searching, i commented this line in my jps file <%@taglib uri="/struts-tags" prefix="s" %> and it works, but that isn't what i want, can you help me?



Can you confirm struts2-core-X.X.X.jar is available to your application and/or tomcat?

About standard-X.X.X.jar ? (taglibs)

Here is my pom.xml file for a working struts 2 application:




Here are the jar files in my WEB-INF/lib. Of course, you don't need all of them for your specific project:



I use maven to manage dependencies, struts core seems to need other jar files as well, mainly asm*.jar, commons-lang3*.jar, freemaker and ognl although I can't tell you for sure...

 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

A.J. Côté wrote:
I use maven to manage dependencies, struts core seems to need other jar files as well, mainly asm*.jar, commons-lang3*.jar, freemaker and ognl although I can't tell you for sure...



If one does not use Maven, the best way to find the correct Struts dependencies is here.

i commented this line in my jps file <%@taglib uri="/struts-tags" prefix="s" %> and it works,



How does this work unless you are not using Struts tags? If you comment out this line and you are using struts tags, you should get an error that the JSP could not be compiled.
 
Aaaaaand ... we're on the march. Stylin. Get with it tiny ad.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic