You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Rice Yeh <ri...@gmail.com> on 2012/01/12 07:00:56 UTC

Spring destroy jaxrs:server bean in tomcat

Hi,
  I am developing my program based on jaxrs 2.5.1 in jetty environment.
Now, I am moving my program to tomcat 7.0.23. My problem is when my
jaxrs:server bean is under construction, its containing factory bean is
destructing and cause some error. The the destruction message is like below:

Jan 12, 2012 12:44:22 PM
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry
destroySingletons
INFO: Destroying singletons in
org.springframework.beans.factory.support.DefaultListableBeanFactory@a1e2da:
defining beans
[
    cxf,
    org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,
    org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,
    org.apache.cxf.bus.spring.BusExtensionPostProcessor,

populator,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,

org.springframework.context.annotation.internalAutowiredAnnotationProcessor,

org.springframework.context.annotation.internalRequiredAnnotationProcessor,

org.springframework.context.annotation.internalCommonAnnotationProcessor,

org.springframework.context.annotation.internalPersistenceAnnotationProcessor,
    common,
    xs.scheduling.Scheduler#0,com.icegreen.greenmail.util.GreenMail#0
]; root of factory hierarchy

In jetty environment, I do not have such problem. It only happens in tomcat
environment. My spring bean definition is shown below:

<beans
    xmlns="http://www.springframework.org/schema/beans"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="
http://cxf.apache.org/jaxws"
    xmlns:jaxrs="http://cxf.apache.org/jaxrs"
    xsi:schemaLocation="
            http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
            http://www.springframework.org/schema/context

http://www.springframework.org/schema/context/spring-context-2.5.xsd
            http://cxf.apache.org/jaxrs
http://cxf.apache.org/schemas/jaxrs.xsd">
    <context:component-scan base-package="xs.personnel.sample"/>
    <jaxrs:server id="common" address="/">
        <jaxrs:serviceBeans>
            <bean class="xs.common.rs.Resource"/>
        </jaxrs:serviceBeans>
        <jaxrs:providers>
            <bean class="xs.common.rs.ExceptionHandling"/>
        </jaxrs:providers>
    </jaxrs:server>
    <bean class="xs.scheduling.Scheduler" factory-method="getInstance"
init-method="start" destroy-method="stop"/>
    <bean class="com.icegreen.greenmail.util.GreenMail" init-method="start"
destroy-method="stop"/>
</beans>

Any clue?

Rice

Re: Spring destroy jaxrs:server bean in tomcat

Posted by Sergey Beryozkin <sb...@gmail.com>.
On 12/01/12 10:49, Rice Yeh wrote:
> Hi Sergey,
>    The problem is solved. The error happens because some jar does not exist
> and the exception CannotLoadBeanClassException is swallowed by another
> exception which occurs when destructing beans and spring just show the new
> exception but not the original root cause.

OK, thanks for the confirmation
Sergey

