Java servlet的分配中出现异常

Java servlet的分配中出现异常,java,angularjs,rest,jersey,jax-rs,Java,Angularjs,Rest,Jersey,Jax Rs,我一整天都在与这个问题作斗争:我想从authenticationservice调用connect服务方法。我有一个例外(代码的其余部分在底部): My Web.xml: <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

我一整天都在与这个问题作斗争:我想从
authenticationservice
调用connect服务方法。我有一个例外(代码的其余部分在底部):

My Web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
         version="3.1">
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>
    <servlet>
        <servlet-name>AuthentificationService</servlet-name>
        <servlet-class>net.iots.iotshub.web.service.AuthentificationService</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>AuthentificationService</servlet-name>
        <url-pattern>/rest/authentificationService</url-pattern>
    </servlet-mapping>
</web-app>
我的AngularJS服务:

cmlAppModule.factory('AuthentificationService', function ($resource) {

    return $resource('rest/authentificationService/:path',
            {path: '@path'},
    {
        disconnect: {
            method: 'GET',
            params: {
                path: "disconnect"
            }
        },
        isConnected: {
            method: 'GET',
            params: {
                path: "isConnected"
            }
        },
        connect: {
            method: 'GET',
            params: {
                path: "connect"
            }
        }
    });
});
如果有人能帮我解决这个问题,请提供可能的解决方案


谢谢,

在如此多的层面上有如此多的错误

  • 没有“认证”这个词。这是“身份验证”:-)

  • @ApplicationPath
    应用于应用程序配置类,而不是资源类。比如说

    @ApplicationPath("/rest")
    public class AppConfig extends PackagesConfig {
        public AppConfig() {
            super("the.packages.to.scan.for.resources.and.provders");
        }
    }
    
    这样,您就可以摆脱我们的web.xml(或者至少是您尝试的servlet配置)。这几乎是一样的。将包名称更改为资源的包。并从资源类中删除
    @ApplicationPath

  • 在web.xml中,您不能这样做

    <servlet>
        <servlet-name>AuthentificationService</servlet-name>
        <servlet-class>
            net.iots.iotshub.web.service.AuthentificationService
        </servlet-class>
    </servlet>
    
    
    认证服务
    net.iots.iotshub.web.service.authenticationservice
    
    除非
    authenticationservice
    是一个实际的Servlet(我不知道
    AbstractService
    是什么,所以我不能说)。在任何情况下,即使它是,这个配置仍然不起作用

  • @ApplicationPath("/rest")
    public class AppConfig extends PackagesConfig {
        public AppConfig() {
            super("the.packages.to.scan.for.resources.and.provders");
        }
    }
    
    <servlet>
        <servlet-name>AuthentificationService</servlet-name>
        <servlet-class>
            net.iots.iotshub.web.service.AuthentificationService
        </servlet-class>
    </servlet>