Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/rest/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 无法访问部署在上的rest apihttps://locahost:8443 来自部署在tomcat上的战争_Java_Rest_Tomcat_Jersey_Ssl Certificate - Fatal编程技术网

Java 无法访问部署在上的rest apihttps://locahost:8443 来自部署在tomcat上的战争

Java 无法访问部署在上的rest apihttps://locahost:8443 来自部署在tomcat上的战争,java,rest,tomcat,jersey,ssl-certificate,Java,Rest,Tomcat,Jersey,Ssl Certificate,我使用jersey设计了rest api。我创建了一个web应用程序,并在elipse上创建了一个war。我在tomcat服务器上部署了该war。当我从eclipse启动服务器并访问web服务时,我能够做到这一点。但是在tomcat上部署war并从tomcat/bin启动服务器后,我尝试使用java客户机访问web服务我收到以下错误 Error 404:https://localhost:8443/SecureHttpsProject/rest/download not found 下面是访问

我使用jersey设计了rest api。我创建了一个web应用程序,并在elipse上创建了一个war。我在tomcat服务器上部署了该war。当我从eclipse启动服务器并访问web服务时,我能够做到这一点。但是在tomcat上部署war并从tomcat/bin启动服务器后,我尝试使用java客户机访问web服务我收到以下错误

Error 404:https://localhost:8443/SecureHttpsProject/rest/download not found
下面是访问web服务的代码

Client client = null;

                com.sun.jersey.api.client.config.ClientConfig config = new com.sun.jersey.api.client.config.DefaultClientConfig(); // SSL configuration 
                config.getProperties().put(com.sun.jersey.client.urlconnection.HTTPSProperties.PROPERTY_HTTPS_PROPERTIES, new com.sun.jersey.client.urlconnection.HTTPSProperties(getHostnameVerifier(), getSSLContext())); 
                client = Client.create(config);



                    WebResource service = client.resource(UriBuilder.fromUri(p.getProperty("https://localhost:8443/SecureHttpsProject/rest/download")).build());
            Form f = new Form();    
            f.add("installableName", instName.getText());    
            f.add("searchPath", srchPath.getText());    
            f.add("targetPath", trgtPath.getText());
        String res= service.post(String.class,f);
        System.out.println("Result "+res);
            result.setText(res+"                 ");
            }
        });

有没有一种方法可以在https上使用war访问部署在tomcat上的web服务?

我希望您在webappstry下部署时只使用443而不是8443。是的,我已经在webapps下部署了它。问题是,如果我从eclipse启动服务器,它是可以访问的。但是在导出项目之后,war和在tomcat/webappsare中解除污染似乎不起作用您可以在
https://localhost:8443/
在独立部署中?是的。每当我使用第页上的manager应用程序选项部署war时,访问web服务是一个问题。我的环境使用代理ip。这会是一个问题吗?如果是,我如何解决它?