You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Daniel Kulp (JIRA)" <ji...@apache.org> on 2010/10/01 19:24:33 UTC

[jira] Resolved: (CXF-3001) NullPointerException when embledded into spring+jetty

     [ https://issues.apache.org/jira/browse/CXF-3001?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp resolved CXF-3001.
------------------------------

    Fix Version/s: 2.3
       Resolution: Won't Fix


I'm marking this resolved, but it's really a bug in Jetty.   

If you run the testcase using the jetty-beans.xml and jetty6, then you see the NPE.  The reason is that Jetty is never calling the servlet init method so the servlet configs and such are not available.    This can be verified with the TestServlet that prints stuff in it's init method.   Not seen here.


If you run with jetty 7.x  and use the updated jetty7-beans.xml (class names changed in 7), it does work as the init is called.   The prints in the TestServlet are seen.    Thus, this is a bug in jetty6.

With 2.3, we ARE moving to Jetty 7 so I'll mark this fixed in 2.3, but it's really not a "fix".

> NullPointerException when embledded into spring+jetty
> -----------------------------------------------------
>
>                 Key: CXF-3001
>                 URL: https://issues.apache.org/jira/browse/CXF-3001
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.2.10
>            Reporter: Krystian Siuda
>             Fix For: 2.3
>
>         Attachments: cxf3001.tar.gz
>
>
> I'm running embedded jetty inside of a spring ioc container. The spring ioc contains also an embedded hsqldb which makes the whole configuration a nice and complete web application development environment (on a single JVM). Now I'm trying to add apache CXF to this environment to make the jetty host not only servlets but also web services. Unfortunately I'm getting NullPointerException when attempting to access http://127.0.0.1:8080/cxf/* (servlets and static content are served ok). Even if the configuration is wrong NPE should not be thrown.
> stacktrace:
> {noformat}
> java.lang.NullPointerException
>     at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:142)
>     at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
>     at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108)
>     at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
>     at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
>     at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
>     at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:367)
>     at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
>     at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
>     at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
>     at org.mortbay.jetty.Server.handle(Server.java:281)
>     at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:502)
>     at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:821)
>     at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:513)
>     at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:208)
>     at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:378)
>     at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:368)
>     at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
> {noformat}
> I'm initializing spring with:
> {code:java}
> public static void main(String[] args) throws Exception {
>     ApplicationContext applicationContext = new ClassPathXmlApplicationContext(new String[] { "jetty-beans.xml" , "cxf-beans.xml" });
>     applicationContext.getBean("web-server", Server.class).join();
> }
> {code}
> jetty-beans.xml
> {code: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"
>     xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
>     <bean name="web-server" class="org.mortbay.jetty.Server"
>         init-method="start">
>         <property name="connectors">
>             <list>
>                 <bean class="org.mortbay.jetty.nio.SelectChannelConnector">
>                     <property name="host" value="localhost" />
>                     <property name="port" value="8080" />
>                 </bean>
>             </list>
>         </property>
>         <property name="handlers">
>             <list>
>                 <ref bean="web-server-context-static" />
>                 <ref bean="web-server-context-servlet" />
>                 <ref bean="web-server-context-cxf" />
>             </list>
>         </property>
>     </bean>
>     <bean name="web-server-context-static" class="org.mortbay.jetty.servlet.Context">
>         <property name="contextPath" value="/static" />
>         <property name="handler">
>             <bean class="org.mortbay.jetty.handler.ResourceHandler">
>                 <property name="resourceBase" value="static" />
>             </bean>
>         </property>
>     </bean>
>     <bean name="web-server-context-servlet" class="org.mortbay.jetty.servlet.Context">
>         <property name="contextPath" value="/servlet" />
>         <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="servlet-holder" />
>                             <property name="servlet">
>                                 <bean class="test.TestServlet" />
>                             </property>
>                         </bean>
>                     </list>
>                 </property>
>                 <property name="servletMappings">
>                     <list>
>                         <bean class="org.mortbay.jetty.servlet.ServletMapping">
>                             <property name="servletName" value="servlet-holder" />
>                             <property name="pathSpec" value="/*" />
>                         </bean>
>                     </list>
>                 </property>
>             </bean>
>         </property>
>     </bean>
>     <bean name="web-server-context-cxf" class="org.mortbay.jetty.servlet.Context">
>         <property name="contextPath" value="/cxf" />
>         <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">
>                                 </bean>
>                             </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>
> </beans>
> {code}
> cxf-beans.xml
> {code: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:jaxws="http://cxf.apache.org/jaxws"
>     xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.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" />
>     <bean id="test-ws-impl" class="test.TestWSImpl" />
>     <jaxws:endpoint id="test-ws-endpoint" implementor="#test-ws-impl"
>         address="/testWS" />
> </beans>
> {code}
> classpath:
> {noformat}
> activation-1.1.jar
> commons-logging-1.1.1.jar
> cxf-2.2.10.jar
> jaxb-api-2.1.jar
> jaxb-impl-2.1.13.jar
> jcl-over-slf4j-1.6.1.jar
> jetty-6.1.3.jar
> jetty-annotations-6.1.3.jar
> jetty-util-6.1.3.jar
> log4j-1.2.16.jar
> neethi-2.0.4.jar
> org.springframework.aop-3.0.3.RELEASE.jar
> org.springframework.asm-3.0.3.RELEASE.jar
> org.springframework.beans-3.0.3.RELEASE.jar
> org.springframework.context-3.0.3.RELEASE.jar
> org.springframework.context.support-3.0.3.RELEASE.jar
> org.springframework.core-3.0.3.RELEASE.jar
> org.springframework.expression-3.0.3.RELEASE.jar
> servlet-api-2.5-6.1.3.jar
> slf4j-api-1.6.1.jar
> slf4j-log4j12-1.6.1.jar
> wsdl4j-1.6.2.jar
> XmlSchema-1.4.5.jar
> {noformat}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.