문제
HTTP 요청에 응답하기 위해 Jetty를 설정하려는 MULE 응용 프로그램이 있습니다. 다음 구성 :
<jetty:endpoint address="http://localhost:8080"
name="jettyEndpoint"
host="localhost"
port="8080" path="/"
synchronous="true" />
<service name="jettyUMO">
<inbound>
<jetty:inbound-endpoint ref="jettyEndpoint" />
</inbound>
<test:component appendString="Received" />
</service>
... 응용 프로그램을 시작할 때 작동하고 선택한 포인트 브라우저 http : // localhost : 8080 - 표시되는 모든 것은 테스트 : 구성 요소에 따라 "수신"입니다.
내가하고 싶은 것은 "수신"을 보지 않고 INDEX.html 파일을 정의한 곳으로 가고 싶습니다. 내 가정은 테스트를 변경해야한다는 것입니다 : 아웃 바운드 엔드 포인트의 구성 요소 - 이것이 맞습니까? 경로 (상대 또는 절대)는 어디에 지정합니까?
해결책
부두 : 커넥터 인스턴스를 추가해야했습니다.
<jetty:connector name="httpConnector"
configFile="conf/jettyConfig.xml"
useContinuations="true" />
다음은 jettyconfig.xml의 내용입니다 간단한 예 오류가 있습니다 :
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure id="Server" class="org.mortbay.jetty.Server">
<Call name="addConnector">
<Arg>
<New class="org.mortbay.jetty.nio.SelectChannelConnector">
<Set name="port">8080</Set>
</New>
</Arg>
</Call>
<Set name="handler">
<New id="Handlers" class="org.mortbay.jetty.handler.HandlerCollection">
<Set name="handlers">
<Array type="org.mortbay.jetty.Handler">
<Item>
<New id="Contexts" class="org.mortbay.jetty.handler.ContextHandlerCollection"/>
</Item>
<Item>
<New id="DefaultHandler" class="org.mortbay.jetty.handler.DefaultHandler"/>
</Item>
</Array>
</Set>
</New>
</Set>
<Call name="addLifeCycle">
<Arg>
<New class="org.mortbay.jetty.deployer.WebAppDeployer">
<Set name="contexts"><Ref id="Contexts"/></Set>
<Set name="webAppDir">path/webapps</Set>
</New>
</Arg>
</Call>
</Configure>
다른 팁
이것은 나를 위해 효과가 없었습니다.
> [04-22 17:25:22] WARN log [main]:
> failed SelectChannelConnector@0.0.0.0:8080
> java.net.BindException: Address already in use
> at sun.nio.ch.Net.bind(Native Method)
나는 한 인스턴스가 jettyconfig에 정의 된 포트에서, 다른 한 인스턴스가 뮬을 통해 만들어지고 있다고 생각합니다. JettyConfig에서 포트를 변경하면 두 개의 다른 포트에서 동일하게 작동하는 두 개의 인스턴스가 생성됩니다.
가장 간단한 솔루션은 JettyConfig.xml에서 AddConnector 호출을 제거하고 Mule이 포트를 할당하도록하는 것입니다.
또한 엔드 포인트에 호스트와 포트를 지정할 필요는 없습니다. 이것은 충분합니다 :
<jetty:endpoint address="http://localhost:8080" name="serverEndpoint" path="services/Foo" synchronous="false" />
제휴하지 않습니다 StackOverflow