Spring Boot嵌入式Jetty 403错误

时间:2017-02-22 12:30:30

标签: jsp spring-boot struts embedded-jetty jetty-9

我在我的webApp上遇到一个奇怪的问题,当我输入网址时,我立即得到了这个错误

  

HTTP错误:403访问/ PayingServiceWeb /时出现问题。理由:禁止

但是,如果我手动输入页面名称frontpage.jsp到URL,它将启动我的struts操作并向前移动。我只是不明白为什么当我进入页面时它会自动启动。我和Jetty和Struts一样非常棒,所以这可能是一个问题......

该程序用于使用EJB bean,但它们都已被删除并替换为Jpa API。有些文件仍包含一些EJB名称。

我在我的项目中使用Jetty版本jetty-9.2.19和Struts 1.2.9以及Spring Boot。

这是我的主要模块pom.xml

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>PayService</groupId>
<artifactId>PayService</artifactId>
<packaging>pom</packaging>
<version>0.1-SNAPSHOT</version>
<name>PayService</name>

<properties>
    <PayServiceJava-legacy.version>${version}</PayServiceJava-legacy.version>
</properties>

<parent>
    <groupId>fi.common</groupId>
    <artifactId>legacy-parent</artifactId>
    <version>1.10-SNAPSHOT</version>
</parent>

<description>PayService</description>

