2010-06-17 6 views
2

아파치 CXF를 처음 사용하고 있습니다. CXF simple front end (Configuration notes) 기술을 기반으로 연결을 설정하려고합니다. 내가 잘못한 것을 실제로 볼 수는 없지만 이상한 오류가 발생합니다 (아래 참조). [email protected]에도이 질문을 올렸지 만 아직 응답을받지 못했습니다. 아마 여기 누군가가 도울 수 있습니다.Apache CXF (단순 프론트 엔드)의 문제점 : '이미 연결됨'

여기에 래핑 된 서비스 빈은 웹에 대해 아무것도 모르는 스프링/JPA 서비스입니다. 간단한 프론트 엔드를 사용하여 Jax-w 등으로 애노테이션을 작성하지 않고 웹 서비스로 게시하고자합니다. (이것은 이론적으로 작동합니다).

서버 :

<beans xmlns="http://www.springframework.org/schema/beans" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:simple="http://cxf.apache.org/simple" 
xmlns:soap="http://cxf.apache.org/bindings/soap" 
xmlns:context="http://www.springframework.org/schema/context" 
xmlns:cs="http://[www.mycompany.com]/coupon/service" 
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
    http://cxf.apache.org/bindings/soap http://cxf.apache.org/schemas/configuration/soap.xsd 
    http://cxf.apache.org/simple http://cxf.apache.org/schemas/simple.xsd 
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd" 
    default-autowire="byType" 
    > 

<import resource="classpath:META-INF/cxf/cxf.xml" /> 
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" /> 
<import resource="classpath:META-INF/cxf/cxf-extension-http.xml" /> 
<import resource="classpath:META-INF/cxf/cxf-extension-http-binding.xml" /> 
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" /> 

<!—my service implementation --> 
<import resource="classpath*:persistenceContext.xml" /> 

<!-- serviceClass points to an interface --> 
<simple:server id="server" serviceBean="couponService" 
    serviceClass="[com.mycompany].MyServiceInterface" 
    bindingId="http://apache.org/cxf/binding/http" 
    address="/${wsdl.path}" 
    serviceName="cs:couponService" 
    endpointName="cs:couponServicePort" 
    > 
    <simple:dataBinding> 
     <bean class="org.apache.cxf.aegis.databinding.AegisDatabinding" /> 
    </simple:dataBinding> 
    <simple:binding> 
     <soap:soapBinding version="1.2" mtomEnabled="true" /> 
    </simple:binding> 
</simple:server> 

<context:property-placeholder location="classpath:service.properties" /> 
</beans> 

클라이언트 :

<beans xmlns="http://www.springframework.org/schema/beans" 
xmlns:simple="http://cxf.apache.org/simple" 
xmlns:soap="http://cxf.apache.org/bindings/soap" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:aop="http://www.springframework.org/schema/aop" 
xmlns:context="http://www.springframework.org/schema/context" 
xmlns:oxm=http://www.springframework.org/schema/oxm 
xmlns:cs="http://[www.mycompany.com]/coupon/service" 
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
    http://cxf.apache.org/bindings/soap http://cxf.apache.org/schemas/configuration/soap.xsd 
    http://cxf.apache.org/simple http://cxf.apache.org/schemas/simple.xsd 
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd 
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd 
    http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-3.0.xsd" 
    default-autowire="byType" 
    > 


<import resource="classpath:META-INF/cxf/cxf.xml" /> 
<import resource="classpath:META-INF/cxf/cxf-extension-http.xml" /> 
<import resource="classpath:META-INF/cxf/cxf-extension-http-binding.xml" /> 
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" /> 


