0

这是我的 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>RyR Construcciones</display-name>

<!-- Auto scan REST service -->
<context-param>
    <param-name>resteasy.scan.resources</param-name>
    <param-value>true</param-value>
</context-param>

<!-- this need same with resteasy servlet url-pattern -->
<context-param>
    <param-name>resteasy.servlet.mapping.prefix</param-name>
    <param-value>/rest</param-value>
</context-param>

<listener>
    <listener-class>
        org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap
    </listener-class>
</listener>

<servlet>
    <servlet-name>resteasy-servlet</servlet-name>
    <servlet-class>
        org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
    </servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>resteasy-servlet</servlet-name>
    <url-pattern>/rest/*</url-pattern>
</servlet-mapping>

这是我部署 maven 生成的战争时的日志。

Jun 14, 2013 12:56:10 PM org.apache.catalina.startup.HostConfig deleteRedeployResources
INFO: Undeploying context []
Jun 14, 2013 12:56:11 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /home/osmoren1/jvm/apache-tomcat-      7.0.39/domains/admin.ryrconstrucciones.cl/ROOT.war
Jun 14, 2013 12:56:16 PM    org.jboss.resteasy.plugins.server.servlet.ConfigurationBootstrap 
INFO: Adding scanned resource: com.jetorom.ryrsoluciones.servicios.LoginService
Jun 14, 2013 12:56:16 PM    org.jboss.resteasy.plugins.server.servlet.ConfigurationBootstrap 
INFO: Adding scanned resource: com.jetorom.ryrsoluciones.servicios.LiquidacionesService
Jun 14, 2013 12:56:16 PM org.jboss.resteasy.plugins.server.servlet.ConfigurationBootstrap 
INFO: Adding scanned resource: com.jetorom.ryrsoluciones.servicios.CargosService
Jun 14, 2013 12:56:16 PM org.jboss.resteasy.plugins.server.servlet.ConfigurationBootstrap 
INFO: Adding scanned resource: com.jetorom.ryrsoluciones.servicios.TrabajadoresService
Jun 14, 2013 12:56:16 PM org.jboss.resteasy.plugins.server.servlet.ConfigurationBootstrap 
INFO: Adding scanned resource: com.jetorom.ryrsoluciones.servicios.ReportesService

这就是我尝试访问 de rest 服务时得到的结果

"NetworkError: 404 Not Found - http://admin.ryrconstrucciones.cl/rest/login/auth"

该方法是一个 POST 资源,但我有一个 GET 资源,简称为 test,它响应 URL

http://admin.ryrconstrucciones.cl/rest/login/test

但我得到了相同的 404。我在我的 windows 机器的本地 Tomcat 中部署了相同的 WAR,它运行良好。有人能帮我吗?

对不起我的英语,提前谢谢。

这是我的 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.jetorom</groupId>
<artifactId>ryrsoluciones</artifactId>
<version>1.0</version>
<packaging>war</packaging>

<name>ryrsoluciones</name>

<properties>
    <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <netbeans.hint.deploy.server>Tomcat</netbeans.hint.deploy.server>
</properties>

<dependencies>
    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-jaxrs</artifactId>
        <version>2.3.6.Final</version>
    </dependency>
    <dependency>
        <groupId>org.eclipse.persistence</groupId>
        <artifactId>javax.persistence</artifactId>
        <version>2.0.3</version>
    </dependency>
    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-jackson-provider</artifactId>
        <version>2.3.6.Final</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>4.2.1.Final</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>4.2.1.Final</version>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.25</version>
    </dependency>
    <dependency>
        <groupId>net.sf.jasperreports</groupId>
        <artifactId>jasperreports</artifactId>
        <version>5.1.0</version>
    </dependency>
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-web-api</artifactId>
        <version>6.0</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
                <compilerArguments>
                    <endorseddirs>${endorsed.dir}</endorseddirs>
                </compilerArguments>
                <!--outputDirectory>${dir}</outputDirectory-->
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.3</version>
            <configuration>
                <failOnMissingWebXml>false</failOnMissingWebXml>
                <outputDirectory>webapps</outputDirectory>
                <warName>ROOT</warName>                 
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.1</version>
            <executions>
                <execution>
                    <phase>validate</phase>
                    <goals>
                        <goal>copy</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>${endorsed.dir}</outputDirectory>
                        <silent>true</silent>
                        <artifactItems>
                            <artifactItem>
                                <groupId>javax</groupId>
                                <artifactId>javaee-endorsed-api</artifactId>
                                <version>6.0</version>
                                <type>jar</type>
                            </artifactItem>
                        </artifactItems>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
<repositories>
    <repository>
        <url>http://download.eclipse.org/rt/eclipselink/maven.repo/</url>
        <id>eclipselink</id>
        <layout>default</layout>
        <name>Repository for library EclipseLink (JPA 2.0)</name>
    </repository>
</repositories>

更新:我忘了提到我正在使用 AngularJS 1.0.6 $http.get 或 $http.post 进行响应式调用

4

0 回答 0