Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/354.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 部署在Apache ServiceMix中的REST服务无法远程访问_Java_Apache Camel_Cxf_Apache Karaf_Apache Servicemix - Fatal编程技术网

Java 部署在Apache ServiceMix中的REST服务无法远程访问

Java 部署在Apache ServiceMix中的REST服务无法远程访问,java,apache-camel,cxf,apache-karaf,apache-servicemix,Java,Apache Camel,Cxf,Apache Karaf,Apache Servicemix,我正在servicemix中部署一个angular2 webapp作为war文件。这使应用程序在localhost:8181/angular2webappurl上运行。我为REST请求安装了一个包,它基本上是一个驼峰组件 <cxf:rsServer id="rsServer" address="http://localhost:9090" serviceClass="com.mypackage.class.MyClass" /> 并将angular2代码改为“x.x.x.x:909

我正在servicemix中部署一个angular2 webapp作为war文件。这使应用程序在
localhost:8181/angular2webapp
url上运行。我为REST请求安装了一个包,它基本上是一个驼峰组件

<cxf:rsServer id="rsServer" address="http://localhost:9090"
serviceClass="com.mypackage.class.MyClass" />
并将angular2代码改为“x.x.x.x:9090”,但它也不起作用。此外,我可以在
on
http://localhost:9090...
但不是作为
x.x.x.x:9090…

还是正确的问题:

有没有办法从ServiceMix外部公开REST服务器? 如果不是,我是否应该使用类似NGINIX的东西作为代理服务器,这样就可以使用
localhost

正确的做法是什么?

在地址中使用0.0.0.0而不是localhost

address="http://0.0.0.0:9090"

您可能会发现关于localhost/127.0.0.1和0.0.0.0之间的差异的问题,例如:

谢谢它成功了:)您还可以告诉我使用cxf:rsServer和cxf:cxfEndpoint创建的服务器之间的差异吗?就像在这个页面中一样:另外,我正在输入angular2代码中的IP。这是一个错误的方式做不同的来源请求?我应该有代理服务器还是接受请求?你能推荐一个更好的方法吗?这似乎不适用于https,netstat命令告诉我它在127.0.0.1上侦听
address="http://0.0.0.0:9090"