You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Bill Li <bi...@beelun.com> on 2009/12/22 18:35:08 UTC

Bean as endpoint implementor

Hi folks,

I have a working project and would like to introduce web service
functionality here. I read around doc and successfully get a Foo service
running. My env is Spring 2.5, Jetty 6/Tomat 6. But when I try to export my
existing services, I continues hit spring exceptions. Let us come down to
code.

Interface
========
@WebService(name="myGlobManager", targetNamespace="http://cxf.apache.org")
public interface MyGlobManager {
    public MyGlob fetch();
}

Impl
========
@Service(value = "myGlobManager")
@WebService(endpointInterface="com.beelun.shoppro.service.MyGlobManager")
public class MyGlobManagerImpl extends GenericDaoHibernate<MyGlob, Long>
implements MyGlobManager {
    // A cache for myGlob
    private MyGlob myGlob = null;

    @Autowired
    public MyGlobManagerImpl(SessionFactory sessionFactory) {
        super(MyGlob.class, sessionFactory);
    }

    @Autowired
    TabManager tabManager;

    @Override
    public MyGlob fetch() {...}

Config file
=========
<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.xsd
                http://cxf.apache.org/jaxws
                http://cxf.apache.org/schemas/jaxws.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" />

  <jaxws:endpoint id="fooManager"

implementor="com.beelun.shoppro.service.impl.FooManagerImpl"
                  address="/fooManager"/>

  <jaxws:endpoint id="myGlobManager"
                  implementor="#myGlobManager"
                  address="/myGlobManager"/>

</beans>

Exceptions
=============
2009-12-23 01:12:25.099::WARN:  Failed startup of context
org.mortbay.jetty.plugin.Jetty6PluginWebAppContext@1478e67f
{/,F:\shoppro\src\main\webapp}
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'myGlobManager': Cannot resolve reference to bean 'myGlobManager'
while setting constructor argument; nested exception is
org.springframework.beans.factory.BeanCurrentlyInCreationException: Error
creating bean with name 'myGlobManager': Requested bean is currently in
creation: Is there an unresolvable circular reference?
    at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
    at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
....

Any idea?

Thanks.

-- 
Bill Li
http://BaliOnWeb.com

Re: Bean as endpoint implementor

Posted by Bill Li <bi...@beelun.com>.
Daniel - You are absolutely right. The most quick fix is to simply rename
endpoint bean.

  <jaxws:endpoint id="myGlobManagerEndPoint"
                  implementor="#myGlobManager"
                  address="/myGlobManager"/>

It works great now! Thanks.

Bill

On Wed, Dec 23, 2009 at 1:51 AM, Daniel Kulp <dk...@apache.org> wrote:

>
>
> >   <jaxws:endpoint id="myGlobManager"
> >                   implementor="#myGlobManager"
> >                   address="/myGlobManager"/>
>
> The implementor attribute is pointing at itself.  The jaxws:endpoint bean
> is
> named myGlobManager and that's also the implementor?   That's definitely
> not
> right.
>
> Most likely, you want something like:
>
> <bean id="myGlobManagerImpl" class="com.......MyGlobManagerImpl"/>
>
> <jaxws:endpoint id="myGlobManager"
>                   implementor="#myGlobManagerImpl"
>                   address="/myGlobManager"/>
>
> Due to your Autowired things, you may also need a TabManager bean and
> similar
> stuff defined in your beans.xml.
>
>
> Dan
>
>
>
>
>
> On Tue December 22 2009 12:35:08 pm Bill Li wrote:
> > Hi folks,
> >
> > I have a working project and would like to introduce web service
> > functionality here. I read around doc and successfully get a Foo service
> > running. My env is Spring 2.5, Jetty 6/Tomat 6. But when I try to export
> my
> > existing services, I continues hit spring exceptions. Let us come down to
> > code.
> >
> > Interface
> > ========
> > @WebService(name="myGlobManager", targetNamespace="http://cxf.apache.org
> ")
> > public interface MyGlobManager {
> >     public MyGlob fetch();
> > }
> >
> > Impl
> > ========
> > @Service(value = "myGlobManager")
> > @WebService(endpointInterface="com.beelun.shoppro.service.MyGlobManager")
> > public class MyGlobManagerImpl extends GenericDaoHibernate<MyGlob, Long>
> > implements MyGlobManager {
> >     // A cache for myGlob
> >     private MyGlob myGlob = null;
> >
> >     @Autowired
> >     public MyGlobManagerImpl(SessionFactory sessionFactory) {
> >         super(MyGlob.class, sessionFactory);
> >     }
> >
> >     @Autowired
> >     TabManager tabManager;
> >
> >     @Override
> >     public MyGlob fetch() {...}
> >
> > Config file
> > =========
> > <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.xsd
> >  http://cxf.apache.org/jaxws
> >                 http://cxf.apache.org/schemas/jaxws.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" />
> >
> >   <jaxws:endpoint id="fooManager"
> >
> > implementor="com.beelun.shoppro.service.impl.FooManagerImpl"
> >                   address="/fooManager"/>
> >
> >   <jaxws:endpoint id="myGlobManager"
> >                   implementor="#myGlobManager"
> >                   address="/myGlobManager"/>
> >
> > </beans>
> >
> > Exceptions
> > =============
> > 2009-12-23 01:12:25.099::WARN:  Failed startup of context
> > org.mortbay.jetty.plugin.Jetty6PluginWebAppContext@1478e67f
> > {/,F:\shoppro\src\main\webapp}
> > org.springframework.beans.factory.BeanCreationException: Error creating
> >  bean with name 'myGlobManager': Cannot resolve reference to bean
> >  'myGlobManager' while setting constructor argument; nested exception is
> > org.springframework.beans.factory.BeanCurrentlyInCreationException: Error
> > creating bean with name 'myGlobManager': Requested bean is currently in
> > creation: Is there an unresolvable circular reference?
> >     at
> >
> org.springframework.beans.factory.support.BeanDefinitionValueResolver.resol
> > veReference(BeanDefinitionValueResolver.java:275) at
> >
> org.springframework.beans.factory.support.BeanDefinitionValueResolver.resol
> > veValueIfNecessary(BeanDefinitionValueResolver.java:104) ....
> >
> > Any idea?
> >
> > Thanks.
> >
>
> --
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
>



-- 
Bill Li(李保存)
http://BaliOnWeb.com

Re: Bean as endpoint implementor

Posted by Daniel Kulp <dk...@apache.org>.

>   <jaxws:endpoint id="myGlobManager"
>                   implementor="#myGlobManager"
>                   address="/myGlobManager"/>

The implementor attribute is pointing at itself.  The jaxws:endpoint bean is 
named myGlobManager and that's also the implementor?   That's definitely not 
right.  

Most likely, you want something like:

<bean id="myGlobManagerImpl" class="com.......MyGlobManagerImpl"/>

<jaxws:endpoint id="myGlobManager"
                   implementor="#myGlobManagerImpl"
                   address="/myGlobManager"/>

Due to your Autowired things, you may also need a TabManager bean and similar 
stuff defined in your beans.xml.


Dan





On Tue December 22 2009 12:35:08 pm Bill Li wrote:
> Hi folks,
> 
> I have a working project and would like to introduce web service
> functionality here. I read around doc and successfully get a Foo service
> running. My env is Spring 2.5, Jetty 6/Tomat 6. But when I try to export my
> existing services, I continues hit spring exceptions. Let us come down to
> code.
> 
> Interface
> ========
> @WebService(name="myGlobManager", targetNamespace="http://cxf.apache.org")
> public interface MyGlobManager {
>     public MyGlob fetch();
> }
> 
> Impl
> ========
> @Service(value = "myGlobManager")
> @WebService(endpointInterface="com.beelun.shoppro.service.MyGlobManager")
> public class MyGlobManagerImpl extends GenericDaoHibernate<MyGlob, Long>
> implements MyGlobManager {
>     // A cache for myGlob
>     private MyGlob myGlob = null;
> 
>     @Autowired
>     public MyGlobManagerImpl(SessionFactory sessionFactory) {
>         super(MyGlob.class, sessionFactory);
>     }
> 
>     @Autowired
>     TabManager tabManager;
> 
>     @Override
>     public MyGlob fetch() {...}
> 
> Config file
> =========
> <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.xsd
>  http://cxf.apache.org/jaxws
>                 http://cxf.apache.org/schemas/jaxws.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" />
> 
>   <jaxws:endpoint id="fooManager"
> 
> implementor="com.beelun.shoppro.service.impl.FooManagerImpl"
>                   address="/fooManager"/>
> 
>   <jaxws:endpoint id="myGlobManager"
>                   implementor="#myGlobManager"
>                   address="/myGlobManager"/>
> 
> </beans>
> 
> Exceptions
> =============
> 2009-12-23 01:12:25.099::WARN:  Failed startup of context
> org.mortbay.jetty.plugin.Jetty6PluginWebAppContext@1478e67f
> {/,F:\shoppro\src\main\webapp}
> org.springframework.beans.factory.BeanCreationException: Error creating
>  bean with name 'myGlobManager': Cannot resolve reference to bean
>  'myGlobManager' while setting constructor argument; nested exception is
> org.springframework.beans.factory.BeanCurrentlyInCreationException: Error
> creating bean with name 'myGlobManager': Requested bean is currently in
> creation: Is there an unresolvable circular reference?
>     at
> org.springframework.beans.factory.support.BeanDefinitionValueResolver.resol
> veReference(BeanDefinitionValueResolver.java:275) at
> org.springframework.beans.factory.support.BeanDefinitionValueResolver.resol
> veValueIfNecessary(BeanDefinitionValueResolver.java:104) ....
> 
> Any idea?
> 
> Thanks.
> 

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog