Hi All, I solved the problem by adding this code into destroy() method of the servlet that publishes my services
public void destroy() { ... JettyHTTPServerEngineFactory factory = new JettyHTTPServerEngineFactory(); JettyHTTPServerEngine jetty = factory.retrieveJettyHTTPServerEngine(9090); try { jetty.getServer().stop(); } catch (Exception e) { e.printStackTrace(); } ... } Thanks for you cooperation, I wish this will help someone else, bye! ----- Original Message ----- From: "Eman Ali al-Maktari [IT Department]" <[EMAIL PROTECTED]> To: cxf-user@incubator.apache.org Sent: Saturday, December 8, 2007 5:20:01 PM (GMT+0300) Asia/Kuwait Subject: Re: [Deploy in JBOSS] Address already in use Exception Hi All, it's me again Dear Saleh, I tried your solution but the endpoints were not published at all! thanks a lot for help. ================================ Dear CXF team, I think what I'm facing is a bug in the CXF itself, what made me say this, is that I made a very simple project with one service that returns "hello world" and tested it using altova [XMLSpy] it works fine, but the problem of unbinding exists, we can't deploy some thing that doesn't unbind in our production servers. So, if you don't think it's a bug please help me figure out where is the problem, I'll really appreciate it. thank you all in advanced. ----- Original Message ----- From: "Eman Ali al-Maktari [IT Department]" <[EMAIL PROTECTED]> To: cxf-user@incubator.apache.org Sent: Monday, November 26, 2007 7:10:24 PM (GMT+0300) Asia/Kuwait Subject: Re: [Deploy in JBOSS] Address already in use Exception Dear Andrew, Thanks a lot for your cooperation you did your best, and you was helpful coz even if the problem wasn't solved but at least I could fined something to say to my Boss ;-) Dear Saleh, Thanks for your reply , I'll try it and feed you back.. ----- Original Message ----- From: "Saleh Al-Ghashmi" <[EMAIL PROTECTED]> To: cxf-user@incubator.apache.org Sent: Monday, November 26, 2007 6:44:27 PM (GMT+0300) Asia/Kuwait Subject: Re: [Deploy in JBOSS] Address already in use Exception Andrew Dinn wrote: > > Hi Eman, > > Your config files look ok. I'm afraid I don't really understand what is > going wrong in that case. > > Regarding your destroy code I have two comments. Firstly, I was > suggesting you destroy the cxf *servlet*, not (just) the cxf bus. Also, > there is no guarantee that the default bus at the point where your > destroy code is run is the same bus as the one you installed at the > point where the create code was run. Maybe you should stash the cxf > servlet somewhere when you create e.g. attach it to the servlet which is > running the create code. Then you can pick it up later and call its > destroy method. > > Hope this helps. If not then I am afraid I am stumped :-( > > regards, > > > 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) > > Eman Ali al-Maktari [IT Department] wrote: >> Hi Andrew, >> I tried to stop the bus using: >> public void destroy() { >> Bus bus = CXFBusFactory.getDefaultBus(); >> if (eCategories.isPublished()){ >> System.out.println("I'll stop Categories!"); >> eCategories.stop(); >> bus.shutdown(false); >> System.out.println("I't was stopped"); >> } >> super.destroy(); >> } >> >> but the problem still exist, I also tried removing >> NOTE: this destroy() method is the servlet method. >> I also tried to not explicitly create a CXFServlet(), and the problem >> happened again and again :-( >> >> These are my XML files: >> ================CXF.XML======================= >> <beans xmlns="http://www.springframework.org/schema/beans" >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >> xmlns:jaxws="http://cxf.apache.org/jaxws" >> xsi:schemaLocation=" >> http://www.springframework.org/schema/beans >> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd >> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"> >> >> <bean id="logInbound" >> class="org.apache.cxf.interceptor.LoggingInInterceptor"/> >> <bean id="logOutbound" >> class="org.apache.cxf.interceptor.LoggingOutInterceptor"/> >> >> <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl"> >> <property name="inInterceptors"> >> <list> >> <ref bean="logInbound"/> >> </list> >> </property> >> <property name="outInterceptors"> >> <list> >> <ref bean="logOutbound"/> >> </list> >> </property> >> <property name="outFaultInterceptors"> >> <list> >> <ref bean="logOutbound"/> >> </list> >> </property> >> </bean> >> </beans> >> ====================CXF-SERVLET.XML======================== >> <?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:soap="http://cxf.apache.org/bindings/soap" >> xsi:schemaLocation=" >> http://www.springframework.org/schema/beans >> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd >> http://cxf.apache.org/bindings/soap >> http://cxf.apache.org/schemas/configuration/soap.xsd >> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"> >> </beans> >> >> ===================WEB.XML (When I create the CXFServlet >> explicitly)================================= >> <!DOCTYPE web-app PUBLIC >> "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" >> "http://java.sun.com/dtd/web-app_2_3.dtd" > >> >> <web-app> >> <servlet> >> <servlet-name>WebServiceServlet</servlet-name> >> <servlet-class>com.lit.linkinnews.WebServiceServlet</servlet-class> >> <load-on-startup>1</load-on-startup> >> </servlet> >> <servlet> >> <servlet-name>cxf</servlet-name> >> <display-name>cxf</display-name> >> <description>Apache CXF Endpoint</description> >> <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class> >> <load-on-startup>1</load-on-startup> >> </servlet> >> <servlet-mapping> >> <servlet-name>cxf</servlet-name> >> <url-pattern>/services/*</url-pattern> >> </servlet-mapping> >> <servlet-mapping> >> <servlet-name>WebServiceServlet</servlet-name> >> <url-pattern>/WebServiceServlet</url-pattern> >> </servlet-mapping> >> </web-app> >> ===================WEB.XML (When I don't create the CXFServlet >> explicitly)================================= >> <!DOCTYPE web-app PUBLIC >> "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" >> "http://java.sun.com/dtd/web-app_2_3.dtd" > >> >> <web-app> >> <servlet> >> <servlet-name>WebServiceServlet</servlet-name> >> <servlet-class>com.lit.linkinnews.WebServiceServlet</servlet-class> >> <load-on-startup>1</load-on-startup> >> </servlet> >> <servlet-mapping> >> <servlet-name>WebServiceServlet</servlet-name> >> <url-pattern>/WebServiceServlet</url-pattern> >> </servlet-mapping> >> </web-app> >> >> =============================================================== >> The WebServiceServlet is the servlet where I publish and unpublish the >> end points, >> >> Any help will be really, really, really appreciated. >> >> >> ----- Original Message ----- >> From: "Eman Ali al-Maktari [IT Department]" <[EMAIL PROTECTED]> >> To: cxf-user@incubator.apache.org >> Sent: Wednesday, November 21, 2007 5:33:51 PM (GMT+0300) Asia/Kuwait >> Subject: Re: [Deploy in JBOSS] Address already in use Exception >> >> 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" <[EMAIL PROTECTED]> >> 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) >> >> >> >> >> > > > > Hi Eman, I 'll solve your problem because I faced this problem before. I think you don't have to do all these things. You have a mistake while publishing the endpoint. The problem is you try to publish the endpoint twice at creation the endpoint and at publishing it. You just do as following: String address = "http://localhost:9090/sn_categories"; CategoriesImpl categoriesImpl = new CategoriesImpl(); Endpoint e = Endpoint.create(address,categoriesImpl); e.publish(categoriesImpl); I try it by myself and redeploy war many times and it works fine. regards, -- View this message in context: http://www.nabble.com/-Deploy-in-JBOSS--Address-already-in-use-Exception-tf4805149.html#a13951894 Sent from the cxf-user mailing list archive at Nabble.com. -- 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 -- 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 -- 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