You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Maxim Solodovnik <so...@gmail.com> on 2017/04/18 16:47:48 UTC

CXF and web app spring beans

Hello All,

I recently noticed weird thing (cxf 3.1.11)
I have java-first jax-ws/jax-rs services described as spring beans: [1] [2]
And Wicket based spring web application also using same spring beans

The problem is: beans are not shared between CXF and web app, it seems I
have 2 set of beans
Is it by design? Is there any chance to access web app bean from CXF?

[1]
https://github.com/apache/openmeetings/blob/3.2.x/openmeetings-web/src/main/webapp/WEB-INF/classes/openmeetings-applicationContext.xml#L239
[2]
https://github.com/apache/openmeetings/blob/3.2.x/openmeetings-web/src/main/webapp/WEB-INF/web.xml#L34

-- 
WBR
Maxim aka solomax

Re: CXF and web app spring beans

Posted by Maxim Solodovnik <so...@gmail.com>.
ContextLoaderListener seems to be in conflict with current bean initializer
:(
Is there any way to do the same (i.e. set CXFServlet) other way?

On Wed, Apr 19, 2017 at 6:43 PM, Maxim Solodovnik <so...@gmail.com>
wrote:

> Other beans being created and works as expected
> I'll try to change code and add ContextLoaderListener
> will report back
>
> On Wed, Apr 19, 2017 at 6:23 PM, Dennis Kieselhorst <de...@apache.org>
> wrote:
>
>> Looks like ContextLoaderListener is not defined, is it?
>> http://docs.spring.io/spring/docs/current/spring-framework-r
>> eference/htmlsingle/#context-create
>>
>> Regards
>> Dennis
>>
>
>
>
> --
> WBR
> Maxim aka solomax
>



-- 
WBR
Maxim aka solomax

Re: CXF and web app spring beans

Posted by Maxim Solodovnik <so...@gmail.com>.
Other beans being created and works as expected
I'll try to change code and add ContextLoaderListener
will report back

On Wed, Apr 19, 2017 at 6:23 PM, Dennis Kieselhorst <de...@apache.org> wrote:

> Looks like ContextLoaderListener is not defined, is it?
> http://docs.spring.io/spring/docs/current/spring-framework-
> reference/htmlsingle/#context-create
>
> Regards
> Dennis
>



-- 
WBR
Maxim aka solomax

Re: CXF and web app spring beans

Posted by Dennis Kieselhorst <de...@apache.org>.
Looks like ContextLoaderListener is not defined, is it?
http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/#context-create

Regards
Dennis

Re: CXF and web app spring beans

Posted by Maxim Solodovnik <so...@gmail.com>.
Thanks a lot for the quick response :)
Just have tried to remove config-location param and got:

[WARN] [http-nio-0.0.0.0-5080-exec-1]
org.apache.cxf.transport.servlet.ServletController - Can't find the the
request for http://localhost:5080/openmeetings/services/user/login's
Observer

404
No service was found.

on the client


On Wed, Apr 19, 2017 at 2:04 PM, Dennis Kieselhorst <de...@apache.org> wrote:

> Hi!
>
> > The problem is: beans are not shared between CXF and web app, it seems I
> > have 2 set of beans
> > Is it by design? Is there any chance to access web app bean from CXF?
>
> You mean you have to instances of the application context? Reason for that
> might be that you specified the config-location in CXFServlet config and
> also used contextConfigLocation which imports openmeetings-applicationContext.xml
> through red5-web.xml again. Try to drop the config-location param from
> CXFServlet config.
>
> Regards
> Dennis
>



-- 
WBR
Maxim aka solomax

Re: CXF and web app spring beans

Posted by Dennis Kieselhorst <de...@apache.org>.
Hi!

> The problem is: beans are not shared between CXF and web app, it seems I
> have 2 set of beans
> Is it by design? Is there any chance to access web app bean from CXF?

You mean you have to instances of the application context? Reason for that might be that you specified the config-location in CXFServlet config and also used contextConfigLocation which imports openmeetings-applicationContext.xml through red5-web.xml again. Try to drop the config-location param from CXFServlet config.

Regards
Dennis