I think you need to be calling stop() for your test case--look at my
tearDown() method in Step #2, substep #3 here:
http://www.jroller.com/gmazza/date/20080904

On Linux you can also manually kill the process from the command line:
fuser -k {port number of web service provider}/tcp

But stop() above should be easier and cleaner.

HTH,
Glen


shrimpywu wrote:
> 
> Hi, Now i got another problem,
> the test runs fine, but when i try to run the service in jetty.  mvn
> jetty:run
> 
> i got "Address already in used" exception.
> 
> i saw the only different between your spring-test.xml and mine is that,
> you included    <import
> resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />
> but mine one is <import resource="classpath:META-INF/cxf/cxf-servlet.xml"
> />
> 
> when i use my one, i can run the app, but cannot run the test,
> when i use your one, i can run the test, but cannot run the service by mvn
> jetty:run
> 
> can you help me to solve this issue?
> 
> Regards
> 
> 
> dkulp wrote:
>> 
>> 
>> The problem is with your spring-test.xml file.    Nowhere do you actually 
>> startup a service on that port/url.  You have the service factory
>> configured, 
>> but nothing actually uses it.   I've included a new spring-test.xml below 
>> that allows the test to pass.
>> 
>> Dan
>> 
>> 
>> 
>> On Wednesday 17 December 2008 1:54:45 am shrimpywu wrote:
>>> Hi everyone, i am new with CXF, just recently jump into it.
>>>
>>> I do search from google, and there is a small sample for cxf with
>>> maven(i
>>> am big fans of maven),
>>> but unfortunately the test doesn`t run, i always get exception as what i
>>> paste below.
>>>
>>> i try to run it without junit tests, it work just fine, i can see the
>>> WSDL
>>> file from the broswer, but i really want the tests work as well...
>>>
>>> i am wondering the server cannot start properly or something, but don`t
>>> know how to solve it.
>>>
>>> Here is the source code i am working on, just very tiny small demo.
>>> http://sites.google.com/site/shrimpysface/Home/cxfSample1.zip?attredirects=
>>>0
>>>
>>> can anyone spend some minutes to help me find out why it always doesn`t
>>> work?
>> 
>> 
>> -- 
>> Daniel Kulp
>> [email protected]
>> http://dankulp.com/blog
>> 
>> 
>> <?xml version="1.0" encoding="UTF-8"?>
>> 
>> <beans xmlns="http://www.springframework.org/schema/beans";
>>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>>        xmlns:jaxws="http://cxf.apache.org/jaxws";
>>        xmlns:cxf="http://cxf.apache.org/core";
>>        xsi:schemaLocation="http://cxf.apache.org/core
>>         http://cxf.apache.org/schemas/core.xsd
>>         http://cxf.apache.org/jaxws
>>         http://cxf.apache.org/schemas/jaxws.xsd
>>              http://www.springframework.org/schema/beans 
>>              
>> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd";>
>> 
>>     <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-jetty.xml" />
>>     <!-- Enable message logging using the CXF logging feature -->
>>     <cxf:bus>
>>         <cxf:features>
>>             <cxf:logging/>
>>         </cxf:features>
>>     </cxf:bus>
>>     
>>      <!-- Aegis data binding -->
>>      <bean id="aegisBean"
>>              class="org.apache.cxf.aegis.databinding.AegisDatabinding"
>>              scope="prototype" />
>> 
>> 
>>     <bean id="jaxwsAndAegisServiceFactory"
>>           class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"
>>           scope="prototype"> 
>>         <property name="dataBinding" ref="aegisBean"/>
>>         <property name="serviceConfigurations">
>>           <list>
>>             <bean 
>> class="org.apache.cxf.jaxws.support.JaxWsServiceConfiguration"/>
>>             <bean 
>> class="org.apache.cxf.aegis.databinding.AegisServiceConfiguration"/>
>>             <bean 
>> class="org.apache.cxf.service.factory.DefaultServiceConfiguration"/> 
>>           </list>
>>         </property>
>>     </bean>
>> 
>>     <!-- Service endpoint -->
>>     <!-- See http://incubator.apache.org/cxf/faq.html regarding CXF +
>> Spring 
>> AOP -->
>>     <jaxws:endpoint id="contactUsService"
>>             implementor="contactus.ContactUsServiceImpl"
>>             address="http://localhost:9090/CxfSample1/contactus";>
>>         <jaxws:serviceFactory>
>>             <ref bean="jaxwsAndAegisServiceFactory"/>
>>         </jaxws:serviceFactory>
>>     </jaxws:endpoint>
>>     
>>      <!-- Client code for unit test (or for injecting in webapp as done in
>> the 
>> article) -->
>>      
>>      <!-- Factory to create the dynamic proxy for client -->
>>      <bean id="contactUsFactory"
>>              class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
>>              <property name="serviceClass"
>>                      value="contactus.ContactUsService" />
>>              <property name="address"
>>                      value="http://localhost:9090/CxfSample1/contactus"; />
>>              <property name="serviceFactory"
>>                      ref="jaxwsAndAegisServiceFactory" />
>>      </bean>
>> 
>>      <!--  Web service dynamic proxy -->
>>      <bean id="contactUsServiceClient" class="contactus.ContactUsService"
>>              factory-bean="contactUsFactory" factory-method="create" />
>> 
>> </beans>
>> 
>> 
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/question-about-creating-junit-test-for-cxf-tp21047687p21191242.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to