<dependencyManagement>

    <dependencies>

        <dependency>
            <groupId>struts</groupId>
            <artifactId>struts</artifactId>
            <version>${struts.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-http</artifactId>
            <version>${cxf.version}</version>
        </dependency>
        <dependency>
            <groupId>service</groupId>
            <artifactId>JdbcBicProvider</artifactId>
            <version>${JdbcBicProvider.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-ws-security</artifactId>
            <version>${cxf.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-ws-policy</artifactId>
            <version>${cxf.version}</version>
        </dependency>

    </dependencies>

</dependencyManagement>

<modules>
    <module>../PayServiceJava</module>
    <module>../PayServicePersistenssi</module>
    <module>../PayServiceSessionEJB</module>
    <module>../PayServiceSingletons</module>
    <module>../PayServiceTehtava</module>
    <module>../PayServiceWeb</module>
</modules>

<dependencies>

    <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
    </dependency>
    <dependency>
        <groupId>opensymphony</groupId>
        <artifactId>oscache</artifactId>
        <version>2.0.2</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-orm</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context-support</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-expression</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-tx</artifactId>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
    </dependency>
    <dependency>
        <groupId>org.apache.tomcat</groupId>
        <artifactId>tomcat-jdbc</artifactId>
    </dependency>
    <dependency>
        <groupId>ibm.jdbc</groupId>
        <artifactId>db2jcc4</artifactId>
    </dependency>
    <dependency>
        <groupId>ibm.jdbc</groupId>
        <artifactId>db2jcc_license_cisuz</artifactId>
    </dependency>
    <dependency>
        <groupId>javax.cache</groupId>
        <artifactId>cache-api</artifactId>
        <version>1.0.0</version>
    </dependency>

</dependencies>

这是我的网络模块pom.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>PayServiceWeb</artifactId>
<packaging>war</packaging>
<name>PayServiceWeb</name>

<parent>
    <groupId>PayService</groupId>
    <artifactId>PayService</artifactId>
    <version>0.1-SNAPSHOT</version>
    <relativePath>../PayService</relativePath>
</parent>

<dependencies>

    <dependency>
        <groupId>PayService</groupId>
        <artifactId>PayServiceJava</artifactId>
        <version>${PayServiceJava-legacy.version}</version>
    </dependency>
    <dependency>
        <groupId>PayService</groupId>
        <artifactId>PayServiceSessionEJB</artifactId>
        <version>${PayServiceJava-legacy.version}</version>
    </dependency>
    <dependency>
        <groupId>PayService</groupId>
        <artifactId>PayServiceTehtava</artifactId>
        <version>${PayServiceJava-legacy.version}</version>
    </dependency>
    <dependency>
        <groupId>PayService</groupId>
        <artifactId>PayServiceSingletons</artifactId>
        <version>${PayServiceJava-legacy.version}</version>
    </dependency>

    <dependency>
        <groupId>struts</groupId>
        <artifactId>struts</artifactId>

        <exclusions>
            <exclusion>
                <groupId>antlr</groupId>
                <artifactId>antlr</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-transports-http</artifactId>
    </dependency>
    <dependency>
        <groupId>common.service</groupId>
        <artifactId>JdbcBicProvider</artifactId>
    </dependency>
    <dependency>
        <groupId>common</groupId>
        <artifactId>commonWebJava-legacy</artifactId>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-ws-policy</artifactId>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-ws-security</artifactId>
    </dependency>


</dependencies>

这是我的web.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>PayserviceWeb</display-name>

<servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>
    org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
        <param-name>config</param-name>
        <param-value>/WEB-INF/config/struts-config-mp.xml</param-value>
    </init-param>
    <init-param>
        <param-name>debug</param-name>
        <param-value>2</param-value>
    </init-param>
    <init-param>
        <param-name>detail</param-name>
        <param-value>2</param-value>
    </init-param>
    <init-param>
        <param-name>validate</param-name>
        <param-value>true</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
</servlet>
<servlet>
    <description>
    </description>
    <display-name>
    Alustus</display-name>
    <servlet-name>Alustus</servlet-name>
    <servlet-class>
    payservice.servlet.Alustus</servlet-class>
    <load-on-startup>-1</load-on-startup>
</servlet>
<servlet>
    <description>
    </description>
    <display-name>
    ParametrienPaivitys</display-name>
    <servlet-name>ParametrienPaivitys</servlet-name>
    <servlet-class>
    payservice.servlet.ParametrienPaivitys</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>Alustus</servlet-name>
    <url-pattern>/Alustus</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>ParametrienPaivitys</servlet-name>
    <url-pattern>*.parametrit</url-pattern>
</servlet-mapping>
<welcome-file-list>
    <welcome-file>frontpage.jsp</welcome-file>
</welcome-file-list>

    <listener>
        <listener-class>payservice.webservices.authentication.listener.WebServiceKayttajaRequestListener</listener-class>
    </listener> 

这是我的Struts-config.mp.xml的一部分,看起来像这样

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE struts-config PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
    "http://struts.apache.org/dtds/struts-config_1_2.dtd">

  <struts-config>
  <form-beans>
  <form-bean name="loginForm" type="payservice.form.LoginForm" />   
  <form-bean name="payForm" type="payservice.form.PayForm"/>

  <global-forwards>

  <forward name="mp.start" path="/WEB-INF/jsp/payservice/etusivu.jsp"/>
  <forward name="login" path="/WEB-INF/jsp/login.jsp"/> 
  <forward name="mp.start_payment" path="/mp/start_payment.do?method=show"/>
  <forward name="mp.logout" path="/user.do?method=logout" />  
  <forward name="error" path="/error.jsp"/>

 </global-forwards>

<action path="/login" 
            type="payservice.LoginActions" 
            parameter="method" 
            scope="request" 
            name="loginForm" 
            input="/WEB-INF/jsp/login.jsp" 
            validate="true">
        <forward name="valid" path=".mp.frontpage" />
        <forward name="relogin" path=".mp.frontpage" />                      
        <forward name="error" path="/WEB-INF/jsp/login.jsp" />                    
    </action>  

    <action path="/payservice" 
         type="payservice.MainPageActions"
         parameter="method" >
        <forward name="base" path=".mp.frontpage"/>            
        <forward name="menu" path=".mp.menu" />
        <forward name="topic" path=".mp.frontpage" ></forward> 
    </action> 


<action path="/mp/start_payment" type="payservice.BeginNewPaymentAction" name="preparepaymentForm" scope="session" validate="false" parameter="method">
  <forward name="start" path=".mp.payment_start"/>
  <forward name="make_new_payment" path=".mp.new_payment"/>
</action>

<action path="/user" type="payservice.LoginActions" 
            parameter="method" 
            scope="request" 
            name="loginForm" 
            validate="false">

        <forward name="out" path="/WEB-INF/jsp/logout.jsp" />   
        <forward name="sessionOut" path="/WEB-INF/jsp/sessionOut.jsp" />                 
        <forward name="error" path="/WEB-INF/jsp/login.jsp" />                              
    </action> 

   <plug-in className="org.apache.struts.tiles.TilesPlugin">
    <set-property property="definitions-debug" value="0"/>
    <set-property property="definitions-parser-validate" value="true"/>
    <set-property property="definitions-parser-details" value="0"/>
    <set-property property="definitions-config" value="/WEB-INF/config/tiles-defs-mp.xml"/>
    <set-property property="moduleAware" value="true"/>
</plug-in>

1 个答案:

答案 0 :(得分:0)

好的,这是相当迟钝的。我忘了为项目做一个maven构建包。在我完成之后,它开始起作用了。