2

I am trying to implement clustering in Mulesoft. My intention is to deploy an application to the cluster of application servers. I have installed a Mule server each in two physical machines which I have binded to a cluster. Then I created a Mule application which listens to HTTP endpoint to trigger a mail. I have problem in deploying application to the created Mule cluster through MMC.

Click to see the cluster of servers The application gets deployed to one of the servers in the cluster and the problem exists in deployment to the other server. The error I am getting is:

   *ERROR 2016-10-21 21:52:09,283 [qtp1451192493-104]         org.mule.module.launcher.DefaultArchiveDeployer: 

org.mule.module.launcher.DeploymentStartException:     BindException: Address already in use: bind
    at    org.mule.module.launcher.application.DefaultMuleApplication.start(DefaultMuleApplication.java:156) ~[?:?]
    at org.mule.module.launcher.artifact.ArtifactWrapper$4.execute(ArtifactWrapper.java:98) ~[?:?]
    at org.mule.module.launcher.artifact.ArtifactWrapper.executeWithinArtifactClassLoader(ArtifactWrapper.java:129) ~[?:?]
    at org.mule.module.launcher.artifact.ArtifactWrapper.start(ArtifactWrapper.java:93) ~[?:?]
    at org.mule.module.launcher.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:26) ~[?:?]
    at org.mule.module.launcher.DefaultArchiveDeployer.guardedDeploy(DefaultArchiveDeployer.java:310) ~[?:?]
    at org.mule.module.launcher.DefaultArchiveDeployer.deployArtifact(DefaultArchiveDeployer.java:330) ~[?:?]
    at org.mule.module.launcher.DefaultArchiveDeployer.deployPackagedArtifact(DefaultArchiveDeployer.java:155) ~[?:?]
    at org.mule.module.launcher.MuleDeploymentService.deploy(MuleDeploymentService.java:192) ~[?:?]
    at com.mulesoft.mmc.agent.service.impl.ApplicationServiceImpl.deploy(ApplicationServiceImpl.java:302) ~[?:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_77]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_77]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_77]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_77]
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) ~[?:?]
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:201) ~[?:?]
    at com.sun.proxy.$Proxy45.deploy(Unknown Source) ~[?:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_77]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_77]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_77]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_77]
    at org.springframework.remoting.support.RemoteInvocation.invoke(RemoteInvocation.java:212) ~[?:?]
    at com.mulesoft.common.remoting.RemoteInvocationDecorator.invoke(RemoteInvocationDecorator.java:107) ~[?:?]
    at org.springframework.remoting.support.DefaultRemoteInvocationExecutor.invoke(DefaultRemoteInvocationExecutor.java:39) ~[?:?]
    at org.springframework.remoting.support.RemoteInvocationBasedExporter.invoke(RemoteInvocationBasedExporter.java:78) ~[?:?]
    at com.mulesoft.common.remoting.StreamSupportingHttpInvokerServiceExporter.invokeAndCreateResult(StreamSupportingHttpInvokerServiceExporter.java:122) ~[?:?]
    at org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter.handleRequest(HttpInvokerServiceExporter.java:74) ~[?:?]
    at com.mulesoft.mmc.agent.remoting.HttpInvokerServiceExporter.handleRequest(HttpInvokerServiceExporter.java:50) ~[?:?]
    at org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:51) ~[?:?]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959) ~[?:?]
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893) ~[?:?]
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966) ~[?:?]
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868) ~[?:?]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:595) ~[?:?]
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842) ~[?:?]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:668) ~[?:?]
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:696) ~[?:?]
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1515) ~[?:?]
    at com.mulesoft.mmc.agent.web.ConsoleClientCertFilter.doFilter(ConsoleClientCertFilter.java:138) ~[?:?]
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1495) ~[?:?]
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:519) ~[?:?]
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:138) ~[?:?]
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:564) ~[?:?]
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:213) ~[?:?]
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1097) ~[?:?]
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:448) ~[?:?]
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:175) ~[?:?]
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1031) ~[?:?]
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:136) ~[?:?]
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) ~[?:?]
    at org.eclipse.jetty.server.Server.handle(Server.java:446) ~[?:?]
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:271) ~[?:?]
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:246) ~[?:?]
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.run(AbstractConnection.java:358) ~[?:?]
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:601) ~[?:?]
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:532) ~[?:?]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_77]
Caused by: org.mule.api.lifecycle.LifecycleException: Failed to invoke lifecycle phase "start" on object: org.mule.module.http.internal.listener.DefaultHttpListenerConfig@30206033
    at org.mule.lifecycle.phases.DefaultLifecyclePhase.applyLifecycle(DefaultLifecyclePhase.java:248) ~[?:?]
    at org.mule.lifecycle.RegistryLifecycleCallback.doApplyLifecycle(RegistryLifecycleCallback.java:91) ~[?:?]
    at org.mule.lifecycle.RegistryLifecycleCallback.onTransition(RegistryLifecycleCallback.java:67) ~[?:?]
    at org.mule.lifecycle.RegistryLifecycleManager.invokePhase(RegistryLifecycleManager.java:140) ~[?:?]
    at org.mule.lifecycle.RegistryLifecycleManager.fireLifecycle(RegistryLifecycleManager.java:111) ~[?:?]
    at org.mule.registry.AbstractRegistryBroker.fireLifecycle(AbstractRegistryBroker.java:88) ~[?:?]
    at org.mule.registry.MuleRegistryHelper.fireLifecycle(MuleRegistryHelper.java:141) ~[?:?]
    at org.mule.lifecycle.MuleContextLifecycleManager$MuleContextLifecycleCallback.onTransition(MuleContextLifecycleManager.java:91) ~[?:?]
    at org.mule.lifecycle.MuleContextLifecycleManager$MuleContextLifecycleCallback.onTransition(MuleContextLifecycleManager.java:87) ~[?:?]
    at org.mule.lifecycle.MuleContextLifecycleManager.invokePhase(MuleContextLifecycleManager.java:69) ~[?:?]
    at org.mule.lifecycle.MuleContextLifecycleManager.fireLifecycle(MuleContextLifecycleManager.java:61) ~[?:?]
    at org.mule.DefaultMuleContext.start(DefaultMuleContext.java:294) ~[?:?]
    at org.mule.module.launcher.application.DefaultMuleApplication.start(DefaultMuleApplication.java:134) ~[?:?]
    ... 56 more
