cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eman Ali al-Maktari \[IT Department\]" <ealmakt...@linkintime.com>
Subject Re: [Deploy in JBOSS] Address already in use Exception
Date Wed, 21 Nov 2007 14:33:51 GMT
Thanks a lot Andrew, 

I really needed a clue 
I'm going to try the "Stopping Bus" solution as soon as I can, I hope it will be the solution..


for my code, it's written in a servlet that is loaded when the application deployed (you guest
it correctly ;) ) 

Thanks again, I'll feed you back! 

----- Original Message ----- 
From: "Andrew Dinn" <adinn@redhat.com> 
To: cxf-user@incubator.apache.org 
Sent: Wednesday, November 21, 2007 12:18:02 PM (GMT+0300) Asia/Kuwait 
Subject: Re: [Deploy in JBOSS] Address already in use Exception 

Eman Ali al-Maktari [IT Department] wrote: 
> This is my code: 
> 
> Endpoint eCategories = publishCategories(); 
> 
> private Endpoint publishCategories() { 
> String address = "http://localhost:9090/sn_categories"; 
> CategoriesImpl categoriesImpl = new CategoriesImpl(); 
> //Endpoint e = Endpoint.publish(address, categoriesImpl); 
> CXFServlet cxf = new CXFServlet(); 
> Bus bus = cxf.getBus(); 
> BusFactory.setDefaultBus(bus); 
> Endpoint e = Endpoint.create(categoriesImpl); 
> e.publish(address); 
> return e; 
> } 
> public void init(ServletConfig config) throws ServletException { 
> super.init(config); 
> System.out.println("Server started\\"); 
> 
> // Categories 
> if (!eCategories.isPublished()) { 
> String address = "http://localhost:9090/sn_categories"; 
> eCategories.publish(address); 
> } 
> } 
> 
> public void destroy() { 
> if (eCategories.isPublished()) eCategories.stop(); 
> super.destroy(); 
> } 

Ok, I am not certain what is going on because I don't know for sure 
where the first segment of code in your listing is invoked from. 
Assuming it is run when the app is deployed, I think I see the problem 
here. You are explicitly creating a CXFServlet() in your code rather 
than relying on cxf/JBoss deployer code to create it. This should mean 
that you need to explicitly delete the servlet (and its associated bus 
and transport) when your app is undeployed. You can verify this by 
checking to see if your destroy method is ever called. If not then I 
would expect this to leave the bus and transport holding on to the 
socket. Perhaps Dan or one of the other CXF team could confirm this? 

I suggest you configure the cxf.xml/cxf-servlet.xml files to deploy your 
cxf servlet. This should ensure that JBoss and CXF co-operate to shut 
down the servlet when the app is undeployed. Alternatively, you will 
have to work out a way of catching the undeploy in your app code and 
deleting the servlet (e.g. if your app deploys some other servlet you 
can delete the cxf bus from its destroy method). 


Andrew Dinn (JBoss Transactions) 
-------------------------------- 
JBoss, a Division of Red Hat 
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod 
Street, Windsor, Berkshire, 
SI4 1TE, United Kingdom. 
Registered in UK and Wales under Company Registration No. 3798903 
Directors: Michael Cunningham (USA), Charlie Peters (USA) and David 
Owens (Ireland) 





-- 
Best Regards, 

Eman Ali al-Maktari 
Software Engineer 
Technical Department 
LinkInTime 
Get Mobile ))) 

www.linkintime.com 
Mobile :: (00967) 71 2000 834 
Office :: (00967) 1 427 377 
Fax :: (00967) 1 428 851 

LinkInTime Ltd. 
Iran Street 
Haddah - Sana'a - P.O.Box. 16871, YEMEN 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message