Forum Home » Fuse Distributions » Fuse ESB

Thread: Deploying RestFULL Webservices with Spring

 

Permlink Replies: 2 - Last Post: Feb 28, 2012 8:27 PM Last Post By: moacsjr Threads: [ Previous | Next ]
moacsjr

Posts: 7
Registered: 02/23/12
Deploying RestFULL Webservices with Spring
Posted: Feb 23, 2012 4:22 PM
  Click to reply to this thread Reply
I'm having trouble deploying my RestWS application using Spring and CXF.
I created an OSGI bundle with the following structure:

br.teste.services.rest
. |____ META-INF
.......|___MANIFEST.MF
.............. |___spring
..................... |___applicationContext.xml
. |____br.teste.services.rest
..............|____ ...

MANIFEST.MF


Manifest-Version: 1.0
Bnd-LastModified: 1330009008451
Bundle-ManifestVersion: 2
Bundle-Name: Teste Rest WebService
Bundle-SymbolicName: br.teste.services.rest
Bundle-Version: 1.0.0
Created-By: 1.6.0_27 (Sun Microsystems Inc.)
Export-Package: br.teste.services.rest;uses:="javax.ws.rs,org.springfram
ework.stereotype";version="1.0"
Import-Package: javax.ws.rs,org.springframework.stereotype
Include-Resource: META-INF = src/META-INF
Tool: Bnd-1.51.0

ApplicationContext.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:aop="http://www.springframework.org/schema/aop"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:task="http://www.springframework.org/schema/task"
xmlns:tx="http://www.springframework.org/schema/tx"
>

<context:component-scan base-package="br.teste.services.rest"/>

<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/osgi/cxf-extension-osgi.xml" />

<jaxrs:server id="helloService" address="/hello">
<jaxrs:serviceBeans>
<ref bean="helloBean"/>
</jaxrs:serviceBeans>
</jaxrs:server>

</beans>

I can install and start the bundle, but I can not call the service by web browser.

Which log file should I look?

ffang

Posts: 1,320
Registered: 12/24/07
Re: Deploying RestFULL Webservices with Spring
Posted: Feb 24, 2012 1:02 AM   in response to: moacsjr in response to: moacsjr
  Click to reply to this thread Reply
Hi,

Could you take a look at cxf-jaxrs example shipped with FUSE ESB kit? It's very similar with your scenario and should be a good start for you.

Freeman
moacsjr

Posts: 7
Registered: 02/23/12
Re: Deploying RestFULL Webservices with Spring
Posted: Feb 28, 2012 8:27 PM   in response to: ffang in response to: ffang
  Click to reply to this thread Reply
Thanks for the tip!
I was able to detect the problem. It was caused by a classpath issue.

:-)