Skip to main content

java.lang.ClassCastException when enabling SSL

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
2 replies [Last post]
cyberdeth
Offline
Joined: 2011-02-20

Hey guys.
I hope you can help me. Just for some background information, I have set up a virtual server and I got a certificate from CAcert and installed it successfully on my server. When I navigate to the normal http://xxx, it serves the page correctly, however, when I navigate to https://xxx the browser shows the correct encryption, but glassfish don't serve the page as requested and a blank page is displayed in my browser window. When I load the page, glassfish throws the following error :
[#|2011-02-20T18:45:53.892+1100|SEVERE|glassfish3.0.1|org.apache.catalina.connector.CoyoteAdapter|_ThreadID=61;_ThreadName=Thread-1;|PWC3989: An exception or error occurred in the container during the request processing
java.lang.ClassCastException: com.sun.grizzly.config.ContextRootInfo cannot be cast to org.apache.catalina.Context
at org.apache.catalina.connector.CoyoteAdapter.postParseRequest(CoyoteAdapter.java:504)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:266)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:636)
|#]

[#|2011-02-20T18:45:53.978+1100|SEVERE|glassfish3.0.1|org.apache.catalina.connector.CoyoteAdapter|_ThreadID=60;_ThreadName=Thread-1;|PWC3989: An exception or error occurred in the container during the request processing
java.lang.ClassCastException: com.sun.grizzly.config.ContextRootInfo cannot be cast to org.apache.catalina.Context
at org.apache.catalina.connector.CoyoteAdapter.postParseRequest(CoyoteAdapter.java:504)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:266)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:636)
|#]

I have also tried this with a certificate from godaddy. I do get a green lock in the address bar, but nothing gets rendered and I get the abovementioned error too.
Does anyone know how to fix this ? I have tried looking for an answer on this forum, but have been unable to find a sufficient answer to this.

Thank you very much.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
cyberdeth
Offline
Joined: 2011-02-20

Ok I think I figured out the issue.
I disabled http chunking and xpowered by. So the only option that's selected in the http section of the http-listener, is trace.
Just a heads up guys.

ShalabhRaj
Offline
Joined: 2014-05-21

Can u share the command that you used to disable http chunking ? And what Sonu mean by xpowered ?