Spring,Apache CXF和Embedded Jetty

我正在尝试使用Apache CXF,Spring和嵌入式Jetty服务器创建支持Web服务的服务器 . 当我运行我的项目时,服务器似乎正确初始化,但是当我导航到http://localhost:8080/SomeService期望看到服务WSDL时,我得到以下异常:

SEVERE: /SomeService
java.lang.NullPointerException
    at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:163)
    at org.apache.cxf.transport.servlet.AbstractCXFServlet.doGet(AbstractCXFServlet.java:145)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:389)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
    at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:324)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:535)
    at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:865)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:539)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520)

有任何想法吗?

这是Java main()

public static void main(String[] args) throws Exception {                    
    new ClassPathXmlApplicationContext(new String[] {"beans-jetty.xml"});
}

beans 类-的jetty.xml

<bean id="propertyConfigurer"
      class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="location" value="file:conf/server.properties" />
</bean>

<bean id="server"
      class="org.mortbay.jetty.Server"
      init-method="start"
      destroy-method="stop">
    <property name="connectors">
        <list>
            <bean id="connector" class="org.mortbay.jetty.nio.SelectChannelConnector">
                <property name="host" value="${server.address}"/>
                <property name="port" value="${server.port}"/>
            </bean>
        </list>
    </property>
    <property name="handlers">
        <list>
            <ref bean="context-cxf"/>
        </list>
    </property>
</bean>

<bean name="context-cxf" class="org.mortbay.jetty.servlet.Context">
    <property name="contextPath" value="/" />
    <property name="handler">
        <bean class="org.mortbay.jetty.servlet.ServletHandler">
            <property name="servlets">
                <list>
                    <bean class="org.mortbay.jetty.servlet.ServletHolder">
                        <property name="name" value="cxf-servlet-holder" />
                        <property name="servlet">
                            <bean class="org.apache.cxf.transport.servlet.CXFServlet" />
                        </property>
                    </bean>
                </list>
            </property>
            <property name="servletMappings">
                <list>
                    <bean class="org.mortbay.jetty.servlet.ServletMapping">
                        <property name="servletName" value="cxf-servlet-holder" />
                        <property name="pathSpec" value="/*" />
                    </bean>
                </list>
            </property>
        </bean>
    </property>
</bean>

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

beans 类,cxf.xml

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

<jaxws:endpoint
        id="someService"
        implementor="com.awebster.gitta.services.SomeServiceImpl"
        address="${server.address}" />

我应该提一下,我正在使用Maven one-jar插件,尽管我怀疑这对这个问题有什么影响 .

提前谢谢了!

安东尼

回答(0)