Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/328.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 可能的原因可能是在应用程序未配置安全性时调用https_Java_Web Services - Fatal编程技术网

Java 可能的原因可能是在应用程序未配置安全性时调用https

Java 可能的原因可能是在应用程序未配置安全性时调用https,java,web-services,Java,Web Services,我创建web服务 @WebService(serviceName = "DynamipsService2") @Stateless() public class DynamipsService2 { @WebMethod(operationName = "StartSession") public static String StartSession(@WebParam(name = "key") String key) { try {

我创建web服务

@WebService(serviceName = "DynamipsService2")
@Stateless()
public class DynamipsService2 {

    @WebMethod(operationName = "StartSession")
    public static String StartSession(@WebParam(name = "key") String key) {
        try {

                return "100-Session started";

        } catch (Exception ex) {
            return null;
        }
    }

}
我想测试,但在页面上 撞车窃听器

为对象生成工件时出错 遵循WSDL

可能的原因可能是调用https 未配置应用程序时 为了安全


我在同一个程序集中创建了其他Web服务,它正常工作。

我遇到了同样的问题,原因在服务器的日志中。我正在使用Glassfish 3.1和netBeans 7。我在Glassfish输出中得到的错误是: 信息:[错误]com.sun.tools.javac.Main在类路径中不可用,需要sun JDK版本5.0或更高版本

我在谷歌上搜索了一下,似乎是因为glassfish服务器与ubuntu附带的openjdk一起工作。如果您的问题与此相同,我找到的解决方案是删除openjdk jre,如下所示:

sudo apt get删除openjdk-6-jre sudo易于自动删除

希望这是有用的


PS:我在netBeans服务器配置向导的java选项卡中分配了/usr/lib/jvm/java-6-sun/bin/java,但不知道这是否是解决方案的一部分(我害怕将其更改回:p)

我也遇到了这个问题。我的解决方案是在测试人员的URL中使用我的主机名而不是localhost

因此,在我的例子中,当我在NetBeans UI中单击Test Web Service时,NetBeans/Glassfish默认执行的以下操作不起作用:

但是,当我将以下内容粘贴到浏览器中时,它确实起作用:


我不知道如何更改NetBeans用于内置测试对话框的主机名(也不知道如何从错误对话框剪切并粘贴URL)。因此,我必须直观地将错误消息中的URL复制到浏览器中,同时替换主机名。

我在Glassfish中也遇到了同样的问题

但由于NAT,它被编译得更多

我在NAT-DoMyDomain中有GF,端口被重定向到内部机器

GF中的问题是,它试图通过域名连接到自身,而域名又会重定向到内部网络 (wsdl工作正常)

我已将临时解决方案添加到/etc/hosts(127.0.0.1域名)
请注意,这只是一个临时解决方案

尝试检查主机文件中是否有“localhost”(在windows c:/windows/system32/drivers/etc/hosts中) 和pinglocalhost

我将添加GF日志-也许将来会有人通过谷歌搜索它:):) 此外,我还看到了一些类似->

Connection timed out
Failed to read the WSDL document: http://MYDOMAIN:8080/MYSERVICE?WSDL, because 1) could not find the document; /2) the document could not be read; 3) the root element of the document is not <wsdl:definitions>.
failed.noservice=Could not find wsdl:service in the provided WSDL(s):
At least one WSDL with at least one service definition needs to be provided.
Failed to parse the WSDL.
连接超时
无法读取WSDL文档:http://MYDOMAIN:8080/MYSERVICE?WSDL,因为1)找不到文档/2) 文件无法读取;3) 文档的根元素不是。
failed.noservice=在提供的wsdl中找不到wsdl:service:
需要提供至少一个具有至少一个服务定义的WSDL。
未能分析WSDL。

您使用哪台web服务器?如果您使用glassfish,您可以打开服务器管理页面并选择
Configurations===>server config====>Security


并启用安全管理器

检查您的域/{your_DOMAIN}/config/DOMAIN.xml

如果您使用Eclipse设置Glassfish,所有操作都将自动完成


现在我很惊讶如果我从命令行启动域,它会给我这个错误,但是从Eclipse启动Glassfish 4,它没有显示任何问题。

一个原因可能是您没有正确配置环境变量JAVA\u HOME(使用正确的路径)JAVA_HOME/bin目录也添加到全局路径环境变量中。对于某些进程,glassfish会查找安装的JDK的类路径。
希望这有帮助。

我遇到了完全相同的问题,这是因为您有一个静态方法,我在调试了一段时间后意识到了这一点。只要从方法中删除static,它就会工作

@WebMethod(operationName = "StartSession")
public String StartSession(@WebParam(name = "key") String key) {
    try {

            return "100-Session started";

    } catch (Exception ex) {
        return null;
    }
}

1) 您是否运行wsgen来生成所需的工件?2)如何发布web服务?@user384706,我完全不理解您的问题。我们检查domain.xml的目的是什么?
Connection timed out
Failed to read the WSDL document: http://MYDOMAIN:8080/MYSERVICE?WSDL, because 1) could not find the document; /2) the document could not be read; 3) the root element of the document is not <wsdl:definitions>.
failed.noservice=Could not find wsdl:service in the provided WSDL(s):
At least one WSDL with at least one service definition needs to be provided.
Failed to parse the WSDL.
@WebMethod(operationName = "StartSession")
public String StartSession(@WebParam(name = "key") String key) {
    try {

            return "100-Session started";

    } catch (Exception ex) {
        return null;
    }
}