Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts 2 - Error while accessing struts-tlds

 
sarbjeet sidhu
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm facing one problem while rendring jsp page following is the trace

java.lang.NoClassDefFoundError
org.apache.struts2.views.freemarker.FreemarkerManager.createConfiguration(FreemarkerManager.java:308)
org.apache.struts2.views.freemarker.FreemarkerManager.getConfiguration(FreemarkerManager.java:162)
org.apache.struts2.components.template.FreemarkerTemplateEngine.renderTemplate(FreemarkerTemplateEngine.java:89)
org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:559)
org.apache.struts2.components.ClosingUIBean.start(ClosingUIBean.java:59)
org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:53)
org.apache.jsp.appHome_jsp._jspx_meth_s_005fform_005f0(appHome_jsp.java:100)
org.apache.jsp.appHome_jsp._jspService(appHome_jsp.java:75)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:387)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:154)
org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:362)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:266)
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)


Here is my jsp code

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="/WEB-INF/struts-tags.tld" prefix="s" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Webmaster</title>
</head>
<body>
<s:form>
<s:submit action="webmasterHome" value="Webmaster Home" />
</s:form>
</body>
</html>

here is struts.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="webmaster" extends="struts-default">
<action name="OK" class="com.HomeAction" >
<result>/appHome.jsp</result>
</action>
</package>
</struts>
 
Ankit Garg
Sheriff
Posts: 9521
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sarbjeet, welcome to javaranch.

Sarbjeet please take time to Carefully Choose One Forum when you start a topic. Don't post the same question multiple times. I'll move this question to Struts forum...
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What libraries have you deployed? What version of Struts 2? Why did you extract the TLD file?
 
sarbjeet sidhu
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi David,

I'm using struts 2.1.8 version, and i have deployed following libraries files.

struts2-core-2.1.8.1.jar
xwork-core-2.1.6.jar
ognl-2.7.3.jar
commons-logging-api.jar
commons-io-1.4.jar
commons-fileupload-1.2.1.jar
commons-collections-3.2.jar
commons-beanutils-1.7.0.jar


I'm using JBoss 4.0.3, and it was not able to locate the tld file from struts2-core.jar that's why i have extracted tld file.


Thanks
 
Kevin Reynolds
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had the same problem. It may be that the core jar wasnt supposed to contain the FilterDispatcher or maybe it has not only be deprecated but has been extradicted to an alien planet. In either case, I resolved my issue with it by using the xwork-2.0.4.jar instead of the xwork-core-2.1.6.jar. I was not able to locate any information about what the heck happened to it - but then again, once I find a work around I tend to stop looking... In this case, I found your post during my "quest" to find out what happened.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's a Very Bad Idea (and I'm surprised it works) as S2 depends *heavily* on XWork, and the two are developed very closely together. The original poster isn't deploying the Freemarker library; if you're claiming that downgrading a small portion of the S2 dependencies fixed that precise error, without causing others, id be very suspicious of your deployment.
 
Kevin Reynolds
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh sorry. I see that now. It was a FreeMarker null pointer rather than the same null pointer I was getting. Mine was for the FilterDispatcher defined in the struts-default.xml.
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>

I definitely agree that using an old jar will very likely cause additional errors and is not my preference (which is why I still ocassionally look for a real answer). But, thus far, I still haven't found details about why the xwork-core-2.1.6.jar does not contain the FilterDispatcher class or any documentation about in which jar that class now resides or the new class which takes its place (if there is one).


update-
found it (and it wasn't that hard to find really - but I tend to fumble around a day or two before I search with the right google search string)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter

http://struts.apache.org/2.1.6/struts2-core/apidocs/org/apache/struts2/dispatcher/FilterDispatcher.html
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic