<http://stackoverflow.com/questions/6226637/apache-cxf-resource-handler-with-embedded-jetty-in-osgi-with-spring-dm#>

Hi everyone,


i'm trying to run an apache cxf endpoint in an equinox osgi environment with
jetty 7. I need the endpoint to be on address
http://x.x.x.x:8080/ws/endpoint1 and have static resources on the root path
http://x.x.x.x:8080/*.

I have a dedicated bundle for this purpose containing the cxf libraries.
Spring dynamic modules are part of my target platform.

After some research I tried to start the jetty webserver in my spring
application context.

<bean id="Server" class="org.eclipse.jetty.server.Server"
    init-method="start" destroy-method="stop">

    <property name="connectors">
        <list>
            <bean id="Connector"
class="org.eclipse.jetty.server.nio.SelectChannelConnector">
                <property name="port" value="8080" />
            </bean>
        </list>
    </property>

    <property name="handler">
        <bean id="handlers"
class="org.eclipse.jetty.server.handler.HandlerList">
            <property name="handlers">
                <list>
                    <bean
class="org.eclipse.jetty.server.handler.ResourceHandler">
                        <property name="directoriesListed" value="true" />
                        <property name="welcomeFiles">
                            <list>
                                <value>index.html</value>
                            </list>
                        </property>
                        <property name="resourceBase" value="./someDir" />
                    </bean>
                    <ref bean="web-service-cxf" />
                    <bean
class="org.eclipse.jetty.server.handler.DefaultHandler" />
                </list>
            </property>
        </bean>
    </property>
</bean>



<bean name="web-service-cxf"
class="org.eclipse.jetty.servlet.ServletContextHandler">
    <property name="contextPath" value="/ws" />
    <property name="handler">
        <bean class="org.eclipse.jetty.servlet.ServletHandler">
            <property name="servlets">
                <list>
                    <bean class="org.eclipse.jetty.servlet.ServletHolder">
                        <property name="name" value="cxf-servlet-holder" />
                        <property name="servlet">
                            <bean
class="org.apache.cxf.transport.servlet.CXFServlet">
                            </bean>
                        </property>
                    </bean>
                </list>
            </property>
            <property name="servletMappings">
                <list>
                    <bean class="org.eclipse.jetty.servlet.ServletMapping">
                        <property name="servletName"
value="cxf-servlet-holder" />
                        <property name="pathSpec" value="/*" />
                    </bean>
                </list>
            </property>
        </bean>
    </property>
</bean>

My WebService Endpoint is declared with:

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

<bean id="someService" class="abc.xyz.SomeClass" />
<jaxws:endpoint id="endpointId" implementor="#someBean"
    address="/endpoint1">
</jaxws:endpoint>

Unfortunatly this is not working. I can reach the static resources, but not
the webservice. The log says, the WebService is published under address
/endpoint1. No warnings, no exceptions.

When I change the address of the webservice to its full url

<bean id="someService" class="abc.xyz.SomeClass" />
<jaxws:endpoint id="endpointId" implementor="#someBean"
    address="http://x.x.x.x:8080/ws/endpoint1";>
</jaxws:endpoint>

the webservice works fine, but the static ressources are not available any
more.

Is it possible with a configuration like this to publish an endpoint to a
running jetty with relative address? Or am I totally wrong? Most examples I
found on the web use a web.xml, but I'm not working with an application
server like tomcat and need the application to be a standalone eclipse app.

Spend the whole last two nights on this, any help is highly appreciated.

Kind regards, Onno


I also posted on stackoverflow yesterday because I'm a bit under pressure
with this issue, hope that's fine.
http://stackoverflow.com/questions/6226637/apache-cxf-resource-handler-with-embedded-jetty-in-osgi-with-spring-dm

Reply via email to