Caused by: org.mule.api.DefaultMuleException: Address already in use: bind (java.net.BindException)
    at org.mule.module.http.internal.listener.DefaultHttpListenerConfig.start(DefaultHttpListenerConfig.java:275) ~[?:?]
    at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source) ~[?:?]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_77]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_77]
    at org.mule.lifecycle.phases.DefaultLifecyclePhase.applyLifecycle(DefaultLifecyclePhase.java:237) ~[?:?]
    at org.mule.lifecycle.RegistryLifecycleCallback.doApplyLifecycle(RegistryLifecycleCallback.java:91) ~[?:?]
    at org.mule.lifecycle.RegistryLifecycleCallback.onTransition(RegistryLifecycleCallback.java:67) ~[?:?]
    at org.mule.lifecycle.RegistryLifecycleManager.invokePhase(RegistryLifecycleManager.java:140) ~[?:?]
    at org.mule.lifecycle.RegistryLifecycleManager.fireLifecycle(RegistryLifecycleManager.java:111) ~[?:?]
    at org.mule.registry.AbstractRegistryBroker.fireLifecycle(AbstractRegistryBroker.java:88) ~[?:?]
    at org.mule.registry.MuleRegistryHelper.fireLifecycle(MuleRegistryHelper.java:141) ~[?:?]
    at org.mule.lifecycle.MuleContextLifecycleManager$MuleContextLifecycleCallback.onTransition(MuleContextLifecycleManager.java:91) ~[?:?]
    at org.mule.lifecycle.MuleContextLifecycleManager$MuleContextLifecycleCallback.onTransition(MuleContextLifecycleManager.java:87) ~[?:?]
    at org.mule.lifecycle.MuleContextLifecycleManager.invokePhase(MuleContextLifecycleManager.java:69) ~[?:?]
    at org.mule.lifecycle.MuleContextLifecycleManager.fireLifecycle(MuleContextLifecycleManager.java:61) ~[?:?]
    at org.mule.DefaultMuleContext.start(DefaultMuleContext.java:294) ~[?:?]
    at org.mule.module.launcher.application.DefaultMuleApplication.start(DefaultMuleApplication.java:134) ~[?:?]
    ... 56 more
