cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roberto Francescangeli <roberto.francescang...@gmail.com>
Subject Re: Unable to get CXF 3.0.5 in Jetty 8 standalone working with Atmosphere websockets
Date Wed, 29 Jul 2015 18:08:58 GMT
Hi Aki,

this is the list of dependencies I am currently loading using maven:
+- org.eclipse.jetty:jetty-webapp:jar:8.1.15.v20140411:test
|  \- org.eclipse.jetty:jetty-xml:jar:8.1.15.v20140411:test
+- org.eclipse.jetty:jetty-servlet:jar:8.1.15.v20140411:test
+- junit:junit:jar:4.11:test (scope not updated to compile)
+- junit-addons:junit-addons:jar:1.4:test
|  \- xerces:xmlParserAPIs:jar:2.6.2:test
+- org.easytesting:fest-swing:jar:1.2.1:test
|  +- org.easytesting:fest-assert:jar:1.2:test
|  +- org.easytesting:fest-reflect:jar:1.2:test
|  \- net.jcip:jcip-annotations:jar:1.0:test
+- org.easytesting:fest-swing-junit:jar:1.2.1:test
+- org.easytesting:fest-swing-junit-4.5:jar:1.2.1:test
+- org.easytesting:fest-util:jar:1.1.6:test
+- com.h2database:h2:jar:1.4.184:test
+- pl.pragmatists:JUnitParams:jar:0.5.0:test
+- org.mockito:mockito-core:jar:1.9.5:test
+- org.objenesis:objenesis:jar:2.1:test
+- org.powermock:powermock-api-mockito:jar:1.5.5:test
+- org.powermock:powermock-api-support:jar:1.5.5:test
+- org.powermock:powermock-classloading-base:jar:1.5.5:test
+- org.powermock:powermock-core:jar:1.5.5:test
+- org.powermock:powermock-module-junit4:jar:1.5.5:test
+- org.powermock:powermock-module-junit4-common:jar:1.5.5:test
+- org.powermock:powermock-module-junit4-legacy:jar:1.5.5:test
+- org.powermock:powermock-reflect:jar:1.5.5:test
+- org.hamcrest:hamcrest-core:jar:1.3:test
+- org.apache.derby:derby:jar:10.9.1.0:test
+- avalon-framework:avalon-framework-cvs:jar:20020806:compile
+- commons-csv:commons-csv:jar:bluebird:compile
+- commons-cli:commons-cli:jar:1.2:compile
+- commons-codec:commons-codec:jar:1.6:compile
+- commons-collections:commons-collections:jar:3.2.1:compile
+- commons-configuration:commons-configuration:jar:1.8:compile
+- commons-dbutils:commons-dbutils:jar:1.2:compile
+- org.apache.commons:commons-email:jar:1.3.1:compile
+- commons-fileupload:commons-fileupload:jar:1.2.1:compile
+- commons-httpclient:commons-httpclient:jar:3.1:compile
+- commons-io:commons-io:jar:2.0.1:compile
+- commons-lang:commons-lang:jar:2.6:compile
+- commons-logging:commons-logging:jar:1.1.1:compile
+- commons-pool:commons-pool:jar:1.6:compile
+- commons-validator:commons-validator:jar:1.3.0:compile
+- org.apache.httpcomponents:httpclient:jar:4.1.2:compile
+- org.apache.httpcomponents:httpcore:jar:4.1.2:compile
+- org.apache.httpcomponents:httpmime:jar:4.1.2:compile
+- org.apache.lucene:lucene-analyzers:jar:3.6.0:compile
+- org.apache.lucene:lucene-core:jar:3.6.0:compile
+- org.apache.lucene:lucene-spellchecker:jar:3.6.0:compile
+- org.bouncycastle:bcpkix-jdk15on:jar:1.47:compile
+- org.bouncycastle:bcprov-ext-jdk15on:jar:1.47:compile
+- org.freemarker:freemarker:jar:2.3.16:compile
+- com.sun:ldapbp:jar:1.0:compile
+- org.apache.cxf:cxf-core:jar:3.0.5:compile
|  +- org.codehaus.woodstox:woodstox-core-asl:jar:4.4.1:compile
|  |  \- org.codehaus.woodstox:stax2-api:jar:3.1.4:compile
|  \- org.apache.ws.xmlschema:xmlschema-core:jar:2.2.1:compile
+- org.apache.cxf:cxf-rt-ws-security:jar:3.0.5:compile
|  +- org.apache.cxf:cxf-rt-bindings-soap:jar:3.0.5:compile
|  |  +- org.apache.cxf:cxf-rt-wsdl:jar:3.0.5:compile
|  |  |  \- wsdl4j:wsdl4j:jar:1.6.3:compile
|  |  \- org.apache.cxf:cxf-rt-databinding-jaxb:jar:3.0.5:compile
|  |     +- com.sun.xml.bind:jaxb-impl:jar:2.2.11:compile
|  |     \- com.sun.xml.bind:jaxb-core:jar:2.2.11:compile
|  +- org.apache.cxf:cxf-rt-security:jar:3.0.5:compile
|  |  \- org.apache.wss4j:wss4j-ws-security-common:jar:2.0.4:compile
|  |     +- org.apache.santuario:xmlsec:jar:2.0.4:compile
|  |     +- org.opensaml:opensaml:jar:2.6.1:compile
|  |     |  \- org.opensaml:openws:jar:1.5.1:compile
|  |     |     \- org.opensaml:xmltooling:jar:1.4.1:compile
|  |     +- org.jasypt:jasypt:jar:1.9.2:compile
|  |     \-
org.apache.geronimo.specs:geronimo-javamail_1.4_spec:jar:1.7.1:compile
|  +- org.apache.wss4j:wss4j-ws-security-dom:jar:2.0.4:compile
|  +- org.apache.wss4j:wss4j-policy:jar:2.0.4:compile
|  |  \- org.apache.neethi:neethi:jar:3.0.3:compile
|  +- org.apache.wss4j:wss4j-ws-security-stax:jar:2.0.4:compile
|  |  \- org.apache.wss4j:wss4j-bindings:jar:2.0.4:compile
|  \- org.apache.wss4j:wss4j-ws-security-policy-stax:jar:2.0.4:compile
+- org.apache.cxf:cxf-rt-transports-http:jar:3.0.5:compile
+- org.apache.cxf:cxf-rt-transports-http-jetty:jar:3.0.5:compile
|  \- org.apache.geronimo.specs:geronimo-servlet_3.0_spec:jar:1.0:compile
+- org.apache.cxf:cxf-rt-transports-websocket:jar:3.0.5:compile
+- org.apache.cxf:cxf-rt-rs-client:jar:3.0.5:compile
|  \- org.apache.cxf:cxf-rt-frontend-jaxrs:jar:3.0.5:compile
|     \- javax.annotation:javax.annotation-api:jar:1.2:compile
+- org.atmosphere:atmosphere-annotations:jar:2.3.3:compile
|  \- org.atmosphere:atmosphere-runtime:jar:2.3.3:compile
+- com.wordnik:swagger-jersey2-jaxrs_2.10:jar:1.3.12:compile
|  +- com.wordnik:swagger-jaxrs_2.10:jar:1.3.12:compile
|  |  +- org.scala-lang:scala-library:jar:2.10.4:compile
|  |  +- com.wordnik:swagger-core_2.10:jar:1.3.12:compile
|  |  |  +-
com.fasterxml.jackson.module:jackson-module-scala_2.10:jar:2.4.1:compile
|  |  |  |  +- org.scala-lang:scala-reflect:jar:2.10.4:compile
|  |  |  |  \- com.thoughtworks.paranamer:paranamer:jar:2.6:compile
|  |  |  +-
com.fasterxml.jackson.module:jackson-module-jsonSchema:jar:2.4.1:compile
|  |  |  +- org.json4s:json4s-ext_2.10:jar:3.2.11:compile
|  |  |  |  \- org.joda:joda-convert:jar:1.6:compile
|  |  |  +- org.json4s:json4s-native_2.10:jar:3.2.11:compile
|  |  |  |  \- org.json4s:json4s-core_2.10:jar:3.2.11:compile
|  |  |  |     +- org.json4s:json4s-ast_2.10:jar:3.2.11:compile
|  |  |  |     \- org.scala-lang:scalap:jar:2.10.0:compile
|  |  |  |        \- org.scala-lang:scala-compiler:jar:2.10.0:compile
|  |  |  \- org.json4s:json4s-jackson_2.10:jar:3.2.11:compile
|  |  \- org.reflections:reflections:jar:0.9.9:compile
|  |     \- com.google.code.findbugs:annotations:jar:2.0.1:compile
|  +-
org.glassfish.jersey.containers:jersey-container-servlet-core:jar:2.1:compile
|  |  +- org.glassfish.hk2.external:javax.inject:jar:2.2.0-b10:compile
|  |  +- org.glassfish.jersey.core:jersey-server:jar:2.1:compile
|  |  |  +- org.glassfish.jersey.core:jersey-client:jar:2.1:compile
|  |  |  +- org.glassfish.hk2:hk2-api:jar:2.2.0-b10:compile
|  |  |  |  \- org.glassfish.hk2:hk2-utils:jar:2.2.0-b10:compile
|  |  |  \- org.glassfish.hk2:hk2-locator:jar:2.2.0-b10:compile
|  |  |     +-
org.glassfish.hk2.external:asm-all-repackaged:jar:2.2.0-b10:compile
|  |  |     \- org.glassfish.hk2.external:cglib:jar:2.2.0-b10:compile
|  |  \- org.glassfish.jersey.core:jersey-common:jar:2.1:compile
|  |     \- org.glassfish.hk2:osgi-resource-locator:jar:1.0.1:compile
|  \- org.glassfish.jersey.media:jersey-media-multipart:jar:2.1:compile
+- com.wordnik:swagger-annotations:jar:1.3.12:compile
+- org.codehaus.jettison:jettison:jar:1.3.1:compile
+- org.eclipse.jetty:jetty-continuation:jar:8.1.15.v20140411:compile
+- org.eclipse.jetty:jetty-http:jar:8.1.15.v20140411:compile
+- org.eclipse.jetty:jetty-io:jar:8.1.15.v20140411:compile
+- org.eclipse.jetty:jetty-security:jar:8.1.15.v20140411:compile
+- org.eclipse.jetty:jetty-server:jar:8.1.15.v20140411:compile
+- org.eclipse.jetty:jetty-util:jar:8.1.15.v20140411:compile
+- org.eclipse.jetty:jetty-jmx:jar:8.1.15.v20140411:compile
+- org.eclipse.jetty:jetty-websocket:jar:8.1.15.v20140411:compile
+- joda-time:joda-time:jar:1.6.2:compile
+- joda-time:joda-time-hibernate:jar:1.3:compile
+- javax.ws.rs:javax.ws.rs-api:jar:2.0.1:compile
+- javax.validation:validation-api:jar:1.1.0.Final:compile
+- net.java.dev.msv:msv-core:jar:2011.1:compile
|  +- com.sun.msv.datatype.xsd:xsdlib:jar:2010.1:compile
|  +- isorelax:isorelax:jar:20030108:compile
|  \- relaxngDatatype:relaxngDatatype:jar:20020414:compile
+- com.lowagie:itext:jar:2.1.7:compile
+- com.lowagie:itext-rtf:jar:2.1.7:compile
+- org.apache.poi:poi:jar:3.9:compile
+- org.apache.poi:poi-ooxml:jar:3.9:compile
+- com.google.guava:guava:jar:18.0:compile
+- jfree:jcommon:jar:1.0.16:compile
+- org.swinglabs:swing-layout:jar:1.0.3:compile
+- com.google.inject:guice:jar:3.0:compile
|  \- aopalliance:aopalliance:jar:1.0:compile
+- com.google.inject.extensions:guice-assistedinject:jar:3.0:compile
+- com.google.inject.extensions:guice-throwingproviders:jar:3.0:compile
+- com.google.inject.extensions:guice-grapher:jar:3.0:compile
|  \- com.google.inject.extensions:guice-multibindings:jar:3.0:compile
+- com.google.inject.extensions:guice-servlet:jar:3.0:compile
+- javax.inject:javax.inject:jar:1:compile
+- antlr:antlr:jar:2.7.6:compile
+- com.mchange:c3p0:jar:0.9.2.1:compile
+- c3p0:c3p0-oracle-thin-extras:jar:0.9.0.2:compile
+- com.mchange:mchange-commons-java:jar:0.2.6.3:compile
+- cglib:cglib-nodep:jar:3.1:compile
+- javax.transaction:jta:jar:1.1:compile
+- org.hibernate:hibernate-core:jar:3.6.10.Final:compile
+- org.hibernate:hibernate-c3p0:jar:3.6.10.Final:compile
+- org.hibernate:hibernate-commons-annotations:jar:3.2.0.Final:compile
+- org.hibernate:hibernate-validator:jar:4.3.2.Final:compile
|  \- org.jboss.logging:jboss-logging:jar:3.1.0.CR2:compile
+-
org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Final:compile
+- org.javassist:javassist:jar:3.17.1-GA:compile
+- com.fasterxml.jackson.core:jackson-annotations:jar:2.1.1:compile
+- com.fasterxml.jackson.core:jackson-core:jar:2.1.1:compile
+- com.fasterxml.jackson.core:jackson-databind:jar:2.1.1:compile
+- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.1.1:compile
|  \-
com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.1.1:compile
+- de.simplicit:vjdbc:jar:BLUEBIRD:compile
+- com.oracle:ojdbc6:jar:11.1.0.7.0:compile
+- postgresql:postgresql:jar:9.1-901.jdbc4:compile
+- jide:jide-common:jar:3.5.12:compile
+- jide:jide-grids:jar:3.5.12:compile
+- de.schlichtherle.truelicense:truelicense:jar:bluebird:compile
+- de.schlichtherle.truelicense:truelicense-xml:jar:bluebird:compile
+- log4j:log4j:jar:1.2.17:compile
+- org.slf4j:slf4j-api:jar:1.6.2:compile
+- org.slf4j:slf4j-log4j12:jar:1.6.2:compile
+- commons-math:commons-math:jar:1.2:compile
+- com.singularsys:jep-java:jar:3.4:compile
+- com.google.code.findbugs:jsr305:jar:1.3.9:compile
+- com.healthmarketscience.rmiio:rmiio:jar:2.0.0:compile
+- javax.mail:mail:jar:1.3.3_01:compile
+- org.liquibase:liquibase-core:jar:3.1.1:compile
+- org.springframework:spring-aop:jar:3.2.14.RELEASE:compile
+- org.springframework:spring-beans:jar:3.2.14.RELEASE:compile
+- org.springframework:spring-context:jar:3.2.14.RELEASE:compile
+- org.springframework:spring-core:jar:3.2.14.RELEASE:compile
+- org.springframework:spring-expression:jar:3.2.14.RELEASE:compile
+- org.springframework:spring-jdbc:jar:3.2.14.RELEASE:compile
+- org.springframework.ldap:spring-ldap:jar:all:1.3.1.RELEASE:compile
+- org.springframework:spring-tx:jar:3.2.14.RELEASE:compile
+- org.springframework:spring-web:jar:3.2.14.RELEASE:compile
+-
org.springframework.security:spring-security-web:jar:3.2.7.RELEASE:compile
|  \-
org.springframework.security:spring-security-core:jar:3.2.7.RELEASE:compile
+-
org.springframework.security:spring-security-config:jar:3.2.7.RELEASE:runtime
+- xerces:xercesImpl:jar:2.9.1:compile
+- xalan:serializer:jar:2.7.1:compile
+- xml-apis:xml-apis:jar:1.3.04:compile
+- dom4j:dom4j:jar:1.6.1:compile
+- jaxen:jaxen:jar:1.1.1:compile
+- jide:jide-action:jar:3.5.12:provided
+- jide:jide-charts:jar:3.5.12:provided
+- jide:jide-components:jar:3.5.12:provided
+- jide:jide-dashboard:jar:3.5.12:provided
+- jide:jide-data:jar:3.5.12:provided
+- jide:jide-dialogs:jar:3.5.12:provided
+- jide:jide-diff:jar:3.5.12:provided
+- jide:jide-dock:jar:3.5.12:provided
+- jide:jide-editor:jar:3.5.12:provided
+- jide:jide-gantt:jar:3.5.12:provided
+- jide:jide-pivot:jar:3.5.12:provided
+- jide:jide-plaf:jar:3.5.12:provided
+- jide:jide-properties:jar:3.5.12:provided
+- jide:jide-rss:jar:3.5.12:provided
+- jide:jide-shortcut:jar:3.5.12:provided
+- jide:jide-treemap:jar:3.5.12:provided
+- jung:jung:jar:bluebird:provided
+- org.eclipse.jetty:jetty-distribution:tar.gz:8.1.15.v20140411:test
+- com.github.spullara.mustache.java:compiler:jar:0.8.13:provided
+- dk.brics.automaton:automaton:jar:1.11-8:compile
+- org.codehaus.castor:castor-core:jar:1.3.1:compile
+- org.codehaus.castor:castor-xml:jar:1.3.1:compile
+- org.apache.commons:commons-compress:jar:1.4.1:compile
+- org.apache.commons:commons-exec:jar:1.1:compile
+- org.apache.pdfbox:fontbox:jar:1.8.2:compile
+- com.jgoodies:forms:jar:1.1.0:compile
+- org.freehep:freehep-graphics2d:jar:2.2.1:compile
+- org.freehep:freehep-graphicsbase:jar:2.2.1:compile
+- org.freehep:freehep-graphicsio:jar:2.2.1:compile
+- org.freehep:freehep-graphicsio-emf:jar:2.2.1:compile
+- org.freehep:freehep-graphicsio-pdf:jar:2.2.1:compile
+- org.freehep:freehep-io:jar:2.2.2:compile
+- com.googlecode.jcamp-dx:jcamp-dx:jar:0.9.1:compile
+- org.apache.pdfbox:jempbox:jar:1.8.2:compile
+- org.json:json:jar:20070829:compile
+- com.googlecode.juniversalchardet:juniversalchardet:jar:1.0.3:compile
+- com.jgoodies:looks:jar:2.1.4:compile
+- org.apache.pdfbox:pdfbox:jar:1.8.2:compile
+- org.apache.poi:poi-scratchpad:jar:3.8:compile
+- regexp:regexp:jar:1.2:compile
+- com.sun.xml.messaging.saaj:saaj-impl:jar:1.3.19:compile
|  \- org.jvnet.mimepull:mimepull:jar:1.7:compile
+- org.ccil.cowan.tagsoup:tagsoup:jar:1.2.1:compile
+- org.apache.tika:tika-core:jar:1.2:compile
+- org.apache.tika:tika-parsers:jar:1.2:compile
|  \- asm:asm:jar:3.1:compile
+- org.apache.ws.commons.util:ws-commons-util:jar:1.0.2:compile
+- org.apache.xmlrpc:xmlrpc-client:jar:3.1.3:compile
+- org.apache.xmlrpc:xmlrpc-common:jar:3.1.3:compile
+- org.tukaani:xz:jar:1.0:compile


