You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by choreo <ta...@choreo.jp> on 2007/08/15 06:37:04 UTC

wsdl returns "No service was found." after refreshing Spring context

Hi all,

Thanks to Wiki, I managed to use CXFServlet  and simple frontend with
springframework.
It seems to be working fine except one thing.   When I refresh the spring
context, 
the service location is lost, leaving a log like
"Can't find the the request for
http://localhost:8080/context/services/myService's Observer ".

The code below is in my servlet filter.  

if (applicationContext instanceof AbstractRefreshableApplicationContext) {
    AbstractRefreshableApplicationContext context =
(AbstractRefreshableApplicationContext) applicationContext;
    context.refresh();
}

It might be rare to refresh context, but I sometimes want to reread the bean
definition files 
after changing some properties without reloading servlet context.  Here is
my configuration:

<beans xmlns="http://www.springframework.org/schema/beans" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:simple="http://cxf.apache.org/simple" xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/simple
http://cxf.apache.org/schemas/simple.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-servlet.xml" />

	<simple:server id="myservice" address="/myService"
serviceClass="jp.choreo.services.myService">
		<simple:serviceBean>
			<bean class="jp.choreo.services.myServiceImpl" />
		</simple:serviceBean>
		<simple:properties>
			<entry key="mtom-enabled" value="true" />
		</simple:properties>
	</simple:server>
</beans>

Is there a chance to reload the cxf server?
Any suggestion would be appreciated.

Satoshi
-- 
View this message in context: http://www.nabble.com/wsdl-returns-%22No-service-was-found.%22-after-refreshing-Spring-context-tf4271101.html#a12156391
Sent from the cxf-user mailing list archive at Nabble.com.


Re: wsdl returns "No service was found." after refreshing Spring context

Posted by choreo <ta...@choreo.jp>.
Hi Dan,

>Hmm - I've never tried such a thing. I'm wondering, does Spring fully
>destroy all the previous beans?
I hope so!  I've never experienced memory leaks while reloading app a
coulple of ten times.

As you mentioned, I tried to retrieve a Server instance, but the result was:

java.lang.ClassCastException: org.apache.cxf.frontend.ServerFactoryBean
	at jp.choreo.spring.CustomReloader.reload(CustomReloader.java:40)
	at
jp.choreo.spring.filter.BeanReloadFilter.doFilter(BeanReloadFilter.java:86)


I thought ServerFactoryBean is an inheritance of spring's FactoryBean, so I
changed the code,
added "&" before the bean name in order to get a spring FactoryBean itself,
not a product of factory:

ServerFactoryBean factoryBean = (ServerFactoryBean)
context.getBean("&myService");

And as you can imagine, I got the exception:

org.springframework.beans.factory.BeanIsNotAFactoryException: Bean named
'myService' must be of type [org.springframework.beans.factory.FactoryBean],
but was actually of type [org.apache.cxf.frontend.ServerFactoryBean]

(BTW, could CXF's ServerFactoryBean be a spring's AbstractFactoryBean so as
to implement a 
 destroy() method?)


Finally, I tried:

ServerFactoryBean factoryBean = (ServerFactoryBean)
context.getBean("myService");
factoryBean.getServer().stop();
ctx.reflesh();


and

ctx.reflesh();
ServerFactoryBean factoryBean = (ServerFactoryBean)
context.getBean("myService");
factoryBean.create().start();


Both ended up with no exception, but "No service was found." on wsdl URL.
I'm quite new to CXF and don't understand the server or endpoint relation,
lifecycle, etc.
That must be the biggest problem but I would appreciate your help.  Thanks.

Satoshi


