2017-12-15 15 views
-1

아래 언급 된대로 struts.xml 파일을 작성합니다. 이클립스에서 실행하지만 오류가 발생합니다. 는 또한 깨끗한 바람둥이예외 시작 필터 struts2 구성을로드 할 수 없습니다 : struts.xml 파일을로드 할 수 없습니다.

오류가 직접 작업

Unable to load configuration. - file:/D:/Sonali_workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/salesdeals123/WEB-INF/classes/struts.xml:22:21 
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:501) 
    at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74) 
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57) 
    at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:281) 
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:262) 
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:107) 
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4797) 
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5473) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) 
    at java.util.concurrent.FutureTask.run(Unknown Source) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 
    at java.lang.Thread.run(Unknown Source) 
Caused by: Unable to load configuration. - file:/D:/Sonali_workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/salesdeals123/WEB-INF/classes/struts.xml:22:21 
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70) 
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:445) 
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:489) 
    ... 14 more 
Caused by: Unable to load file:/D:/Sonali_workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/salesdeals123/WEB-INF/classes/struts.xml - file:/D:/Sonali_workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/salesdeals123/WEB-INF/classes/struts.xml:22:21 
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:1022) 
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:165) 
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:132) 
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:233) 
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67) 
    ... 16 more 
Caused by: Element type "action-mappings" must be declared. - file:/D:/Sonali_workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/salesdeals123/WEB-INF/classes/struts.xml:22:21 
    at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:119) 
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:1017) 
    ... 20 more 
Caused by: org.xml.sax.SAXParseException; systemId: file:/D:/Sonali_workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/salesdeals123/WEB-INF/classes/struts.xml; lineNumber: 22; columnNumber: 21; Element type "action-mappings" must be declared. 
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) 
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source) 
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source) 
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source) 
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source) 
    at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source) 
    at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(Unknown Source) 
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) 
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source) 
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source) 
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source) 
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) 
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) 
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) 
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source) 
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source) 
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) 
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(Unknown Source) 
    at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:117) 

내 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> 

<!-- The struts-default package is the Struts 2 default package. 
It defines default result types, interceptors, interceptor stacks, and a few other defaults.. --> 

<package name="default" namespace="/" extends="struts-default"> 
     <interceptors> 
      <interceptor name="myCustomInterceptor" class="com.demo.struts.Interceptors.MyCustomInterceptor" /> 
      <interceptor-stack name="customStack"> 
       <interceptor-ref name="myCustomInterceptor"/> 
       <interceptor-ref name="defaultStack"/> 
      </interceptor-stack> 
     </interceptors>  
    </package> 


<package namespace="/user" name="default" extends="struts-default"> 


     <action name="checkLoginDetail123" class="com.demo.struts.controller.FranchiseLogin_manager"> 
     <result name="success">/Franchise/FranchiseExecutiveRegistration.jsp</result> 
     <result name="error">/Franchise/Login.jsp</result> 
     </action> 

    </package> 

    <constant name="struts.devMode" value="true" /> 
    <constant name="struts.convention.default.parent.package" 
     value="default" /> 
    <constant name="struts.custom.i18n.resources" value="global" /> 


</struts> 

답변

0

대답이 스택 추적 :

이미입니다

발생 원인 : org.xml.sax.SAXParseException; systemId : 파일 :/D : /Sonali_workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/salesdeals123/WEB-INF/classes/struts.xml; lineNumber : 22; columnNumber : 21; 요소 유형 "action-mappings"은 이어야합니다.

0

오류의 원인이되는 파일은 WEB-INF/classes/struts.xml입니다.

struts.xml 구성 파일 소스 폴더에 있어야 같은 src 또는 resources있다. 응용 프로그램을 빌드하면 컴파일 된 출력이 WEB-INF/classes으로 지정됩니다.

응용 프로그램이 이미 배포 된 서버를 배포하거나 시작하기 전에이 파일 이 있는지 확인할 수 있습니다.

+0

오류는 다음 깨끗한'WEB-INF/classes'에서'struts.xml'를 제거 다시 앱을 다시 배포 할 필요가 해결 –

+0

를 해결합니다. –

+0

내가 프로젝트를 청소할 때마다 ... 나는이 오류가있다. 솔루션은 프로젝트를 삭제하고 다시 Eclipse에 추가하는 것입니다 ... plz help me ... –