I tried using AtmosphereServlet and have that load my CXFServlet using the
atmosphere.xml approach but, not only I'm still getting the same NPE, also
my existing HTTP endpoints are not working anymore.
They don't receive requests anymore even though servlet filters work as
usual.

2015-07-29 13:53 GMT-04:00 Aki Yoshida <elakito@gmail.com>:

> I saw you cross-posted your question to @atmosphere and I replied to
> the other message earlier.
> As I mentioned there, you need to distinguish the two distinct ways in
> using cxf and atmosphere together.
> One approach is to use the cxf's websocket transport that internally
> uses atmosphere to add websocket support to the normal cxf services
> (by just using its transport ID
> http://cxf.apache.org/transports/websocket or using ws[s] as the
> protocol name instead of http[s].
> The samples/jax_rs/websocket in cxf uses this approach.
>
> The other approach is to place atmosphere explicitly in front of cxf's
> servlet so that the call gets handled by atmosphere and dispatched to
> cxf.
> One of the swaggersocket's cxf samples uses this approach.
>
> https://github.com/swagger-api/swagger-socket/tree/master/samples/swaggersocket-cxf-echo
>
> It appears to me that you are mixing these two approaches and that won't
> work.
> You should use the second approach in your case and verify which jars
> are referenced/used in your application.
>
> But I suspect your NPE problem probably has another reason and it has
> directly nothing to do with this mixup issue, though.
>
> 2015-07-29 18:37 GMT+02:00 Roberto Francescangeli
> <roberto.francescangeli@gmail.com>:
> > Hi all,
> >
> > I am trying to add websocket support to my existing REST application and
> I
> > would like to do it leveraging the Atmosphere framework API.
> >
> > My application currently runs inside a Jetty 8 standalone container and
> it
> > is deployed as an exploded WAR.
> > The application itself is RESTful and uses CXF 3.0.5 and Spring 3.2.14 to
> > configure all REST endpoints, providers, etc.
> > I also use Guice for dependency injection and GuiceServlet to add some
> > Guice-friendly servlet filters to my environment.
> >
> > In order to add support for websockets I tried several things but in the
> > end I always end up getting the same exception:
> >
> >> java.lang.NullPointerException
> >> at
> >>
> org.eclipse.jetty.websocket.WebSocketFactory.upgrade(WebSocketFactory.java:238)
> >> at
> >>
> org.eclipse.jetty.websocket.WebSocketFactory.acceptWebSocket(WebSocketFactory.java:396)
> >> at
> >>
> org.atmosphere.container.JettyWebSocketUtil.doService(JettyWebSocketUtil.java:62)
> >> at
> >>
> org.atmosphere.container.JettyAsyncSupportWithWebSocket.service(JettyAsyncSupportWithWebSocket.java:66)
> >> at
> >>
> org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:2262)
> >> at
> org.atmosphere.cpr.AtmosphereServlet.doPost(AtmosphereServlet.java:190)
> >> at
> org.atmosphere.cpr.AtmosphereServlet.doGet(AtmosphereServlet.java:176)
> >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)
> >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
> >> at
> org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)
> >> at
> >>
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1496)
> >> at
> >>
> org.eclipse.jetty.servlets.UserAgentFilter.doFilter(UserAgentFilter.java:82)
> >> at org.eclipse.jetty.servlets.GzipFilter.doFilter(GzipFilter.java:294)
> >> at
> >>
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1484)
> >> at
> >>
> com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:66)
> >> at
> >>
> com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118)
> >> at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113)
> >> at
> >>
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1476)
> >> at
> >>
> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:501)
> >> at
> >>
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
> >> at
> >>
> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)
> >> at
> >>
> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
> >> at
> >>
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
> >> at
> >>
> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429)
> >> at
> >>
> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
> >> at
> >>
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
> >> at
> >>
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
> >> at
> >>
> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
> >> at
> >>
> org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
> >> at
> >>
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
> >> at org.eclipse.jetty.server.Server.handle(Server.java:370)
> >> at
> >>
> org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)
> >> at
> >>
> org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:971)
> >> at
> >>
> org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1033)
> >> at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644)
> >> at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
> >> at
> >>
> org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
> >> at
> >>
> org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696)
> >> at
> >>
> org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53)
> >> at
> >>
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
> >> at
> >>
> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
> >> at java.lang.Thread.run(Thread.java:745)
> >
> >
> > These are the things I tried:
> >
> > I added jetty-websocket, cxf-rt-transports-websocket, and
> > atmosphere-annotations to my maven dependencies
> > I added the ChatService to my services and configured it in the same way
> I
> > initialize the others using Spring
> >
> > Chat Service was modified like this because this is how we handle
> services
> > in our current application:
> >
> > @WebService
> >> @Path("/chat")
> >> @Produces("application/json")
> >> @AtmosphereService(broadcaster = DefaultBroadcaster.class)
> >> @ImplementedBy(ChatServiceImpl.class)
> >> public interface ChatService {
> >>     @Suspend
> >>     @GET
> >>     public String connect();
> >>     @Broadcast(writeEntity = false)
> >>     @POST
> >>     public String broadcast(final String message);
> >> }
> >>
> >> public class ChatServiceImpl implements ChatService {
> >>
> >>     @Override
> >>     public String connect() {
> >>         return "";
> >>     }
> >>     @Override
> >>     public String broadcast(final String message) {
> >>         return message;
> >>     }
> >> }
> >
> >
> >
> >
> > I modified my jaxrs.xml file to enable websocket transport in CXF over
> > /websocket/* endpoints
> >
> > <jaxrs:server id="websocketService" address="/websocket"
> >>               transportId="http://cxf.apache.org/transports/websocket">
> >>     <jaxrs:serviceBeans>
> >>         <ref bean="chatServiceImpl" />     <!-- Atmosphere example
-->
> >>         <ref bean="customerServiceImpl" /> <!-- CXF example -->
> >>     </jaxrs:serviceBeans>
> >>     <jaxrs:extensionMappings>
> >>         <entry key="json" value="application/json" />
> >>     </jaxrs:extensionMappings>
> >>     <jaxrs:providers>
> >>         <ref bean="jsonProvider" />
> >>         <ref bean="jsonMappingExceptionMapperProvider" />
> >>         <ref bean="jsonParseExceptionMapperProvider" />
> >>         <ref bean="exceptionMapperProvider" />
> >>     </jaxrs:providers>
> >> </jaxrs:server>
> >
> >
> >
> >
> > I added the client HTML file + all the JS files needed on the root of my
> > exploded WAR directory and I opened the chat page from Chrome.
> >
> > This threw the NPE on
> > org.eclipse.jetty.websocket.WebSocketFactory.upgrade() you see above,
> > because the ThreadLocal AbstractHttpConnection is null.
> >
> > Then I tried to switch my CXFServlet in web.xml with the
> AtmosphereServlet
> > because I read that I need to run CXF over Atmosphere and not viceversa.
> > My web.xml file now looks like:
> >
> > <?xml version="1.0" encoding="ISO-8859-1"?>
> >> <web-app
> >>         xmlns="http://java.sun.com/xml/ns/javaee"
> >>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >>         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> >> http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
> >>         metadata-complete="true"
> >>         version="3.0">
> >>     <display-name>xxxx</display-name>
> >>     <context-param>
> >>         <param-name>contextConfigLocation</param-name>
> >>         <param-value>classpath:/cxf/ws.xml</param-value>
> >>     </context-param>
> >>     <listener>
> >>
>  <listener-class>org.atmosphere.cpr.SessionSupport</listener-class>
> >>     </listener>
> >>     <context-param>
> >>         <param-name>org.atmosphere.cpr.sessionSupport</param-name>
> >>         <param-value>true</param-value>
> >>     </context-param>
> >>     <!--<servlet>-->
> >>         <!--<servlet-name>CXFServlet</servlet-name>-->
> >>
> >>
> <!--<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>-->
> >>         <!--<load-on-startup>1</load-on-startup>-->
> >>     <!--</servlet>-->
> >>     <!--<servlet-mapping>-->
> >>         <!--<servlet-name>CXFServlet</servlet-name>-->
> >>         <!--<url-pattern>/api/*</url-pattern>-->
> >>     <!--</servlet-mapping>-->
> >>     <servlet>
> >>         <servlet-name>AtmosphereServlet</servlet-name>
> >>
>  <servlet-class>org.atmosphere.cpr.AtmosphereServlet</servlet-class>
> >>         <init-param>
> >>
> >> <param-name>org.atmosphere.websocket.messageContentType</param-name>
> >>             <param-value>application/json</param-value>
> >>         </init-param>
> >>         <init-param>
> >>             <param-name>org.atmosphere.cpr.asyncSupport</param-name>
> >>
> >>
> <param-value>org.atmosphere.container.JettyAsyncSupportWithWebSocket</param-value>
> >>         </init-param>
> >>         <load-on-startup>1</load-on-startup>
> >>         <async-supported>true</async-supported>
> >>     </servlet>
> >>     <servlet-mapping>
> >>         <servlet-name>AtmosphereServlet</servlet-name>
> >>         <url-pattern>/api/*</url-pattern>
> >>     </servlet-mapping>
> >>     <!--<filter>-->
> >>         <!--<filter-name>AtmosphereFilter</filter-name>-->
> >>
> >> <!--<filter-class>org.atmosphere.cpr.AtmosphereFilter</filter-class>-->
> >>     <!--</filter>-->
> >>     <!--<filter-mapping>-->
> >>         <!--<filter-name>AtmosphereFilter</filter-name>-->
> >>         <!--<url-pattern>/api/*</url-pattern>-->
> >>     <!--</filter-mapping>-->
> >>     <filter>
> >>         <filter-name>GuiceFilter</filter-name>
> >>
>  <filter-class>com.google.inject.servlet.GuiceFilter</filter-class>
> >>     </filter>
> >>     <filter-mapping>
> >>         <filter-name>GuiceFilter</filter-name>
> >>         <url-pattern>/*</url-pattern>
> >>     </filter-mapping>
> >>     <filter>
> >>         <filter-name>GzipFilter</filter-name>
> >>
>  <filter-class>org.eclipse.jetty.servlets.GzipFilter</filter-class>
> >>         <init-param>
> >>             <param-name>mimeTypes</param-name>
> >>
> >>
> <param-value>text/html,text/plain,text/xml,application/xhtml+xml,text/css,application/javascript,application/json,application/octet-stream,application/x-javascript,image/svg+xml,image/png,image/gif,image/jpeg</param-value>
> >>         </init-param>
> >>     </filter>
> >>     <filter-mapping>
> >>         <filter-name>GzipFilter</filter-name>
> >>         <url-pattern>/*</url-pattern>
> >>     </filter-mapping>
> >>     <!-- Force usage of prjzip mime type for downloads so IE will not
> >> think it's a .zip -->
> >>     <mime-mapping>
> >>         <extension>prjzip</extension>
> >>         <mime-type>application/prjzip</mime-type>
> >>     </mime-mapping>
> >>     <!-- Do not display stack traces on 500 -->
> >>     <error-page>
> >>         <error-code>500</error-code>
> >>         <location>/500.html</location>
> >>     </error-page>
> >>     <!--
> >>          Manage caching on static assets (which are the only assets
> served
> >>          by the Jetty DefaultServlet)
> >>          public: all static assets are non-user-specific and can be
> cached
> >>                  for all users equally
> >>          max-age=0: all static assets must be revalidated with the
> server
> >>                     before they can be served
> >>      -->
> >>     <servlet>
> >>         <servlet-name>default</servlet-name>
> >>
> >> <servlet-class>org.eclipse.jetty.servlet.DefaultServlet</servlet-class>
> >>         <init-param>
> >>           <param-name>cacheControl</param-name>
> >>           <param-value>public, max-age=0</param-value>
> >>         </init-param>
> >>     </servlet>
> >> </web-app>
> >
> >
> >
> >
> > As you can see I also tried to use Atmosphere as a filter but that
> resulted
> > in the same NPE you see above.
> > My original CXFServlet appears commented out in the web.xml file above
> and
> > I replaced that with AtmosphereServlet. Then I created the atmosphere.xml
> > file under META-INF with the following content:
> >
> >> <atmosphere-handlers>
> >>     <!-- CXF -->
> >>     <atmosphere-handler support-session="false"
> >>                         context-root="/*"
> >>
> >> class-name="org.atmosphere.handler.ReflectorServletProcessor">
> >>         <property name="servletClassName"
> >>                   value="org.apache.cxf.transport.servlet.CXFServlet"/>
> >>     </atmosphere-handler>
> >> </atmosphere-handlers>
> >
> >
> > Doing this loads all my services using Spring at the server startup but
> > then all my endpoints just don't work and return a 200 OK empty response
> to
> > all requests..
> > Needless to say, the websocket endpoint is the only one responding to my
> > GET requests but it still throws the same NPE exception as it did the
> first
> > time.
> >
> > I tried also to switch between different asyncSupport classes in the
> > init-param of the Servlet but the result is still the NPE with both
> > *JettyAsyncSupportWithWebSocket* and *JettyAsync30SupportWithWebSocket*.
> > If I use Jetty7Comet then I get a Websocket not supported error and my
> > Chrome client doesn't fall back to long polling due to cross-origin
> > requests not possible for ws URLs...
> >
> > I also tried to disable all servlet filters but I still get the same
> error.
> >
> > Can you please help me understand how can I add a simple service to my
> > existing CXF setup?
> >
> > I also tested succesfully both the Atmosphere's rest-chat example and
> CXF's
> > distribution/src/main/release/samples/jax_rs/websocket example. They are
> > working as expected but I couldn't understand what is missing in my
> > configuration.
> >
> > Thanks a lot in advance!
> >
> > --
> > Roberto Francescangeli
>



-- 
*Roberto Francescangeli*, Ph.D.
Sr SW Engineer @ Schrödinger, New York

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message