Dan Diephouse wrote:
> 
> Hi Choreo,
> 
> Hmm - I've never tried such a thing. I'm wondering, does Spring fully
> destroy all the previous beans? I could imagine there would be problems if
> Spring didn't call stop() on your <simple:server/>.
> 
> Actually, now that I look through our source, it seems that the
> ServerFactoryBeanDefinitionParser doesn't tell Spring to call stop when
> the
> context is destroyed. Any chance you could try this simple test to see if
> it
> makes a difference:
> 
> ApplicationContext ctx = ... your spring context;
> Server s = (Server) ctx.getbean("myservice");
> s.stop();
> ctx.refresh();
> 
> Cheers,
> - Dan
> 
> 
> 
> On 8/15/07, choreo <ta...@choreo.jp> wrote:
>>
>>
>> Hi all,
>>
>> Thanks to Wiki, I managed to use CXFServlet  and simple frontend with
>> springframework.
>> It seems to be working fine except one thing.   When I refresh the spring
>> context,
>> the service location is lost, leaving a log like
>> "Can't find the the request for
>> http://localhost:8080/context/services/myService's<http://localhost:8080/context/services/myService%27s>Observer
>> ".
>>
>> The code below is in my servlet filter.
>>
>> if (applicationContext instanceof AbstractRefreshableApplicationContext)
>> {
>>     AbstractRefreshableApplicationContext context =
>> (AbstractRefreshableApplicationContext) applicationContext;
>>     context.refresh ();
>> }
>>
>> It might be rare to refresh context, but I sometimes want to reread the
>> bean
>> definition files
>> after changing some properties without reloading servlet context.  Here
>> is
>> my configuration:
>>
>> <beans xmlns=" http://www.springframework.org/schema/beans"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance "
>> xmlns:simple="http://cxf.apache.org/simple" xsi:schemaLocation="
>> http://www.springframework.org/schema/beans
>> http://www.springframework.org/schema/beans/spring-beans.xsd
>> http://cxf.apache.org/simple
>> http://cxf.apache.org/schemas/simple.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-servlet.xml" />
>>
>>         <simple:server id="myservice" address="/myService"
>> serviceClass=" jp.choreo.services.myService">
>>                 <simple:serviceBean>
>>                         <bean class="jp.choreo.services.myServiceImpl" />
>>                 </simple:serviceBean>
>>                 <simple:properties>
>>                         <entry key="mtom-enabled" value="true" />
>>                 </simple:properties>
>>         </simple:server>
>> </beans>
>>
>> Is there a chance to reload the cxf server?
>> Any suggestion would be appreciated.
>>
>> Satoshi
>> --
>> View this message in context:
>> http://www.nabble.com/wsdl-returns-%22No-service-was-found.%22-after-refreshing-Spring-context-tf4271101.html#a12156391
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> Dan Diephouse
> Envoi Solutions
> http://envoisolutions.com | http://netzooid.com/blog
> 
> 

-- 
View this message in context: http://www.nabble.com/wsdl-returns-%22No-service-was-found.%22-after-refreshing-Spring-context-tf4271101.html#a12177354
Sent from the cxf-user mailing list archive at Nabble.com.


Re: wsdl returns "No service was found." after refreshing Spring context

Posted by Dan Diephouse <da...@envoisolutions.com>.
Hi Choreo,

Hmm - I've never tried such a thing. I'm wondering, does Spring fully
destroy all the previous beans? I could imagine there would be problems if
Spring didn't call stop() on your <simple:server/>.

Actually, now that I look through our source, it seems that the
ServerFactoryBeanDefinitionParser doesn't tell Spring to call stop when the
context is destroyed. Any chance you could try this simple test to see if it
makes a difference:

ApplicationContext ctx = ... your spring context;
Server s = (Server) ctx.getbean("myservice");
s.stop();
ctx.refresh();

Cheers,
- Dan



On 8/15/07, choreo <ta...@choreo.jp> wrote:
>
>
> Hi all,
>
> Thanks to Wiki, I managed to use CXFServlet  and simple frontend with
> springframework.
> It seems to be working fine except one thing.   When I refresh the spring
> context,
> the service location is lost, leaving a log like
> "Can't find the the request for
> http://localhost:8080/context/services/myService's<http://localhost:8080/context/services/myService%27s>Observer ".
>
> The code below is in my servlet filter.
>
> if (applicationContext instanceof AbstractRefreshableApplicationContext) {
>     AbstractRefreshableApplicationContext context =
> (AbstractRefreshableApplicationContext) applicationContext;
>     context.refresh ();
> }
>
> It might be rare to refresh context, but I sometimes want to reread the
> bean
> definition files
> after changing some properties without reloading servlet context.  Here is
> my configuration:
>
> <beans xmlns=" http://www.springframework.org/schema/beans"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance "
> xmlns:simple="http://cxf.apache.org/simple" xsi:schemaLocation="
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
> http://cxf.apache.org/simple
> http://cxf.apache.org/schemas/simple.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-servlet.xml" />
>
>         <simple:server id="myservice" address="/myService"
> serviceClass=" jp.choreo.services.myService">
>                 <simple:serviceBean>
>                         <bean class="jp.choreo.services.myServiceImpl" />
>                 </simple:serviceBean>
>                 <simple:properties>
>                         <entry key="mtom-enabled" value="true" />
>                 </simple:properties>
>         </simple:server>
> </beans>
>
> Is there a chance to reload the cxf server?
> Any suggestion would be appreciated.
>
> Satoshi
> --
> View this message in context:
> http://www.nabble.com/wsdl-returns-%22No-service-was-found.%22-after-refreshing-Spring-context-tf4271101.html#a12156391
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>


-- 
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog