Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1106491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:48:06+00:00 2026-05-17T01:48:06+00:00

I try to create simple web service with CXF, Jetty and Spring. I create

  • 0

I try to create simple web service with CXF, Jetty and Spring. I create service interface

@WebService
public interface AnonymousService {

    @WebMethod
    public String getVersion();
}

and its implementation

@Service("anonymousService")
@WebService(
    serviceName = "AnonymousService",
    targetNamespace = "http://ws.test/",
    endpointInterface = "test.ws.AnonymousService"
)
public class AnonymousServiceImpl {
    public String getVersion() {
        return "Version";
    }
}

Next step I add to Spring context configuration file endpoint declaration

<jaxws:endpoint id="anonymousServiceEndpoint"
    implementor="#anonymousService" address="/anonymous" />

and configure Jetty bean

<bean id="server" class="org.mortbay.jetty.Server" destroy-method="stop">
    <property name="connectors">
    <list>
            <bean id="connector" class="org.mortbay.jetty.nio.SelectChannelConnector">
                <property name="port" value="${server.port}" />
            </bean>
        </list>
    </property>

    <property name="handlers">
        <list>
            <ref bean="workflowContext" />
        </list>
    </property>
 </bean>

<bean name="workflowContext" class="org.mortbay.jetty.servlet.Context">
    <property name="contextPath" value="/" />

        <property name="servletHandler">
            <bean class="org.mortbay.jetty.servlet.ServletHandler">
                <property name="servlets">
                    <list>
                        <bean class="org.mortbay.jetty.servlet.ServletHolder">
                            <property name="name" value="services" />
                            <property name="servlet">
                                <bean class="org.apache.cxf.transport.servlet.CXFServlet" />
                                <!--<bean class="org.apache.cxf.transport.servlet.CXFNonSpringServlet" />-->
                            </property>
                        </bean>
                    </list>
                </property>

                <property name="servletMappings">
                    <list>
                        <bean class="org.mortbay.jetty.servlet.ServletMapping">
                            <property name="servletName" value="services" />
                            <property name="pathSpec" value="/services/*" />
                        </bean>
                    </list>
                </property>
            </bean>
        </property>
</bean>

Unfortunately, when I start my application I get following stack trace

25.09.2010 14:48:07 org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromClass
INFO: Creating Service {http://ws.test/}AnonymousService from class name.krestjaninoff.application.interfaces.AnonymousService
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'anonymousServiceEndpoint': Invocation of init method failed; nested exception is javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1412)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:574)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
    at name.krestjaninoff.application.Server.main(Server.java:20)
Caused by: javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException
    at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:275)
    at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:209)
    at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:404)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1536)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409)
    ... 12 more
Caused by: org.apache.cxf.service.factory.ServiceConstructionException
    at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:139)
    at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:167)
    at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:346)
    at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:259)
    ... 21 more
Caused by: java.net.MalformedURLException: no protocol: /anonymous
    at java.net.URL.<init>(URL.java:583)
    at java.net.URL.<init>(URL.java:480)
    at java.net.URL.<init>(URL.java:429)
    at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.<init>(JettyHTTPDestination.java:93)
    at org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.createDestination(JettyHTTPTransportFactory.java:116)
    at org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.getDestination(JettyHTTPTransportFactory.java:103)
    at org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:90)
    at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:69)
    at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:118)
    ... 24 more

What I do wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T01:48:07+00:00Added an answer on May 17, 2026 at 1:48 am

    My problem solved by adding cxf.xml configuration file into root of classpath

    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.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"/>
    
    </beans>
    

    I didn’t do this before, because I didn’t understand what should be in META_INF/cxf/.xml files. In fact, these files do not need to be created – they are already exists in cxf-rt- packages!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have create a web service in glassfish v3. The method I am try
I've written a fairly simple little C# web service, hosted from a standalone EXE
When I try to create a SQL Server Login by saying CREATE LOGIN [ourdomain\SQLAccessGroup]
When I try to create a new RegionInfo with certain ISO 3166 country codes
When I try to create a Excel 2007 Workbook project, in Visual Studio 2008,
When I try to create a Excel or Word workbook project in VS, I
When I try to create a trigger in schema A for a table located
When I try to create a new Maintenance Plan in SQL Server, I get
I create a pointer-to-pointer of a class object and when I try to create
I'm working with my ASP.NET development team to try and create better (i.e. cleaner)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.