xml - java.lang.NoClassDefFoundError: org/apache/tiles/el/ELAttributeEvaluator -
error occur @ time of start server
severe: exception sending context initialized event listener instance of class org.apache.struts2.tiles.strutstileslistener java.lang.noclassdeffounderror: org/apache/tiles/el/elattributeevaluator @ org.apache.struts2.tiles.strutstilescontainerfactory.createelevaluator(strutstilescontainerfactory.java:247) @ org.apache.struts2.tiles.strutstilescontainerfactory.createattributeevaluatorfactory(strutstilescontainerfactory.java:198) @ org.apache.tiles.factory.basictilescontainerfactory.createcontainer(basictilescontainerfactory.java:106) @ org.apache.tiles.startup.abstracttilesinitializer.createcontainer(abstracttilesinitializer.java:124) @ org.apache.tiles.startup.abstracttilesinitializer.initialize(abstracttilesinitializer.java:70) @ org.apache.tiles.web.startup.abstracttileslistener.contextinitialized(abstracttileslistener.java:62) @ org.apache.catalina.core.standardcontext.listenerstart(standardcontext.java:4842) @ org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5303) @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:147) @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1407) @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1397) @ java.util.concurrent.futuretask.run(futuretask.java:266) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) @ java.lang.thread.run(thread.java:745) caused by: java.lang.classnotfoundexception: org.apache.tiles.el.elattributeevaluator @ org.apache.catalina.loader.webappclassloaderbase.loadclass(webappclassloaderbase.java:1332) @ org.apache.catalina.loader.webappclassloaderbase.loadclass(webappclassloaderbase.java:1166) ... 15 more nov 08, 2016 4:10:58 pm org.apache.catalina.core.standardcontext startinternal severe: 1 or more listeners failed start. full details found in appropriate container log file nov 08, 2016 4:10:58 pm org.apache.catalina.core.standardcontext startinternal severe: context [/tilesstrutdemo] startup failed due previous errors nov 08, 2016 4:10:58 pm org.apache.coyote.abstractprotocol start info: starting protocolhandler ["http-nio-8080"] nov 08, 2016 4:10:58 pm org.apache.coyote.abstractprotocol start info: starting protocolhandler ["ajp-nio-8009"] nov 08, 2016 4:10:58 pm org.apache.catalina.startup.catalina start info: server startup in 3332 ms
web.xml of project
<?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemalocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="webapp_id" version="3.1"> <display-name>tilesstrutdemo</display-name> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <listener> <listener-class> org.apache.struts2.tiles.strutstileslistener </listener-class> </listener> <context-param> <param-name>tilesdefinitions</param-name> <param-value>/web-inf/tiles.xml</param-value> </context-param> <filter> <filter-name>struts2</filter-name> <filter-class> org.apache.struts2.dispatcher.filter.strutsprepareandexecutefilter </filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> </web-app>
struts.xml of project
<?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="default" extends="struts-default" namespace="/"> <result-types> <result-type name="tiles" class="org.apache.struts2.views.tiles.tilesresult" /> </result-types> <action name="login" class="com.action.login.logindemo"> <result name="success" type="tiles">/welcome.tiles</result> <result name="error">login.jsp</result> </action> <action name="customer" class="com.action.login.logindemo"> <result name="success" type="tiles">/customer.success.tiles</result> </action> </package> </struts>
*tiles.xml configuration *
<?xml version="1.0" encoding="utf-8"?> <!doctype tiles-definitions public "-//apache software foundation//dtd tiles configuration 2.0//en" "http://tiles.apache.org/dtds/tiles-config_2_0.dtd"> <tiles-definitions> <definition name="baselayout" template="/baselayout.jsp"> <put-attribute name="title" value="" /> <put-attribute name="header" value="/header.jsp" /> <put-attribute name="menu" value="/menu.jsp" /> <put-attribute name="body" value="" /> <put-attribute name="footer" value="/footer.jsp" /> </definition> <definition name="/welcome.tiles" extends="baselayout"> <put-attribute name="title" value="welcome" /> <put-attribute name="body" value="/welcome.jsp" /> </definition> <definition name="/customer.tiles" extends="baselayout"> <put-attribute name="title" value="customer form" /> <put-attribute name="body" value="/customer.jsp" /> </definition> <definition name="/customer.success.tiles" extends="baselayout"> <put-attribute name="title" value="customer added" /> <put-attribute name="body" value="/successcustomer.jsp" /> </definition> </tiles-definitions>
menu.jsp
<%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1"%> <%@taglib prefix="t" uri="http://tiles.apache.org/tags-tiles" %> <%@taglib prefix="s" uri="/struts-tags"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>insert title here</title> </head> <body> menu..... </body> </html>
header.jsp
<%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1"%> <%@taglib prefix="t" uri="http://tiles.apache.org/tags-tiles" %> <%@taglib prefix="s" uri="/struts-tags"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>insert title here</title> </head> <body> header.......... </body> </html>
baselayout.jsp
<%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1"%> <%@taglib prefix="t" uri="http://tiles.apache.org/tags-tiles" %> <%@taglib prefix="s" uri="/struts-tags"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>insert title here</title> </head> <body> <table border="1" cellpadding="2" cellspacing="2" align="center"> <tr> <td height="30" colspan="2"><tiles:insertattribute name="header" /> </td> </tr> <tr> <td height="250"><tiles:insertattribute name="menu" /></td> <td width="350"><tiles:insertattribute name="body" /></td> </tr> <tr> <td height="30" colspan="2"><tiles:insertattribute name="footer" /> </td> </tr> </table> </body> </html>
footer.jsp
<%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1"%> <%@taglib prefix="t" uri="http://tiles.apache.org/tags-tiles" %> <%@taglib prefix="s" uri="/struts-tags"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>insert title here</title> </head> <body> footer............. </body> </html>
insert.jsp
<%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1"%> <%@ taglib prefix="t" uri="http://tiles.apache.org/tags-tiles"%> <%@taglib prefix="s" uri="/struts-tags"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>insert title here</title> </head> <body> <s:form action="login"> <s:textarea name="number" label="number"/> <s:submit value="click" name="click"></s:submit> </s:form> <s:url action="customer">customer</s:url> </body> </html>
*logindemo.java action call action *
package com.action.login; import com.opensymphony.xwork2.actionsupport; public class logindemo extends actionsupport{ private int num; public int getnum() { return num; } public void setnum(int num) { this.num = num; } public string login(){ if(num%2==0){ return success; }else{ return error; } } public string customer(){ return success; } }
lib add jar
commons-beanutils-1.8.0.jar commons-collections-3.2.2.jar commons-digester-2.0.jar commons-fileupload-1.3.2.jar commons-io-2.2.jar commons-logging-1.1.3.jar freemarker-2.3.22.jar ognl-3.0.19.jar struts2-core-2.3.31.jar struts2-tiles-plugin-2.3.31.jar tiles-api-2.2.2.jar tiles-core-2.2.2.jar tiles-jsp-2.2.2.jar xwork-core-2.3.31.jar tiles-servlet-2.2.2.jar slf4j-api-1.7.12.jar tiles-compat-3.0.1.jar tiles-ognl-2.2.2.jar tiles-freemarker-2.2.2.jar javassist-3.11.0.ga.jar struts2-tiles3-plugin-2.3.31.jar jdk1.8 tomcat 1.8
Comments
Post a Comment