Caused by: java.net.BindException: Address already in use: bind
    at sun.nio.ch.Net.bind0(Native Method) ~[?:1.8.0_77]
    at sun.nio.ch.Net.bind(Unknown Source) ~[?:1.8.0_77]
    at sun.nio.ch.Net.bind(Unknown Source) ~[?:1.8.0_77]
    at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source) ~[?:1.8.0_77]
    at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source) ~[?:1.8.0_77]
    at org.glassfish.grizzly.nio.transport.TCPNIOBindingHandler.bindToChannelAndAddress(TCPNIOBindingHandler.java:131) ~[?:?]
    at org.glassfish.grizzly.nio.transport.TCPNIOBindingHandler.bind(TCPNIOBindingHandler.java:88) ~[?:?]
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.bind(TCPNIOTransport.java:248) ~[?:?]
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.bind(TCPNIOTransport.java:228) ~[?:?]
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.bind(TCPNIOTransport.java:219) ~[?:?]
    at org.mule.module.http.internal.listener.grizzly.GrizzlyServer.start(GrizzlyServer.java:41) ~[?:?]
    at org.mule.module.http.internal.listener.DefaultHttpListenerConfig.start(DefaultHttpListenerConfig.java:271) ~[?:?]
    at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source) ~[?:?]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_77]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_77]
    at org.mule.lifecycle.phases.DefaultLifecyclePhase.applyLifecycle(DefaultLifecyclePhase.java:237) ~[?:?]
    at org.mule.lifecycle.RegistryLifecycleCallback.doApplyLifecycle(RegistryLifecycleCallback.java:91) ~[?:?]
    at org.mule.lifecycle.RegistryLifecycleCallback.onTransition(RegistryLifecycleCallback.java:67) ~[?:?]
    at org.mule.lifecycle.RegistryLifecycleManager.invokePhase(RegistryLifecycleManager.java:140) ~[?:?]
    at org.mule.lifecycle.RegistryLifecycleManager.fireLifecycle(RegistryLifecycleManager.java:111) ~[?:?]
    at org.mule.registry.AbstractRegistryBroker.fireLifecycle(AbstractRegistryBroker.java:88) ~[?:?]
    at org.mule.registry.MuleRegistryHelper.fireLifecycle(MuleRegistryHelper.java:141) ~[?:?]
    at org.mule.lifecycle.MuleContextLifecycleManager$MuleContextLifecycleCallback.onTransition(MuleContextLifecycleManager.java:91) ~[?:?]
    at org.mule.lifecycle.MuleContextLifecycleManager$MuleContextLifecycleCallback.onTransition(MuleContextLifecycleManager.java:87) ~[?:?]
    at org.mule.lifecycle.MuleContextLifecycleManager.invokePhase(MuleContextLifecycleManager.java:69) ~[?:?]
    at org.mule.lifecycle.MuleContextLifecycleManager.fireLifecycle(MuleContextLifecycleManager.java:61) ~[?:?]
    at org.mule.DefaultMuleContext.start(DefaultMuleContext.java:294) ~[?:?]
    at org.mule.module.launcher.application.DefaultMuleApplication.start(DefaultMuleApplication.java:134) ~[?:?]
    ... 56 more

Is there any specific configuration change to be done for clustering deployment? Anyone please help me out.

Also suggestions related to BAM are most welcome

4 Answers4

1

As the log says your HTTP Listener is trying to use a port that is already used

Caused by: java.net.BindException: Address already in use: bind

Use an OS tool to find out which process is using that port.

Ale Sequeira
  • 2,039
  • 1
  • 11
  • 19
  • Thanks @Ale Sequiera. I tried checking that. Should not stop that as ports 7778 and 7779 were used by either of the servers in the cluster. Also,is this related to HTTP inbound endpoint directly not being able to support clustering,since the error occurs while having HTTP as inbound connector and the error does not occur with JMS queue in place? – Hari shankar Oct 25 '16 at 13:24
0

As you are deploying your application through Mule Management Console to frame a cluster.You should expose the application endpoint of HTTP inbound endpoint as "localhost:portnumber".Here in your scenario as both the servers are in same device.

TWO MULE SERVER INSTANCE IN A SINGLE MACHINE

The endpoint of serverA will be depicted as machineAIP:8080 and serverB will be also as machineIPA:8080.Here it arises the binding exception

TWO MULE SERVER INSTANCE IN TWO DIFFERENT MACHINES

The endpoint of serverA will be depicted as machineAIP:8080 and serverB will be also as machineIPB:8080.Here it differentiates with the help of machine IP.

Hence ,It is always good to go with two different servers.If you are creating two mule server instance with the same machine would result in issues related to exposing same endpoints.We need to use two different machines to enhance the high availability.It also ensures that crashing of the machine won't affect the functioning of clustered server.

Deploy the application using two different machines (Each machine has one mule server instance with it) and also the port number you are specifying in inbound endpoints are not in use.

If my answer gives you a solution. Happy coding :)

0

Based on the exception -

Caused by: java.net.BindException: Address already in use: bind

This could cause because of two reason -

  1. the port used for the mule application through HTTP connector is already been used at the server level - Hence try to change the port and make sure that port is not in use.

  2. If you are deploying an mule application using MMC in a cluster environment then you have to configure your HTTP connector with either localhost OR 0.0.0.0 port so that it will take the localhost ref while deploying in the server/nodes under the cluster.

Note, when you use localhost OR 0.0.0.0 then the apps will be deployed in the nodes and your load balancer will point to the node address (host dns) and then it will rediect the call to both nodes with the port you mentioned in the http connector.

Please try and let me know if it resolves the issue.

Sanjeet Pandey
  • 546
  • 4
  • 23
0

ref to my another answer - use this for reference

<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8080" doc:name="HTTP Listener Configuration"/> 

<flow name="sample-http-appFlow"> 
    <http:listener config-ref="HTTP_Listener_Configuration" path="flow1" doc:name="HTTP"/> 
    <logger message="Payload is #[message.payload]" level="INFO" doc:name="Logger"/> 
</flow> 
<flow name="sample-http-appFlow1"> 
    <http:listener config-ref="HTTP_Listener_Configuration" path="flow2" doc:name="HTTP"/> 
    <logger message="Payload is #[message.payload]" level="INFO" doc:name="Logger"/> 
</flow>
Sanjeet Pandey
  • 546
  • 4
  • 23