Hi Rajika,

there's actually two issues which need fixing to get SSL support in the
broker (by coincidence I happened to be looking at this over the weekend) -
and by the looks of the problem you are reporting you've only fixed one of
them...

try the attached patch for the trunk broker and see if this resolves your
SSL issues

Cheers,
Rob

On 29 March 2011 12:15, Rajika Kumarasiri <[email protected]> wrote:

> I came across the following NPE, when trying to use the broker against a
> client(Publisher.java). The Qpid server is configured for SSL and client
> connect using the url:
>
> "amqp://guest:guest@test/?brokerlist='tcp://localhost:8672?ssl='true''"
>
> 2011-03-29 15:34:43,478 ERROR [pool-3-thread-1]
> (AMQProtocolEngine.java:258)
> - Unexpected exception when processing datablock
> java.lang.NullPointerException
>    at
>
> org.apache.qpid.server.output.ProtocolOutputConverterRegistry.getConverter(ProtocolOutputConverterRegistry.java:59)
>    at
>
> org.apache.qpid.server.protocol.AMQProtocolEngine.setProtocolVersion(AMQProtocolEngine.java:889)
>    at
>
> org.apache.qpid.server.protocol.AMQProtocolEngine.protocolInitiationReceived(AMQProtocolEngine.java:360)
>    at
>
> org.apache.qpid.server.protocol.AMQProtocolEngine.dataBlockReceived(AMQProtocolEngine.java:277)
>    at
>
> org.apache.qpid.server.protocol.AMQProtocolEngine$1.run(AMQProtocolEngine.java:254)
>    at org.apache.qpid.pool.Job.processAll(Job.java:110)
>    at org.apache.qpid.pool.Job.run(Job.java:149)
>    at
>
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>    at
>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>    at java.lang.Thread.run(Thread.java:619)
>
>
> The reason is session.getProtocolVersion() returns 0-10 in
> ProtocolOutputConverterRegistry#getConverter and the lookup returns null.
> Because we only register versions 0.8, 0.9 and 0.91 in the static block in
> the same class. Is there any reason to left out version 0-10? Also I don't
> see any protocol conversion source in the package
> org.apache.qpid.server.output. Is this on purpose or still under
> development
> ?
>
> BTW, I fixed an issue related to broker's SSL support and will attach that
> patch soon.
>
>
> Rajika
>
Index: broker/src/main/java/org/apache/qpid/server/Main.java
===================================================================
--- broker/src/main/java/org/apache/qpid/server/Main.java	(revision 1085593)
+++ broker/src/main/java/org/apache/qpid/server/Main.java	(working copy)
@@ -428,8 +428,33 @@
             {
                 sslFactory = new SSLContextFactory(keystorePath, keystorePassword, certType);
                 NetworkDriver driver = new MINANetworkDriver();
-                driver.bind(serverConfig.getSSLPort(), new InetAddress[]{bindAddress},
-                            new AMQProtocolEngineFactory(), serverConfig.getNetworkConfiguration(), sslFactory);
+                int port=serverConfig.getSSLPort();
+
+                Set<VERSION> supported = EnumSet.allOf(VERSION.class);
+
+                if(exclude_0_10.contains(port))
+                {
+                    supported.remove(VERSION.v0_10);
+                }
+
+                if(exclude_0_9_1.contains(port))
+                {
+                    supported.remove(VERSION.v0_9_1);
+                }
+                if(exclude_0_9.contains(port))
+                {
+                    supported.remove(VERSION.v0_9);
+                }
+                if(exclude_0_8.contains(port))
+                {
+                    supported.remove(VERSION.v0_8);
+                }
+
+                MultiVersionProtocolEngineFactory protocolEngineFactory =
+                                        new MultiVersionProtocolEngineFactory(hostName, supported);
+                driver.bind(port, new InetAddress[]{bindAddress}, protocolEngineFactory,
+                                                serverConfig.getNetworkConfiguration(), sslFactory);
+
                 ApplicationRegistry.getInstance().addAcceptor(new InetSocketAddress(bindAddress, serverConfig.getSSLPort()),
                         new QpidAcceptor(driver,"TCP"));
                 CurrentActor.get().message(BrokerMessages.LISTENING("TCP/SSL", serverConfig.getSSLPort()));
Index: common/src/main/java/org/apache/qpid/transport/network/mina/MINANetworkDriver.java
===================================================================
--- common/src/main/java/org/apache/qpid/transport/network/mina/MINANetworkDriver.java	(revision 1085593)
+++ common/src/main/java/org/apache/qpid/transport/network/mina/MINANetworkDriver.java	(working copy)
@@ -363,7 +363,10 @@
         {
             if (_sslFactory != null)
             {
-                protocolSession.getFilterChain().addBefore("protocolFilter", "sslFilter",
+//                protocolSession.getFilterChain().addBefore("protocolFilter", "sslFilter",
+//                        new SSLFilter(_sslFactory.buildServerContext()));
+
+                protocolSession.getFilterChain().addFirst("sslFilter",
                         new SSLFilter(_sslFactory.buildServerContext()));
             }
         }
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to