2016-05-11 1 views
0

私はBluemixに展開したい春のブートラクダHello Worldアプリケーションを持っている:Bluemix Libertyアプリケーションでカスタムポートをリッスンするにはどうすればよいですか?

import org.apache.camel.spring.boot.* 
import org.springframework.boot.* 
import org.springframework.boot.autoconfigure.* 
import org.springframework.context.* 
import org.springframework.context.annotation.* 
import org.springframework.scheduling.annotation.* 

@Configuration 
@ComponentScan 
@EnableAutoConfiguration 
@SpringBootApplication 
class Application extends FatJarRouter { 

    public static void main(String... args) { 
     ApplicationContext applicationContext = new SpringApplication(Application.class).run(args); 
     CamelSpringBootApplicationController applicationController = 
       applicationContext.getBean(CamelSpringBootApplicationController.class); 
     applicationController.run(); 
    } 

    @Override 
    public void configure() throws Exception { 
     from("netty4-http:http://0.0.0.0:18080"). 
      setBody().simple("ref:helloWorld"); 
    } 

    @Bean 
    String helloWorld() { 
     return "helloWorld"; 
    } 
} 

私もそれが有用である場合には、私のbuild.gradleを投稿しています:

buildscript { 
    repositories { 
     mavenCentral() 
    } 
    dependencies { 
     classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.3.RELEASE") 
    } 
} 
apply plugin: 'java' 
apply plugin: 'groovy' 
apply plugin: 'spring-boot' 
apply plugin: 'eclipse' 

jar { 
    baseName = 'EAI_Service' 
    version = '0.1.0' 
} 
repositories { 
    mavenCentral() 
} 
dependencies { 
    compile("org.codehaus.groovy:groovy-all:2.2.1") 
    compile("org.springframework.boot:spring-boot-starter-web:1.2.3.RELEASE") 

    compile("org.apache.camel:camel-core:2.17.0") 
    compile("org.apache.camel:camel-spring-boot-starter:2.17.0") 
    compile('org.apache.camel:camel-netty4-http:2.17.0') 
} 
task wrapper(type: Wrapper) { 
    gradleVersion = '2.0' 
} 

でBluemixログファイルが、私はラクダがポートにバインドしている見ることができます。

ServerBootstrap binding to 0.0.0.0:18080 
Netty consumer bound to: 0.0.0.0:18080 
Route: route1 started and consuming from: Endpoint[http://0.0.0.0:18080] 
Total 1 routes, of which 1 are started. 
Apache Camel 2.17.0 (CamelContext: camel-1) started in 0.590 seconds 
Tomcat started on port(s): 61649 (http) 
Started Application in 7.345 seconds (JVM running for 9.164) 
Apache Camel 2.17.0 (CamelContext: camel-1) is starting 
Total 1 routes, of which 1 are started. 
Apache Camel 2.17.0 (CamelContext: camel-1) started in 0.000 seconds 

はしかし、私が接続しようとすると、メッセージが返され、「接続が拒否されました」。私の使用例で

snowch$ curl <<myapp>>.mybluemix.net:18080 
curl: (7) Failed to connect to <myapp>>.mybluemix.net port 18080: Connection refused 

は、ラクダは、私はBluemixリバティアプリケーションのカスタムポートにバインドすることはできないと述べてquestion on developerWorksを見ているポート18080.で待機するように網状を使用しています。 DockerまたはVMを使用せずにこのユースケースをサポートする別の方法はありますか? Bluemixが実際に許可される唯一の1は、HTTP/HTTPSものであり、カスタムポートを使用することはできませんランタイム

答えて

1

、80および443

TCP上のIBMコンテナは、ポートのサブセットからカスタムポートを許可している、あなたとにかくドッカーファイルにそれらを公開する必要があります。

仮想サーバーベータ版では、カスタムポートを使用できるため、セキュリティポリシーをopenstackに応じて設定する必要があります(実際には安全でない場合でもすべてのポートを開く必要があります)

関連する問題