2013-07-12 4 views
1

시작 톰캣에 배포 할 때이 오류응용 프로그램이이 처음 스트럿츠 2 응용 프로그램입니다

"Application at context path `/HelloWorldStruts2` could not be started" 

을 가지고 할 수 없습니다. 내 스트럿 응용 프로그램의

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

<display-name>Struts 2</display-name> 
<welcome-file-list> 
<welcome-file>index.jsp</welcome-file> 
</welcome-file-list> 
<filter> 
<filter-name>struts2</filter-name> 
<filter-class> 
org.apache.struts2.dispatcher.FilterDispatcher 
</filter-class> 
</filter> 

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

struts.xml : 내 응용 프로그램의

web.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> 
<constant name="struts.devMode" value="true" /> 
<package name="helloworld" extends="struts-default"> 

<action name="hello" 
    class="com.tutorialspoint.struts2.HelloWorldAction" 
    method="execute"> 
    <result name="success">/HelloWorld.jsp</result> 
</action> 
</package> 
</struts> 
+0

무엇이 서버 로그에 있습니까? 어떤 라이브러리를 배포하고 있습니까? –

+0

아마도 이전 필터를 사용할 것입니다. http://stackoverflow.com/a/17103563/1654265 –

+0

아, 그리고 S2 버전은 무엇입니까? Andrea가 언급했듯이, 여전히 작동해야하지만 비추천 필터입니다. –

답변

0

당신이 당신의 웹 응용 프로그램을 배포하는 경우에 바람둥이는 처리 후 배포 중에 지정된 응용 프로그램 컨텍스트를 만들려고합니다 web.xml. 웹 응용 프로그램에 오류가 있으면 시작되지 않고 컨텍스트가 작성되지 않을 수 있습니다. 이러한 오류를 해결하고 응용 프로그램을 다시 배포해야합니다. 더 이상 사용되지 않는 API, 잘못된 라이브러리 버전 및 일관성없는 종속성, 다른 서버 문제를 사용하는 구성이 잘못되었을 수 있습니다. 무슨 일이 있었는지와 왜 응용 프로그램이 시작되지 않았는지를 알려주는 것은 어렵습니다. 그러나 전체 스택 추적을 제공하면 프로젝트 구성이 문제를 더욱 해결하는 데 도움이 될 수 있습니다. 다음은 프로젝트 코드에있는 다른 문제에 대한 해결책입니다. 존재하지 않거나 이미 해결되었지만 게시 된 코드에는 표시되지 않을 수 있습니다. 이 컨텍스트가 webapp에 등록 된 후 컨텍스트 /HelloWorldStruts2의 브라우저에서 웹 응용 프로그램을 시작하는 데 도움이됩니다. index.jsp에서

당신은

<% response.sendRedirect("hello.action"); %> 
+1

그런데 앱 컨테이너가 웹 앱을 실행하지 못하게한다고 생각하지 않습니다. –

+0

@DaveNewton 로그를 사용하지 않으면 시작할 수 없지만 시작된 후 컨텍스트 '/ HelloWorldStruts2'에서 실행할 수 없습니다. –

+1

... OP는 응용 프로그램을 시작할 수 없음을 나타냅니다. –

0

나는 문제가 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"> 

    <display-name>Struts 2</display-name> 

    <welcome-file-list> 
    <welcome-file>index.jsp</welcome-file> 
    </welcome-file-list> 


    <filter> 
    <filter-name>struts2</filter-name> 
    <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class> 
    </filter> 

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

</web-app> 
관련 문제