apache(httpd)负载均衡器和restful请求

时间:2013-06-09 15:20:18

标签: java apache cxf load-balancing

我使用apache httpd作为负载均衡器,并且所有soap请求都正常工作,并且正在通过负载均衡器进行导航。但问题是我对负载均衡器的所有restfull请求都返回404。

我在这里附加了负载均衡器配置和java webservice代码:

 Listen 7060

<VirtualHost *:7060>
        ServerName domain.com
        ProxyRequests off
        <Proxy balancer://mycluster>

                # StartBalancerMember
                BalancerMember http://127.0.0.1:7071/
                BalancerMember http://127.0.0.1:7072/
                BalancerMember http://127.0.0.1:7073/
                BalancerMember http://127.0.0.1:7074/
                BalancerMember http://127.0.0.1:7075/
                BalancerMember http://127.0.0.1:7076/
                BalancerMember http://127.0.0.1:7077/
                BalancerMember http://127.0.0.1:7078/
                BalancerMember http://127.0.0.1:7079/
                # EndBalancerMember

                # Security "technically we aren't blocking anyone but this the place to make those chages
                Order Deny,Allow
                Deny from none
                Allow from all
                # Load Balancer Settings We will be configuring a simple Round Robin style load balancer.  This means that all webheads take an equal share of of the load.
                ProxySet lbmethod=byrequests
        </Proxy>
        # balancer-manager This tool is built into the mod_proxy_balancer module and will allow you to do some simple modifications to the balanced group via a gui web interface.
        <Location /balancer-manager>
                SetHandler balancer-manager
                # I recommend locking this one down to your your office
                Order deny,allow
                Allow from all
        </Location>
        # Point of Balance This setting will allow to explicitly name the the location in the site that we want to be balanced, in this example we will balance "/" or everything in the site.
        ProxyPass /balancer-manager !
        ProxyPass / balancer://mycluster/

</VirtualHost>


@Service
@Produces("application/json")
@Consumes("application/json")
@Path("/executionRest")
public class RestWebService {

    @Resource
    private ExecutionManager executionManager;

    @GET
    @Path("/restTest")
    public String testInvocation() {
        return "Rest test";
    }
}

如果我直接在浏览器中输入第一个成员uri:

http://localhost:7071/bdes/ws/rs/executionRest/restTest

我得到“休息测试”作为回应

但如果我进入浏览器:

http://localhost:7060/bdes/ws/rs/executionRest/restTest

我得到404!

我的负载均衡器中是否遗漏了某些内容或配置问题?

提前致谢

0 个答案:

没有答案