I'm attempting to set up a config file for Mule ESB 2.2.1 that routes incoming requests to another box. This seems straight forward, but I am getting connection refused exceptions and I'm not sure why. 

Here is the model from my Mule configuration file:

&lt;model name="ProxySample"&gt;
    &lt;service name="HttpProxyService"&gt;
        &lt;inbound&gt;
            &lt;http:inbound-endpoint address="http://localhost:8787" synchronous="true"/&gt;
        &lt;/inbound&gt;
        &lt;outbound&gt;
            &lt;pass-through-router&gt;
                &lt;outbound-endpoint address="http://server2.xyz.com:8080#[header:http.request]" synchronous="true"/&gt;
            &lt;/pass-through-router&gt;
        &lt;/outbound&gt;
    &lt;/service&gt;
&lt;/model&gt;


I am browsing to http://localhost:8787/my-site in my browser, thinking that it will route to http://server2.xyz.com:8080/my-site, but I get a connection refused error.

Here is the console output from the Mule server:

**********************************************************************
* Mule ESB and Integration Platform                                  *
* Version: 2.2.1 Build: 14422                                        *
* MuleSource, Inc.                                                   *
* For more information go to http://mule.mulesource.org              *
*                                                                    *
* Server started: 1/19/10 10:43 AM                                   *
* Server ID: 6802537d-0511-11df-bb89-710580f6c729                    *
* JDK: 1.6.0_18 (mixed mode, sharing)                                *
* OS encoding: UTF-8, Mule encoding: UTF-8                           *
* OS: Windows XP - Service Pack 3 (5.1, x86)                         *
* Host:                                      *
*                                                                    *
* Agents Running: None                                               *
**********************************************************************
INFO  2010-01-19 10:43:50,681 [connector.http.0.receiver.2] org.mule.transport.http.HttpClientMessageDispatcher: Connected: endpoint.outbound.http://localhost:8080#[header:http.request]
ERROR 2010-01-19 10:43:54,665 [connector.http.0.receiver.2] org.mule.DefaultExceptionStrategy: 
********************************************************************************
Message               : Failed to route event via endpoint: org.mule.endpoint.DynamicURIOutboundEndpoint@6645e149. Message payload is of type: GetMethod
Type                  : org.mule.api.transport.DispatchException
Code                  : MULE_ERROR-42999
Payload               : org.apache.commons.httpclient.methods.GetMethod@d67067
JavaDoc               : http://www.mulesource.org/docs/site/current2/apidocs/org/mule/api/transport/DispatchException.html
********************************************************************************
Exception stack is:
1. Connection refused: connect (java.net.ConnectException)
  java.net.PlainSocketImpl:-2 (null)
2. Failed to route event via endpoint: org.mule.endpoint.DynamicURIOutboundEndpoint@6645e149. Message payload is of type: GetMethod (org.mule.api.transport.DispatchException)
  org.mule.transport.http.HttpClientMessageDispatcher:127 (http://www.mulesource.org/docs/site/current2/apidocs/org/mule/api/transport/DispatchException.html)
********************************************************************************
Root Exception stack trace:
java.net.ConnectException: Connection refused: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
    at java.net.Socket.connect(Socket.java:525)
    at java.net.Socket.connect(Socket.java:475)
    at java.net.Socket.&lt;init&gt;(Socket.java:372)
    at java.net.Socket.&lt;init&gt;(Socket.java:246)
    at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:80)
    at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:122)
    at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
    at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)
    at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
    at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
    at org.mule.transport.http.HttpClientMessageDispatcher.execute(HttpClientMessageDispatcher.java:120)
    at org.mule.transport.http.HttpClientMessageDispatcher.doSend(HttpClientMessageDispatcher.java:258)
    at org.mule.transport.AbstractMessageDispatcher.send(AbstractMessageDispatcher.java:163)
    at org.mule.transport.AbstractConnector.send(AbstractConnector.java:2016)
    at org.mule.endpoint.DynamicURIOutboundEndpoint.send(DynamicURIOutboundEndpoint.java:178)
    at org.mule.DefaultMuleSession.sendEvent(DefaultMuleSession.java:327)
    at org.mule.DefaultMuleSession.sendEvent(DefaultMuleSession.java:213)
    at org.mule.routing.outbound.AbstractOutboundRouter$2.doInTransaction(AbstractOutboundRouter.java:152)
    at org.mule.transaction.TransactionTemplate.execute(TransactionTemplate.java:99)
    at org.mule.routing.outbound.AbstractOutboundRouter.send(AbstractOutboundRouter.java:159)
    at org.mule.routing.outbound.ChainingRouter.route(ChainingRouter.java:123)
    at org.mule.routing.outbound.DefaultOutboundRouterCollection$1.doInTransaction(DefaultOutboundRouterCollection.java:88)
    at org.mule.transaction.TransactionTemplate.execute(TransactionTemplate.java:45)
    at org.mule.routing.outbound.DefaultOutboundRouterCollection.route(DefaultOutboundRouterCollection.java:93)
    at org.mule.service.AbstractService.sendToOutboundRouter(AbstractService.java:892)
    at org.mule.model.seda.SedaService.doSend(SedaService.java:258)
    at org.mule.service.AbstractService.sendEvent(AbstractService.java:500)
    at org.mule.DefaultMuleSession.sendEvent(DefaultMuleSession.java:354)
    at org.mule.routing.inbound.DefaultInboundRouterCollection.send(DefaultInboundRouterCollection.java:228)
    at org.mule.routing.inbound.DefaultInboundRouterCollection.route(DefaultInboundRouterCollection.java:188)
    at org.mule.transport.AbstractMessageReceiver$DefaultInternalMessageListener.onMessage(AbstractMessageReceiver.java:364)
    at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:252)
    at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:193)
    at org.mule.transport.http.HttpMessageReceiver$HttpWorker.doRequest(HttpMessageReceiver.java:273)
    at org.mule.transport.http.HttpMessageReceiver$HttpWorker.processRequest(HttpMessageReceiver.java:227)
    at org.mule.transport.http.HttpMessageReceiver$HttpWorker.run(HttpMessageReceiver.java:190)
    at org.mule.work.WorkerContext.run(WorkerContext.java:310)
    at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)
    at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
    at java.lang.Thread.run(Thread.java:619)

********************************************************************************

INFO  2010-01-19 10:43:54,665 [connector.http.0.receiver.2] org.mule.transaction.TransactionTemplate: Exception Caught in Transaction template.  Handing off to exception handler: org.mule.service.DefaultServiceExceptionStrategy@1412e75
ERROR 2010-01-19 10:43:54,665 [connector.http.0.receiver.2] org.mule.service.DefaultServiceExceptionStrategy: 
********************************************************************************
Message               : Failed to route event via endpoint: org.mule.endpoint.DynamicURIOutboundEndpoint@6645e149. Message payload is of type: GetMethod
Type                  : org.mule.api.transport.DispatchException
Code                  : MULE_ERROR-42999
Payload               : org.apache.commons.httpclient.methods.GetMethod@d67067
JavaDoc               : http://www.mulesource.org/docs/site/current2/apidocs/org/mule/api/transport/DispatchException.html
********************************************************************************
Exception stack is:
1. Connection refused: connect (java.net.ConnectException)
  java.net.PlainSocketImpl:-2 (null)
2. Failed to route event via endpoint: org.mule.endpoint.DynamicURIOutboundEndpoint@6645e149. Message payload is of type: GetMethod (org.mule.api.transport.DispatchException)
  org.mule.transport.http.HttpClientMessageDispatcher:127 (http://www.mulesource.org/docs/site/current2/apidocs/org/mule/api/transport/DispatchException.html)
********************************************************************************
Root Exception stack trace:
java.net.ConnectException: Connection refused: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
    at java.net.Socket.connect(Socket.java:525)
    at java.net.Socket.connect(Socket.java:475)
    at java.net.Socket.&lt;init&gt;(Socket.java:372)
    at java.net.Socket.&lt;init&gt;(Socket.java:246)
    at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:80)
    at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:122)
    at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
    at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)
    at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
    at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
    at org.mule.transport.http.HttpClientMessageDispatcher.execute(HttpClientMessageDispatcher.java:120)
    at org.mule.transport.http.HttpClientMessageDispatcher.doSend(HttpClientMessageDispatcher.java:258)
    at org.mule.transport.AbstractMessageDispatcher.send(AbstractMessageDispatcher.java:163)
    at org.mule.transport.AbstractConnector.send(AbstractConnector.java:2016)
    at org.mule.endpoint.DynamicURIOutboundEndpoint.send(DynamicURIOutboundEndpoint.java:178)
    at org.mule.DefaultMuleSession.sendEvent(DefaultMuleSession.java:327)
    at org.mule.DefaultMuleSession.sendEvent(DefaultMuleSession.java:213)
    at org.mule.routing.outbound.AbstractOutboundRouter$2.doInTransaction(AbstractOutboundRouter.java:152)
    at org.mule.transaction.TransactionTemplate.execute(TransactionTemplate.java:99)
    at org.mule.routing.outbound.AbstractOutboundRouter.send(AbstractOutboundRouter.java:159)
    at org.mule.routing.outbound.ChainingRouter.route(ChainingRouter.java:123)
    at org.mule.routing.outbound.DefaultOutboundRouterCollection$1.doInTransaction(DefaultOutboundRouterCollection.java:88)
    at org.mule.transaction.TransactionTemplate.execute(TransactionTemplate.java:45)
    at org.mule.routing.outbound.DefaultOutboundRouterCollection.route(DefaultOutboundRouterCollection.java:93)
    at org.mule.service.AbstractService.sendToOutboundRouter(AbstractService.java:892)
    at org.mule.model.seda.SedaService.doSend(SedaService.java:258)
    at org.mule.service.AbstractService.sendEvent(AbstractService.java:500)
    at org.mule.DefaultMuleSession.sendEvent(DefaultMuleSession.java:354)
    at org.mule.routing.inbound.DefaultInboundRouterCollection.send(DefaultInboundRouterCollection.java:228)
    at org.mule.routing.inbound.DefaultInboundRouterCollection.route(DefaultInboundRouterCollection.java:188)
    at org.mule.transport.AbstractMessageReceiver$DefaultInternalMessageListener.onMessage(AbstractMessageReceiver.java:364)
    at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:252)
    at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:193)
    at org.mule.transport.http.HttpMessageReceiver$HttpWorker.doRequest(HttpMessageReceiver.java:273)
    at org.mule.transport.http.HttpMessageReceiver$HttpWorker.processRequest(HttpMessageReceiver.java:227)
    at org.mule.transport.http.HttpMessageReceiver$HttpWorker.run(HttpMessageReceiver.java:190)
    at org.mule.work.WorkerContext.run(WorkerContext.java:310)
    at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)
    at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
    at java.lang.Thread.run(Thread.java:619)

********************************************************************************

ERROR 2010-01-19 10:43:54,665 [connector.http.0.receiver.2] org.mule.service.DefaultServiceExceptionStrategy: 
********************************************************************************
Message               : Failed to route event via endpoint: org.mule.endpoint.DynamicURIOutboundEndpoint@6645e149. Message payload is of type: GetMethod
Type                  : org.mule.api.transport.DispatchException
Code                  : MULE_ERROR-42999
Payload               : org.apache.commons.httpclient.methods.GetMethod@d67067
JavaDoc               : http://www.mulesource.org/docs/site/current2/apidocs/org/mule/api/transport/DispatchException.html
********************************************************************************
Exception stack is:
1. Connection refused: connect (java.net.ConnectException)
  java.net.PlainSocketImpl:-2 (null)