<simple:client id="couponService" wsdlLocation="${wsdl.url}?wsdl" 
    serviceName="cs:couponService" 
    endpointName="cs:couponServicePort" 
    transportId="http://schemas.xmlsoap.org/soap/http" 
    address="${wsdl.url}" 
    bindingId="http://apache.org/cxf/binding/http" 
    serviceClass="[com.mycompany].MyServiceInterface"> 
    <simple:dataBinding> 
     <bean class="org.apache.cxf.aegis.databinding.AegisDatabinding" /> 
    </simple:dataBinding> 
    <simple:binding> 
     <soap:soapBinding mtomEnabled="true" version="1.2" /> 
    </simple:binding> 
</simple:client> 

<context:property-placeholder location="classpath:service.properties" /> 
클라이언트 측에

, 나는 내 웹 응용 프로그램에 생성 된 서비스를 주입 (I 여기 내 구성입니다 개찰구를 사용하고 있지만 관련성이 없어야합니다.) 그리고 서비스 방법을 호출하면 접속이 벌써 열려있는 것을 나타내는 java.net.HttpURLConnection로부터의 IllegalStateException. 여기에 스택 트레이스는 다음과 같습니다

java.lang.IllegalStateException: IllegalStateException invoking http://localhost:9999/services/coupon: Already connected 
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) 
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:513) 
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:2058) 
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:2048) 
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66) 
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:639) 
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62) 
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243) 
at org.apache.cxf.binding.http.interceptor.DatabindingOutSetupInterceptor.handleMessage(DatabindingOutSetupInterceptor.java:91) 
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243) 
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:487) 
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313) 
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:265) 
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73) 
at org.apache.cxf.frontend.ClientProxy.invoke(ClientProxy.java:68) 
at $Proxy30.createIndividualUserCouponsJob(Unknown Source) 
at [com.mycompany].coupons.web.app.dummycontent.DummyContentInitializer.addSomeIndividualCoupons(DummyContentInitializer.java:84) 
at [com.mycompany].coupons.web.app.dummycontent.DummyContentInitializer.addSomeCoupons(DummyContentInitializer.java:68) 
at [com.mycompany].coupons.web.app.dummycontent.DummyContentInitializer.init(DummyContentInitializer.java:50) 
at org.apache.wicket.Application.callInitializers(Application.java:843) 
at org.apache.wicket.Application.initializeComponents(Application.java:678) 
at org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:725) 
at org.apache.wicket.protocol.http.WicketServlet.init(WicketServlet.java:219) 
at javax.servlet.GenericServlet.init(GenericServlet.java:241) 
at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:433) 
at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:256) 
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40) 
at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:617) 
at org.mortbay.jetty.servlet.Context.startContext(Context.java:139) 
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1218) 
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:500) 
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448) 
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40) 
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:117) 
at org.mortbay.jetty.Server.doStart(Server.java:220) 
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40) 
at [com.mycompany].coupons.web.test.Start.main(Start.java:45) 
Caused by: java.lang.IllegalStateException: Already connected 
at java.net.HttpURLConnection.setFixedLengthStreamingMode(HttpURLConnection.java:103) 
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.thresholdNotReached(HTTPConduit.java:1889) 
at org.apache.cxf.io.AbstractThresholdOutputStream.close(AbstractThresholdOutputStream.java:99) 
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1980) 

이 서비스 호출이되어 처음으로 발생하고, 그 전에 열려있는 유일한 URLConnection의이 WSDL의입니다.

비슷한 문제가있는 웹을 검색했지만 이미 수정 된 나머지를 사용하는 버그를 발견했습니다. 내 서비스에 jax-ws 주석을 주석으로 추가하지 않았으므로 간단한 프론트 엔드를 사용하려고합니다. 그런 식으로 유지하고 싶습니다.

누군가 도움을 줄 수 있습니까? 미리 감사드립니다.

답변

1

나는 해결책 나 자신을 발견 : 나는 (내가 정말이 :-)의 말을 이해하지 못하는)는 HTTP 도관에서 떨어져 청크 설정해야합니다. 어쨌든 다음과 같이 작동합니다.

<http-conf:conduit name="*.http-conduit"> 
    <http-conf:client AllowChunking="false" /> 
</http-conf:conduit> 
관련 문제