>
> Thanks,
> Rice
>
> On Thu, Jan 12, 2012 at 7:30 PM, Sergey Beryozkin<sb...@gmail.com>wrote:
>
>> Hi,
>>
>>
>> On 12/01/12 06:00, Rice Yeh wrote:
>>
>>> Hi,
>>>    I am developing my program based on jaxrs 2.5.1 in jetty environment.
>>> Now, I am moving my program to tomcat 7.0.23. My problem is when my
>>> jaxrs:server bean is under construction, its containing factory bean is
>>> destructing and cause some error. The the destruction message is like
>>> below:
>>>
>>> Jan 12, 2012 12:44:22 PM
>>> org.springframework.beans.**factory.support.**
>>> DefaultSingletonBeanRegistry
>>> destroySingletons
>>> INFO: Destroying singletons in
>>> org.springframework.beans.**factory.support.**DefaultListableBeanFactory@
>>> **a1e2da:
>>> defining beans
>>> [
>>>      cxf,
>>>      org.apache.cxf.bus.spring.**BusWiringBeanFactoryPostProces**sor,
>>>      org.apache.cxf.bus.spring.**Jsr250BeanPostProcessor,
>>>      org.apache.cxf.bus.spring.**BusExtensionPostProcessor,
>>>
>>> populator,org.springframework.**context.annotation.**
>>> internalConfigurationAnnotatio**nProcessor,
>>>
>>> org.springframework.context.**annotation.**internalAutowiredAnnotationPro
>>> **cessor,
>>>
>>> org.springframework.context.**annotation.**internalRequiredAnnotationProc
>>> **essor,
>>>
>>> org.springframework.context.**annotation.**internalCommonAnnotationProces
>>> **sor,
>>>
>>> org.springframework.context.**annotation.**internalPersistenceAnnotationP
>>> **rocessor,
>>>      common,
>>>      xs.scheduling.Scheduler#0,com.**icegreen.greenmail.util.**GreenMail#0
>>> ]; root of factory hierarchy
>>>
>>> In jetty environment, I do not have such problem. It only happens in
>>> tomcat
>>> environment. My spring bean definition is shown below:
>>>
>>> <beans
>>>      xmlns="http://www.**springframework.org/schema/**beans<http://www.springframework.org/schema/beans>
>>> "
>>>      xmlns:context="http://www.**springframework.org/schema/**context<http://www.springframework.org/schema/context>
>>> "
>>>      xmlns:xsi="http://www.w3.org/**2001/XMLSchema-instance<http://www.w3.org/2001/XMLSchema-instance>"
>>> xmlns:jaxws="
>>> http://cxf.apache.org/jaxws"
>>>      xmlns:jaxrs="http://cxf.**apache.org/jaxrs<http://cxf.apache.org/jaxrs>
>>> "
>>>      xsi:schemaLocation="
>>>              http://www.springframework.**org/schema/beans<http://www.springframework.org/schema/beans>
>>>              http://www.springframework.**org/schema/beans/spring-beans-**
>>> 2.0.xsd<http://www.springframework.org/schema/beans/spring-beans-2.0.xsd>
>>>              http://www.springframework.**org/schema/context<http://www.springframework.org/schema/context>
>>>
>>> http://www.springframework.**org/schema/context/spring-**context-2.5.xsd<http://www.springframework.org/schema/context/spring-context-2.5.xsd>
>>>              http://cxf.apache.org/jaxrs
>>> http://cxf.apache.org/schemas/**jaxrs.xsd<http://cxf.apache.org/schemas/jaxrs.xsd>
>>> ">
>>>      <context:component-scan base-package="xs.personnel.**sample"/>
>>>      <jaxrs:server id="common" address="/">
>>>          <jaxrs:serviceBeans>
>>>              <bean class="xs.common.rs.Resource"/**>
>>>          </jaxrs:serviceBeans>
>>>          <jaxrs:providers>
>>>              <bean class="xs.common.rs.**ExceptionHandling"/>
>>>          </jaxrs:providers>
>>>      </jaxrs:server>
>>>      <bean class="xs.scheduling.**Scheduler" factory-method="getInstance"
>>> init-method="start" destroy-method="stop"/>
>>>      <bean class="com.icegreen.greenmail.**util.GreenMail"
>>> init-method="start"
>>> destroy-method="stop"/>
>>> </beans>
>>>
>>> Any clue?
>>>
>>
>> Not really. May be enabling a TRACE-level logging will help to catch some
>> exception which is otherwise 'lost' ? Any chance you can create a basic
>> Maven-based project that I can try on Tomcat 7.0.23 ?
>>
>> Sergey
>>
>>
>>> Rice
>>>
>>>
>

Re: Spring destroy jaxrs:server bean in tomcat

Posted by Rice Yeh <ri...@gmail.com>.
Hi Sergey,
  The problem is solved. The error happens because some jar does not exist
and the exception CannotLoadBeanClassException is swallowed by another
exception which occurs when destructing beans and spring just show the new
exception but not the original root cause.

Thanks,
Rice

On Thu, Jan 12, 2012 at 7:30 PM, Sergey Beryozkin <sb...@gmail.com>wrote:

> Hi,
>
>
> On 12/01/12 06:00, Rice Yeh wrote:
>
>> Hi,
>>   I am developing my program based on jaxrs 2.5.1 in jetty environment.
>> Now, I am moving my program to tomcat 7.0.23. My problem is when my
>> jaxrs:server bean is under construction, its containing factory bean is
>> destructing and cause some error. The the destruction message is like
>> below:
>>
>> Jan 12, 2012 12:44:22 PM
>> org.springframework.beans.**factory.support.**
>> DefaultSingletonBeanRegistry
>> destroySingletons
>> INFO: Destroying singletons in
>> org.springframework.beans.**factory.support.**DefaultListableBeanFactory@
>> **a1e2da:
>> defining beans
>> [
>>     cxf,
>>     org.apache.cxf.bus.spring.**BusWiringBeanFactoryPostProces**sor,
>>     org.apache.cxf.bus.spring.**Jsr250BeanPostProcessor,
>>     org.apache.cxf.bus.spring.**BusExtensionPostProcessor,
>>
>> populator,org.springframework.**context.annotation.**
>> internalConfigurationAnnotatio**nProcessor,
>>
>> org.springframework.context.**annotation.**internalAutowiredAnnotationPro
>> **cessor,
>>
>> org.springframework.context.**annotation.**internalRequiredAnnotationProc
>> **essor,
>>
>> org.springframework.context.**annotation.**internalCommonAnnotationProces
>> **sor,
>>
>> org.springframework.context.**annotation.**internalPersistenceAnnotationP
>> **rocessor,
>>     common,
>>     xs.scheduling.Scheduler#0,com.**icegreen.greenmail.util.**GreenMail#0
>> ]; root of factory hierarchy
>>
>> In jetty environment, I do not have such problem. It only happens in
>> tomcat
>> environment. My spring bean definition is shown below:
>>
>> <beans
>>     xmlns="http://www.**springframework.org/schema/**beans<http://www.springframework.org/schema/beans>
>> "
>>     xmlns:context="http://www.**springframework.org/schema/**context<http://www.springframework.org/schema/context>
>> "
>>     xmlns:xsi="http://www.w3.org/**2001/XMLSchema-instance<http://www.w3.org/2001/XMLSchema-instance>"
>> xmlns:jaxws="
>> http://cxf.apache.org/jaxws"
>>     xmlns:jaxrs="http://cxf.**apache.org/jaxrs<http://cxf.apache.org/jaxrs>
>> "
>>     xsi:schemaLocation="
>>             http://www.springframework.**org/schema/beans<http://www.springframework.org/schema/beans>
>>             http://www.springframework.**org/schema/beans/spring-beans-**
>> 2.0.xsd<http://www.springframework.org/schema/beans/spring-beans-2.0.xsd>
>>             http://www.springframework.**org/schema/context<http://www.springframework.org/schema/context>
>>
>> http://www.springframework.**org/schema/context/spring-**context-2.5.xsd<http://www.springframework.org/schema/context/spring-context-2.5.xsd>
>>             http://cxf.apache.org/jaxrs
>> http://cxf.apache.org/schemas/**jaxrs.xsd<http://cxf.apache.org/schemas/jaxrs.xsd>
>> ">
>>     <context:component-scan base-package="xs.personnel.**sample"/>
>>     <jaxrs:server id="common" address="/">
>>         <jaxrs:serviceBeans>
>>             <bean class="xs.common.rs.Resource"/**>
>>         </jaxrs:serviceBeans>
>>         <jaxrs:providers>
>>             <bean class="xs.common.rs.**ExceptionHandling"/>
>>         </jaxrs:providers>
>>     </jaxrs:server>
>>     <bean class="xs.scheduling.**Scheduler" factory-method="getInstance"
>> init-method="start" destroy-method="stop"/>
>>     <bean class="com.icegreen.greenmail.**util.GreenMail"
>> init-method="start"
>> destroy-method="stop"/>
>> </beans>
>>
>> Any clue?
>>
>
> Not really. May be enabling a TRACE-level logging will help to catch some
> exception which is otherwise 'lost' ? Any chance you can create a basic
> Maven-based project that I can try on Tomcat 7.0.23 ?
>
> Sergey
>
>
>> Rice
>>
>>

Re: Spring destroy jaxrs:server bean in tomcat

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi,

On 12/01/12 06:00, Rice Yeh wrote:
> Hi,
>    I am developing my program based on jaxrs 2.5.1 in jetty environment.
> Now, I am moving my program to tomcat 7.0.23. My problem is when my
> jaxrs:server bean is under construction, its containing factory bean is
> destructing and cause some error. The the destruction message is like below:
>
> Jan 12, 2012 12:44:22 PM
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry
> destroySingletons
> INFO: Destroying singletons in
> org.springframework.beans.factory.support.DefaultListableBeanFactory@a1e2da:
> defining beans
> [
>      cxf,
>      org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,
>      org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,
>      org.apache.cxf.bus.spring.BusExtensionPostProcessor,
>
> populator,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,
>
> org.springframework.context.annotation.internalAutowiredAnnotationProcessor,
>
> org.springframework.context.annotation.internalRequiredAnnotationProcessor,
>
> org.springframework.context.annotation.internalCommonAnnotationProcessor,
>
> org.springframework.context.annotation.internalPersistenceAnnotationProcessor,
>      common,
>      xs.scheduling.Scheduler#0,com.icegreen.greenmail.util.GreenMail#0
> ]; root of factory hierarchy
>
> In jetty environment, I do not have such problem. It only happens in tomcat
> environment. My spring bean definition is shown below:
>
> <beans
>      xmlns="http://www.springframework.org/schema/beans"
>      xmlns:context="http://www.springframework.org/schema/context"
>      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="
> http://cxf.apache.org/jaxws"
>      xmlns:jaxrs="http://cxf.apache.org/jaxrs"
>      xsi:schemaLocation="
>              http://www.springframework.org/schema/beans
>              http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>              http://www.springframework.org/schema/context
>
> http://www.springframework.org/schema/context/spring-context-2.5.xsd
>              http://cxf.apache.org/jaxrs
> http://cxf.apache.org/schemas/jaxrs.xsd">
>      <context:component-scan base-package="xs.personnel.sample"/>
>      <jaxrs:server id="common" address="/">
>          <jaxrs:serviceBeans>
>              <bean class="xs.common.rs.Resource"/>
>          </jaxrs:serviceBeans>
>          <jaxrs:providers>
>              <bean class="xs.common.rs.ExceptionHandling"/>
>          </jaxrs:providers>
>      </jaxrs:server>
>      <bean class="xs.scheduling.Scheduler" factory-method="getInstance"
> init-method="start" destroy-method="stop"/>
>      <bean class="com.icegreen.greenmail.util.GreenMail" init-method="start"
> destroy-method="stop"/>
> </beans>
>
> Any clue?

Not really. May be enabling a TRACE-level logging will help to catch 
some exception which is otherwise 'lost' ? Any chance you can create a 
basic Maven-based project that I can try on Tomcat 7.0.23 ?

Sergey

>
> Rice
>