2. Failed to route event via endpoint: org.mule.endpoint.DynamicURIOutboundEndpoint@6645e149. Message payload is of type: GetMethod (org.mule.api.transport.DispatchException)
  org.mule.transport.http.HttpClientMessageDispatcher:127 (http://www.mulesource.org/docs/site/current2/apidocs/org/mule/api/transport/DispatchException.html)
********************************************************************************
Root Exception stack trace:
java.net.ConnectException: Connection refused: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
    at java.net.Socket.connect(Socket.java:525)
    at java.net.Socket.connect(Socket.java:475)
    at java.net.Socket.&lt;init&gt;(Socket.java:372)
    at java.net.Socket.&lt;init&gt;(Socket.java:246)
    at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:80)
    at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:122)
    at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
    at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)
    at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
    at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
    at org.mule.transport.http.HttpClientMessageDispatcher.execute(HttpClientMessageDispatcher.java:120)
    at org.mule.transport.http.HttpClientMessageDispatcher.doSend(HttpClientMessageDispatcher.java:258)
    at org.mule.transport.AbstractMessageDispatcher.send(AbstractMessageDispatcher.java:163)
    at org.mule.transport.AbstractConnector.send(AbstractConnector.java:2016)
    at org.mule.endpoint.DynamicURIOutboundEndpoint.send(DynamicURIOutboundEndpoint.java:178)
    at org.mule.DefaultMuleSession.sendEvent(DefaultMuleSession.java:327)
    at org.mule.DefaultMuleSession.sendEvent(DefaultMuleSession.java:213)
    at org.mule.routing.outbound.AbstractOutboundRouter$2.doInTransaction(AbstractOutboundRouter.java:152)
    at org.mule.transaction.TransactionTemplate.execute(TransactionTemplate.java:99)
    at org.mule.routing.outbound.AbstractOutboundRouter.send(AbstractOutboundRouter.java:159)
    at org.mule.routing.outbound.ChainingRouter.route(ChainingRouter.java:123)
    at org.mule.routing.outbound.DefaultOutboundRouterCollection$1.doInTransaction(DefaultOutboundRouterCollection.java:88)
    at org.mule.transaction.TransactionTemplate.execute(TransactionTemplate.java:45)
    at org.mule.routing.outbound.DefaultOutboundRouterCollection.route(DefaultOutboundRouterCollection.java:93)
    at org.mule.service.AbstractService.sendToOutboundRouter(AbstractService.java:892)
    at org.mule.model.seda.SedaService.doSend(SedaService.java:258)
    at org.mule.service.AbstractService.sendEvent(AbstractService.java:500)
    at org.mule.DefaultMuleSession.sendEvent(DefaultMuleSession.java:354)
    at org.mule.routing.inbound.DefaultInboundRouterCollection.send(DefaultInboundRouterCollection.java:228)
    at org.mule.routing.inbound.DefaultInboundRouterCollection.route(DefaultInboundRouterCollection.java:188)
    at org.mule.transport.AbstractMessageReceiver$DefaultInternalMessageListener.onMessage(AbstractMessageReceiver.java:364)
    at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:252)
    at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:193)
    at org.mule.transport.http.HttpMessageReceiver$HttpWorker.doRequest(HttpMessageReceiver.java:273)
    at org.mule.transport.http.HttpMessageReceiver$HttpWorker.processRequest(HttpMessageReceiver.java:227)
    at org.mule.transport.http.HttpMessageReceiver$HttpWorker.run(HttpMessageReceiver.java:190)
    at org.mule.work.WorkerContext.run(WorkerContext.java:310)
    at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)
    at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
    at java.lang.Thread.run(Thread.java:619)

********************************************************************************



Question: In Photoshop, is there a way to turn a vector object into a mask and keep it editable?
Answer: Yes, there's quite a few ways to achieve this.

If you want to paste objects from Illustrator as Smart Objects, then you can use is a a clipping mask for layers above. To clip a layer above the Smart Object, option-click between the layers. You should end up with something like this.



That's not how I'd do it though. The simpler option is just to have a vector mask on your bitmap layer (or vector layer, gradient, pattern or text). To do this, paste your path(s) from Illustrator as a Shape Object (very important!). You'll end up with something like this.



That's a shape layer in Photoshop CS6 (CS5 and earlier versions are similar).

If you'd like to use that path as a mask on another layer, select it using the Path Selection tool (A), then press command-C to copy it.

Then go to the bitmap layer you'd like to apply the vector mask to, and press command-V to paste.



Then choose Layer > Vector Mask > Current Path to use the path as the mask (this was slightly easier in CS5, as it could be all done by option-dragging the vector mask from one layer to another).

You'll end up with a bitmap layer with a vector mask.



Why is this better? It's one layer, not two. Your vector mask is still editable. You can also now clip other layers to this layer.

There's a lot of reasons why I don't like using Smart Objects. In most cases, Shape layers are better, unless you need the Smart Object to contain more than one colour or gradient itself, which is pretty rare for me.

There's a few other ways to mask, including using group masks. It really depends on what's important though.