exposing mule http inbound endpoint

2019-09-16 19:53发布

问题:

Am unable to expose http endpoint/address on a CentOS server. The most confusing part is we are able to expose other endpoints as ajax etc which are in the example package of mule installation. I am unable to expose this simple echo flow either. I even tried an alternative of explicitly defining an http connector for the endpoint to refer.. still it doesn't work. Am really unable to understand what's going wrong... this post 9002 is not even showing up in netstat after I deploy the app to mule server successfully...

Here's the code:

<mule xmlns="http://www.mulesoft.org/schema/mule/core"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:http="http://www.mulesoft.org/schema/mule/http"
xsi:schemalocation="
    http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.2/mule.xsd
    http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/3.2/mule-http.xsd"> 

<description>
    Sample Flows
</description>

<flow name="echo-flow">
    <http:inbound-endpoint address="http://0.0.0.0:9002/echo" />
    <echo-component />
</flow>

and am using below pom.xml though this sample app does not require all the transports and modules in it am using them in my original app so using the same with this.

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>mule.user</groupId>
  <artifactId>valexIntegration-esb</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <packaging>mule</packaging>

  <name>Self-Contained Standalone Mule Hello World</name>
  <description>The sources for this application were copied from Mule distributable</description>

  <properties>
    <mule.version>3.3.0</mule.version>
  </properties>

  <build>
  <plugins>
            <plugin>
                <groupId>org.mule.tools</groupId>
                <artifactId>maven-mule-plugin</artifactId>
                <version>1.7</version>
                <extensions>true</extensions>
            </plugin>
  </plugins>
    <resources>
      <resource>
        <directory>src/main/app</directory>
      </resource>
      <resource>
        <directory>src/main/resources</directory>
      </resource>
    </resources>
  </build>

  <dependencies>
    <dependency>
      <groupId>org.codehaus.groovy</groupId>
      <artifactId>groovy-all</artifactId>
      <version>1.8.1</version>
    </dependency>

    <dependency>
      <groupId>org.mule</groupId>
      <artifactId>mule-core</artifactId>
      <version>${mule.version}</version>
    </dependency>

    <dependency>
      <groupId>org.mule</groupId>
      <artifactId>mule-core</artifactId>
      <version>${mule.version}</version>
      <scope>test</scope>
      <type>test-jar</type>
    </dependency>

    <dependency>
      <groupId>org.mule.modules</groupId>
      <artifactId>mule-module-builders</artifactId>
      <version>${mule.version}</version>
    </dependency>

    <dependency>
      <groupId>org.mule.modules</groupId>
      <artifactId>mule-module-scripting</artifactId>
      <version>${mule.version}</version>
    </dependency>

    <dependency>
      <groupId>org.mule.transports</groupId>
      <artifactId>mule-transport-vm</artifactId>
      <version>${mule.version}</version>
    </dependency>

    <dependency>
      <groupId>org.mule.transports</groupId>
      <artifactId>mule-transport-http</artifactId>
      <version>${mule.version}</version>
    </dependency>

    <dependency>
      <groupId>org.mule.transports</groupId>
      <artifactId>mule-transport-servlet</artifactId>
      <version>${mule.version}</version>
    </dependency>

    <dependency>
      <groupId>org.mule.transports</groupId>
      <artifactId>mule-transport-stdio</artifactId>
      <version>${mule.version}</version>
    </dependency>

    <dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>5.1.9</version>
    </dependency>
  </dependencies>

  <repositories>
    <repository>
      <id>mule-deps</id>
      <name>Mule Dependencies</name>
      <url>http://dist.codehaus.org/mule/dependencies/maven2</url>
    </repository>
  </repositories>
</project>

回答1:

It seems that the problem is not in the flow configuration or even in mule itself. I'd advice you to look for clues in the Operating System realm, for example:

  1. Is the port 9002 available in all of the server's network interfaces? Since you're trying to bind it to the 0.0.0.0 address, it will try and bind them to all interfaces.

  2. Is there some error in the mule startup log? Or does it start ok?

  3. If there is no error, can you access the address from inside the server? Not only 127.0.0.1:9002, but all other possible network interfaces (and their respective IP addresses).

  4. If you can access from inside the machine, but not from the outside (or even if you can't access from the inside), have you checked if there is some firewall rule or some port blocking or some other security measure enforced in this server? Consider not only kernel and inner rules but also network rules in routers or firewalls.

Please, provide us the mule startup log so we can have more clues of what can be going on.



标签: http mule