无法绑定到Openshift上的端口

无法绑定到Openshift上的端口

本文介绍了无法绑定到Openshift上的端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在openshift的应用程序中运行嵌入式activemq消息服务器。根据,您只能绑定 15000 - 35530 。我已经尝试过以下操作,但它会引发严重的错误。可能是什么问题?

I am running an embedded activemq message server in my application on openshift. According to this, you can only bind on 15000 - 35530. I've tried doing the following, but it's throwing a serious error. What could be the issue?

我正在使用春天。这是我的 applicationContext.xml中的一部分

<amq:broker brokerName="tentacle-broker" start="true">
    <amq:persistenceAdapter>
        <amq:amqPersistenceAdapter directory="/var/lib/openshift/username/jbossews-2.0/jbossews-2.0/activemq2" maxFileLength="32mb"/>
    </amq:persistenceAdapter>
    <amq:transportConnectors>
        <amq:transportConnector uri="tcp://127.10.180.129:15001"/>
    </amq:transportConnectors>
</amq:broker>

这是我遇到的错误

WARNING: could not generate unique stub
java.net.BindException: Permission denied
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376)
        at java.net.ServerSocket.bind(ServerSocket.java:376)
        at java.net.ServerSocket.<init>(ServerSocket.java:237)
        at java.net.ServerSocket.<init>(ServerSocket.java:128)
        at org.apache.activemq.util.IdGenerator.<clinit>(IdGenerator.java:54)
        at org.apache.activemq.broker.region.RegionBroker.<clinit>(RegionBroker.java:81)
        at org.apache.activemq.broker.BrokerService.createRegionBroker(BrokerService.java:1830)
        at org.apache.activemq.broker.BrokerService.createRegionBroker(BrokerService.java:1824)
        at org.apache.activemq.broker.BrokerService.createBroker(BrokerService.java:1781)
        at org.apache.activemq.broker.BrokerService.getBroker(BrokerService.java:766)
        at org.apache.activemq.broker.BrokerService.start(BrokerService.java:497)
        at org.apache.activemq.broker.BrokerService.autoStart(BrokerService.java:463)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProces
r.java:293)
va:130)
ava:394)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1405)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:872)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423)
        at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:963)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1600)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
:


推荐答案

在Openshift中,您只能绑定到服务器为您分配的端口。通常,这是环境变量$ OPENSHIFT_JBOSS_PORT的值(它在墨盒之间变化),并且齿轮之间的值不同。绑定到任何其他端口将被报告为SELinux策略违规并被拒绝。

In Openshift, you may only bind to the port that the server allocates for you. Typically that is the value of the environment variable $OPENSHIFT_JBOSS_PORT (it varies between cartridges) and the value differs between gears. Binding to any other port will be reported as an SELinux policy violation and denied.

这篇关于无法绑定到Openshift上的端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 16:17