users@jersey.java.net

[Jersey] ClassCastException: org.glassfish.grizzly.http.util.MimeHeaders$1 cannot be cast to java.util.Enumeration

From: Farrukh Najmi <farrukh_at_wellfleetsoftware.com>
Date: Sun, 26 Feb 2012 13:17:59 -0500

I have a jersey REST endpoint exposed via an HttpServer created using
com.sun.jersey.api.container.grizzly2.GrizzlyServerFactory from jersey
1.10 (with dependency org.glassfish.grizzly 2.1.2).

The endpoint is packaged within a swing app and serves as a callback
endpoint for a pubusbhubbub subscriber. This endpoint is called by the
pubsubhubbub server to verify a subscribe request. The point of all this
is to keep the swing client synchronized with events that transpire in
my server in an event-driven manner.

All is well when the pubsubhubbub server call the jersey endpoint in my
swing app when the swing app is run as a standalone java app.

However, if I run the swing app via jnlp using java webstart I am
getting the following exception. It seems this likely is due to some
class loader issue and version mistmatch. Can any one guide me as to how
to diagnose this further?

java.lang.ClassCastException:
org.glassfish.grizzly.http.util.MimeHeaders$1 cannot be cast to
java.util.Enumeration
     at
org.glassfish.grizzly.servlet.HttpServletRequestImpl.getHeaderNames(HttpServletRequestImpl.java:822)
     at
com.sun.jersey.spi.container.servlet.WebComponent.getHeaders(WebComponent.java:880)
     at
com.sun.jersey.spi.container.servlet.WebComponent.createRequest(WebComponent.java:450)
     at
com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:380)
     at
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
     at
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:708)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
     at
org.glassfish.grizzly.servlet.ServletHandler$FilterChainImpl.doFilter(ServletHandler.java:985)
     at
org.glassfish.grizzly.servlet.ServletHandler$FilterChainImpl.invokeFilterChain(ServletHandler.java:928)
     at
org.glassfish.grizzly.servlet.ServletHandler.doServletService(ServletHandler.java:382)
     at
org.glassfish.grizzly.servlet.ServletHandler.service(ServletHandler.java:330)
     at
org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:163)
     at
org.glassfish.grizzly.http.server.HttpHandlerChain.service(HttpHandlerChain.java:195)
     at
org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:163)
     at
org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:158)
     at
org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
     at
org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:286)
     at
org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:223)
     at
org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:155)
     at
org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:134)
     at
org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:78)
     at
org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:827)
     at
org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:103)
     at
org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:111)
     at
org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
     at
org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:131)
     at
org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:508)
     at
org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:488)
     at java.lang.Thread.run(Thread.java:619)

-- 
Regards,
Farrukh Najmi
Web: http://www.wellfleetsoftware.com