[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [xmlblaster] Java ssl client connection problem!



Thanks for your help. I've solved it, seems the truststore certificate needs to
reside in the same directory as the xmlBlaster.jar!

Regards

Sherif

Quoting Marcel Ruff <mr at marcelruff.info>:

> sy99 at doc.ic.ac.uk wrote:
> > I have followed the instructions, and i can get a successful execution
> using the
> > HelloWorld3 code, but when I try to use my own code I get this error
> (snippet):
> >   
> Probably your command line args with the configuration are not properly 
> passed to Global?
> You can also try to give the parameters directly to the JVM like
>  java -Dbla=blu <your client>
> as done by the SUN SSL tutorials,
> 
> regards
> Marcel
> > Client:
> >
> > [14-Aug-2006 14:12:46 INFO  main
> > JdbcConnectionPool-jdbc:hsqldb:/home/sy99/tmp/clientsy991155561165920]
> > Successfully reconnected to database
> > [14-Aug-2006 14:12:46 INFO  main
> > JdbcConnectionPool-jdbc:hsqldb:/home/sy99/tmp/clientsy991155561165920]
> > Connections to DB 'jdbc:hsqldb:/home/sy99/tmp/clientsy991155561165920'
> > successfully established.
> > [14-Aug-2006 14:12:46 INFO  main ClientEntryFactory]
> successfully
> > initialized
> > [14-Aug-2006 14:12:46 INFO  main JdbcManagerCommonTable] The
> maximum
> > SQL statement length is not defined in JDBC meta data, we set it to 2048
> > [14-Aug-2006 14:12:47 INFO  main
> > JdbcManagerCommonTable-XB_-tablesCheckAndSetup()] adding table 'XB_ENTRIES'
> as
> > the 'entries' table
> > [14-Aug-2006 14:12:47 WARN  main SocketUrl] SSL client socket
> is
> > enabled but no keyStorePassword is specified, see
> >
> http://www.xmlblaster.org/xmlBlaster/doc/requirements/protocol.socket.html#SSL
> > [14-Aug-2006 14:12:47 INFO  main SocketUrl] SSL client socket
> > enabled, trustStore=/home/sy99/diadem/xmlBlasterClient.truststore
> > [14-Aug-2006 14:12:47 WARN  main SocketUrl] SSL client socket
> is
> > enabled but i can't read keyStore=, see
> >
> http://www.xmlblaster.org/xmlBlaster/doc/requirements/protocol.socket.html#SSL
> > [14-Aug-2006 14:12:47 INFO  main SocketConnection] socket_ssl
> SSL
> > client connected to 'socket://192.168.1.10:7609', callback address is
> > 'socket://192.168.1.10:33581' useUdpForOneway=false
> > [14-Aug-2006 14:12:47 INFO  main
> > DispatchConnection-connection:client/sy991155561166158] Connection
> 'socket_ssl'
> > transition UNDEF -> ALIVE: Success, connection:client/sy991155561166158
> connected.
> > [14-Aug-2006 14:12:47 INFO  main
> > DispatchManager-connection:client/sy991155561166158] Switched to
> synchronous
> > message delivery
> > [14-Aug-2006 14:12:48 INFO  main SocketExecutor] Full stream
> > compression enabled with 'zlib:stream'
> > [14-Aug-2006 14:12:48 INFO  main XmlBlasterAccess-client/sy99]
> > Callback settings: type=CACHE onOverflow=deadMessage onFailure=deadMessage
> > maxEntries=1000 type=socket_ssl oneway=false dispatcherActive=true
> > burstMode.collectTime=0
> > [14-Aug-2006 14:12:48 INFO  XmlBlaster.socket_ssl
> > SocketCallbackImpl-sy99] Started callback receiver plugin on
> > 'socket://192.168.1.10:33581'
> > [14-Aug-2006 14:12:48 WARN  XmlBlaster.socket_ssl
> > SocketCallbackImpl-sy99] Closing connection to server, please try debugging
> SSL
> > with 'java -Djavax.net.debug=all ...': javax.net.ssl.SSLException:
> > java.lang.RuntimeException: Unexpected error:
> > java.security.InvalidAlgorithmParameterException: the trustAnchors
> parameter
> > must be non-empty
> > [14-Aug-2006 14:12:48 WARN  main SocketCallbackImpl-sy99] There
> are
> > 1 messages pending without a response, request IDs are sy99:1
> > [14-Aug-2006 14:12:48 WARN  main
> > DispatchConnection-connection:client/sy991155561166158] Connection
> transition
> > ALIVE -> POLLING: socket://192.168.1.10:7609 is unaccessible, we poll for
> it
> > every 5000 msec: errorCode=communication.noConnection message=#exported
> login
> > failed : java.net.SocketException: Socket is closed
> > [14-Aug-2006 14:12:48 INFO  main
> > DispatchManager-connection:client/sy991155561166158] Switched to
> asynchronous
> > message delivery
> > errorCode=user.configuration message=#exported Can't find an xmlBlaster
> server.
> > Try to provide the server host/port as described in
> >
> http://www.xmlblaster.org/xmlBlaster/doc/requirements/client.configuration.html
> > or provide a public session ID to support polling for xmlBlaster without
> an
> > initial connection. See
> >
> 'http://www.xmlBlaster.org/xmlBlaster/doc/requirements/client.failsafe.html'
> for
> > more details.
> > 	at
> >
>
org.xmlBlaster.client.dispatch.ClientDispatchConnectionsHandler.createFakedReturnObjects(ClientDispatchConnectionsHandler.java:138)
> > 	at
> >
>
org.xmlBlaster.util.dispatch.DispatchManager.handleSyncWorkerException(DispatchManager.java:382)
> > 	at
> org.xmlBlaster.util.dispatch.DispatchWorker.run(DispatchWorker.java:83)
> > 	at
> org.xmlBlaster.util.dispatch.DispatchManager.putPre(DispatchManager.java:530)
> > 	at
> >
>
org.xmlBlaster.util.queue.cache.CacheQueueInterceptorPlugin.put(CacheQueueInterceptorPlugin.java:457)
> > 	at
> >
>
org.xmlBlaster.util.queue.cache.CacheQueueInterceptorPlugin.put(CacheQueueInterceptorPlugin.java:437)
> > 	at
> org.xmlBlaster.client.XmlBlasterAccess.queueMessage(XmlBlasterAccess.java:731)
> > 	at
> org.xmlBlaster.client.XmlBlasterAccess.connect(XmlBlasterAccess.java:298)
> >
> > ...
> >
> > [14-Aug-2006 14:12:48 WARN  XmlBlaster.PingTimer SocketUrl]
> SSL
> > client socket is enabled but no keyStorePassword is specified, see
> >
> http://www.xmlblaster.org/xmlBlaster/doc/requirements/protocol.socket.html#SSL
> > [14-Aug-2006 14:12:48 WARN  XmlBlaster.PingTimer SocketUrl]
> SSL
> > client socket is enabled but i can't read keyStore=, see
> >
> http://www.xmlblaster.org/xmlBlaster/doc/requirements/protocol.socket.html#SSL
> > [14-Aug-2006 14:12:48 INFO  XmlBlaster.PingTimer
> SocketConnection]
> > socket_ssl SSL client connected to 'socket://192.168.1.10:7609', your
> configured
> > local parameters are localHostname=192.168.1.10 on localPort=33581
> > useUdpForOneway=false
> > [14-Aug-2006 14:12:48 INFO  XmlBlaster.PingTimer
> SocketExecutor]
> > Full stream compression enabled with 'zlib:stream'
> > [14-Aug-2006 14:12:48 INFO  XmlBlaster.socket_ssl
> > SocketCallbackImpl-dummyLoginName] Started callback receiver plugin on
> > 'socket://192.168.1.10:33581'
> > [14-Aug-2006 14:12:48 WARN  XmlBlaster.socket_ssl
> > SocketCallbackImpl-dummyLoginName] Closing connection to server, please
> try
> > debugging SSL with 'java -Djavax.net.debug=all ...':
> javax.net.ssl.SSLException:
> > java.lang.RuntimeException: Unexpected error:
> > java.security.InvalidAlgorithmParameterException: the trustAnchors
> parameter
> > must be non-empty
> > [14-Aug-2006 14:12:48 WARN  XmlBlaster.socket_ssl
> > SocketCallbackImpl-dummyLoginName] There are 1 messages pending without a
> > response, request IDs are dummyLoginName:2
> >
> > Server:
> >
> > [14-Aug-2006 14:12:48 WARN  XmlBlaster.socket_ssl.SSL
> socket_ssl-HandleClient]
> > Error parsing TCP data from '/192.168.1.10:33581', check if client and
> server
> > have identical compression or SSL settings: javax.net.ssl.SSLException:
> Received
> > fatal alert: internal_error
> > [14-Aug-2006 14:12:48 WARN  XmlBlaster.socket_ssl.SSL
> socket_ssl-HandleClient]
> > Error parsing TCP data from '/192.168.1.10:33581', check if client and
> server
> > have identical compression or SSL settings: javax.net.ssl.SSLException:
> Received
> > fatal alert: internal_error
> >
> >
> >
> > Quoting Marcel Ruff <mr at marcelruff.info>:
> >
> >   
> >> Hi Sherif,
> >>
> >> did you setup the SSL context as described in
> >>
> >>
> http://www.xmlblaster.org/xmlBlaster/doc/requirements/protocol.socket.html#SSL1
> >> and later
> >>
> http://www.xmlblaster.org/xmlBlaster/doc/requirements/protocol.socket.html#SSL
> >>
> >> This works here out of the box (for the first try make sure to have a 
> >> untouched xmlBlaster.properties and
> >> xmlBlasterPlugins.xml around),
> >>
> >> regards
> >> Marcel
> >>
> >> sy99 at doc.ic.ac.uk wrote:
> >>     
> >>> Hi,
> >>>
> >>> I have been using xmlBlaster for a short while now, but only recently
> >>>       
> >> needed to
> >>     
> >>> add security to our application, and hence the use of ssl! I am having
> >>>       
> >> problems
> >>     
> >>> with connecting a client to an ssl server running on port 7609. 
> >>>
> >>> I believe the problem is I am trying to connect to the server using
> plain
> >>>       
> >> text,
> >>     
> >>> but I am not sure how to overcome this.
> >>>
> >>> I have included my errors and a code snippet of how I connect to the
> >>>       
> >> server
> >>     
> >>> below as well.
> >>>
> >>> Hope somebody can help.
> >>>
> >>> Thanks
> >>>
> >>> Regards
> >>>
> >>> Sherif
> >>>
> >>> Here are the details:
> >>>
> >>> The error I get on the server side:
> >>>
> >>> [14-Aug-2006 09:45:06 INFO  XmlBlaster.SocketDriver
> >>>
> >>>       
> >>
> org.xmlBlaster.util.protocol.RequestReplyExecutor:socket://192.168.1.10:7609]
> >>     
> >>> Full stream compression enabled with 'zlib:stream'
> >>> [14-Aug-2006 09:45:06 WARN  XmlBlaster.socket_ssl.SSL
> >>>       
> >> socket_ssl-HandleClient]
> >>     
> >>> Error parsing TCP data from '/192.168.1.10:33187', check if client and
> >>>       
> >> server
> >>     
> >>> have identical compression or SSL settings: javax.net.ssl.SSLException:
> >>> Unrecognized SSL message, plaintext connection?
> >>> [14-Aug-2006 09:45:06 INFO  XmlBlaster.SocketDriver
> >>>
> >>>       
> >>
> org.xmlBlaster.util.protocol.RequestReplyExecutor:socket://192.168.1.10:7609]
> >>     
> >>> Full stream compression enabled with 'zlib:stream'
> >>> [14-Aug-2006 09:45:06 WARN  XmlBlaster.socket_ssl.SSL
> >>>       
> >> socket_ssl-HandleClient]
> >>     
> >>> Error parsing TCP data from '/192.168.1.10:33187', check if client and
> >>>       
> >> server
> >>     
> >>> have identical compression or SSL settings: javax.net.ssl.SSLException:
> >>> Unrecognized SSL message, plaintext connection?
> >>>
> >>>
> >>> The error I get on the client side:
> >>>
> >>> Shell: trying port 13570
> >>> Shell: trying port 13571
> >>> Property: Loading xmlBlaster.properties from CLASSPATH
> >>>
> >>>       
> >>
> file:/home/sy99/diadem/src/firewall/lib/xmlBlaster.jar!/xmlBlaster.properties
> >>     
> >>> Property: No args array given.
> >>> Property: Added 3 property pairs
> >>> [14-Aug-2006 09:45:04 INFO  main XmlBlasterAccess] Loaded
> >>>       
> >> security
> >>     
> >>> plugin=htpasswd version=1.0
> >>> [14-Aug-2006 09:45:04 INFO  main JmxWrapper] JMX over RMI is
> >>> switched off, for details see
> >>>
> >>>       
> >>
> http://www.xmlBlaster.org/xmlBlaster/doc/requirements/admin.jmx.html#jconsole
> >>     
> >>> [14-Aug-2006 09:45:05 INFO  main
> >>> JdbcConnectionPool-jdbc:hsqldb:/home/sy99/tmp/clientsy991155545104800]
> >>> Successfully reconnected to database
> >>> [14-Aug-2006 09:45:05 INFO  main
> >>> JdbcConnectionPool-jdbc:hsqldb:/home/sy99/tmp/clientsy991155545104800]
> >>> Connections to DB 'jdbc:hsqldb:/home/sy99/tmp/clientsy991155545104800'
> >>> successfully established.
> >>> [14-Aug-2006 09:45:05 INFO  main ClientEntryFactory]
> >>>       
> >> successfully
> >>     
> >>> initialized
> >>> [14-Aug-2006 09:45:05 INFO  main JdbcManagerCommonTable] The
> >>>       
> >> maximum
> >>     
> >>> SQL statement length is not defined in JDBC meta data, we set it to 2048
> >>> [14-Aug-2006 09:45:05 INFO  main
> >>> JdbcManagerCommonTable-XB_-tablesCheckAndSetup()] adding table
> 'XB_ENTRIES'
> >>>       
> >> as
> >>     
> >>> the 'entries' table
> >>> [14-Aug-2006 09:45:06 INFO  main SocketConnection] SOCKET
> >>>       
> >> client
> >>     
> >>> connected to 'socket://192.168.1.10:7609', callback address is
> >>> 'socket://192.168.1.10:33187' useUdpForOneway=false
> >>> [14-Aug-2006 09:45:06 INFO  main
> >>> DispatchConnection-connection:client/sy991155545105057] Connection
> >>>       
> >> 'SOCKET'
> >>     
> >>> transition UNDEF -> ALIVE: Success, connection:client/sy991155545105057
> >>>       
> >> connected.
> >>     
> >>> [14-Aug-2006 09:45:06 INFO  main
> >>> DispatchManager-connection:client/sy991155545105057] Switched to
> >>>       
> >> synchronous
> >>     
> >>> message delivery
> >>> [14-Aug-2006 09:45:06 INFO  main
> XmlBlasterAccess-client/sy99]
> >>> Callback settings: type=CACHE onOverflow=deadMessage
> onFailure=deadMessage
> >>> maxEntries=1000 type=SOCKET oneway=false dispatcherActive=true
> >>> burstMode.collectTime=0
> >>> [14-Aug-2006 09:45:06 INFO  XmlBlaster.SOCKET
> >>> SocketCallbackImpl-sy99] Started callback receiver plugin on
> >>> 'socket://192.168.1.10:33187'
> >>> [14-Aug-2006 09:45:06 WARN  XmlBlaster.SOCKET
> >>> SocketCallbackImpl-sy99] Closing connection to server:
> >>>       
> >> java.net.SocketException:
> >>     
> >>> Connection reset
> >>> [14-Aug-2006 09:45:06 WARN  XmlBlaster.SOCKET
> >>> SocketCallbackImpl-sy99] There are 1 messages pending without a
> response,
> >>> request IDs are sy99:1
> >>> [14-Aug-2006 09:45:06 WARN  main
> >>> DispatchConnection-connection:client/sy991155545105057] Connection
> >>>       
> >> transition
> >>     
> >>> ALIVE -> POLLING: socket://192.168.1.10:7609 is unaccessible, we poll
> for
> >>>       
> >> it
> >>     
> >>> every 5000 msec: errorCode=communication.noConnection message=#exported
> >>>       
> >> login
> >>     
> >>> failed : java.io.IOException: SocketExecutor: Lost socket connection for
> >>> connect(requestId=sy99:1)
> >>> [14-Aug-2006 09:45:06 INFO  main
> >>> DispatchManager-connection:client/sy991155545105057] Switched to
> >>>       
> >> asynchronous
> >>     
> >>> message delivery
> >>> errorCode=user.configuration message=#exported Can't find an xmlBlaster
> >>>       
> >> server.
> >>     
> >>> Try to provide the server host/port as described in
> >>>
> >>>       
> >>
> http://www.xmlblaster.org/xmlBlaster/doc/requirements/client.configuration.html
> >>     
> >>> or provide a public session ID to support polling for xmlBlaster without
> >>>       
> >> an
> >>     
> >>> initial connection. See
> >>>
> >>>       
> >>
> 'http://www.xmlBlaster.org/xmlBlaster/doc/requirements/client.failsafe.html'
> >> for
> >>     
> >>> more details.
> >>> 	at
> >>>
> >>>       
> >
>
org.xmlBlaster.client.dispatch.ClientDispatchConnectionsHandler.createFakedReturnObjects(ClientDispatchConnectionsHandler.java:138)
> >   
> >>> 	at
> >>>
> >>>       
> >
>
org.xmlBlaster.util.dispatch.DispatchManager.handleSyncWorkerException(DispatchManager.java:382)
> >   
> >>> 	at
> >>>       
> >> org.xmlBlaster.util.dispatch.DispatchWorker.run(DispatchWorker.java:83)
> >>     
> >>> 	at
> >>>       
> >>
> org.xmlBlaster.util.dispatch.DispatchManager.putPre(DispatchManager.java:530)
> >>     
> >>> 	at
> >>>
> >>>       
> >
>
org.xmlBlaster.util.queue.cache.CacheQueueInterceptorPlugin.put(CacheQueueInterceptorPlugin.java:457)
> >   
> >>> 	at
> >>>
> >>>       
> >
>
org.xmlBlaster.util.queue.cache.CacheQueueInterceptorPlugin.put(CacheQueueInterceptorPlugin.java:437)
> >   
> >>> 	at
> >>>       
> >>
> org.xmlBlaster.client.XmlBlasterAccess.queueMessage(XmlBlasterAccess.java:731)
> >>     
> >>> 	at
> >>>       
> >> org.xmlBlaster.client.XmlBlasterAccess.connect(XmlBlasterAccess.java:298)
> >>     
> >>> 	at org.trustcom.external.XMLBlaster.connect(XMLBlaster.java:271)
> >>> 	at org.trustcom.external.XMLBlaster.execute(XMLBlaster.java:218)
> >>> 	at org.trustcom.ManagedObject.execute(ManagedObject.java:259)
> >>> 	at org.trustcom.OID.execute(OID.java:180)
> >>> 	at org.trustcom.Util.useObject(Util.java:530)
> >>> 	at org.trustcom.Util.parse(Util.java:354)
> >>> 	at org.trustcom.Util.parse(Util.java:390)
> >>> 	at org.trustcom.Util.parse(Util.java:328)
> >>> 	at org.trustcom.Util.eval(Util.java:544)
> >>> 	at org.trustcom.Util.parse(Util.java:363)
> >>> 	at org.trustcom.Util.parse(Util.java:328)
> >>> 	at org.trustcom.Util.parse(Util.java:340)
> >>> 	at org.trustcom.SelfManagedCell.main(SelfManagedCell.java:193)
> >>> Diadem Firewall System Manager is active!
> >>> Policy: active is true
> >>> Shell port 13571 ready
> >>> [14-Aug-2006 09:45:06 INFO  XmlBlaster.PingTimer
> >>>       
> >> SocketConnection]
> >>     
> >>> SOCKET client connected to 'socket://192.168.1.10:7609', your configured
> >>>       
> >> local
> >>     
> >>> parameters are localHostname=192.168.1.10 on localPort=33187
> >>>       
> >> useUdpForOneway=false
> >>     
> >>> [14-Aug-2006 09:45:06 INFO  XmlBlaster.SOCKET
> >>> SocketCallbackImpl-dummyLoginName] Started callback receiver plugin on
> >>> 'socket://192.168.1.10:33187'
> >>> [14-Aug-2006 09:45:06 WARN  XmlBlaster.SOCKET
> >>> SocketCallbackImpl-dummyLoginName] Closing connection to server:
> >>> java.net.SocketException: Connection reset
> >>> [14-Aug-2006 09:45:06 WARN  XmlBlaster.SOCKET
> >>> SocketCallbackImpl-dummyLoginName] There are 1 messages pending without
> a
> >>> response, request IDs are dummyLoginName:2
> >>>
> >>> Here's is how I connect to the server:
> >>>
> >>>   private void connect(String[] args, String uname, String passwd) {
> >>>     try {
> >>>       glob = new Global();
> >>>       glob.init(args);
> >>>       connection = glob.getXmlBlasterAccess();
> >>>       ConnectQos qos;
> >>>       if (uname == null)
> >>>         qos = new ConnectQos(glob);
> >>>       else
> >>>         qos = new ConnectQos(glob, uname, passwd);
> >>>       
> >>>       // Ok, make the connection
> >>>       connection.connect(qos, new I_Callback() {
> >>>
> >>>         public String update(String name, UpdateKey updateKey, byte[]
> >>>       
> >> content,
> >>     
> >>> UpdateQos updateQos) {
> >>>           System.out.println("XMLBlaster: Receiving undirected
> message");
> >>>           return "";
> >>>         }
> >>>       });
> >>>
> >>>       // Handle lost server explicitly
> >>>       connection.registerConnectionListener(new
> I_ConnectionStateListener()
> >>>       
> >> {
> >>     
> >>>         public void reachedAlive(ConnectionStateEnum oldState,
> >>> I_XmlBlasterAccess connection) {
> >>>           /*
> >>>            * ConnectReturnQos conRetQos =
> >>>       
> >> connection.getConnectReturnQos();
> >>     
> >>>            * log.info(ME, "I_ConnectionStateListener: We were lucky,
> >>>       
> >> connected
> >>     
> >>>            * to " + connection.getGlobal().getId() + " as " +
> >>>            * conRetQos.getSessionName());
> >>>            */
> >>>           System.out.println("XMLBlaster: Destroying " +
> >>> connection.getQueue().getNumOfEntries()
> >>>               + " client side tailback messages");
> >>>           connection.getQueue().clear();
> >>>         }
> >>>
> >>>         public void reachedPolling(ConnectionStateEnum oldState,
> >>> I_XmlBlasterAccess connection) {
> >>>           System.out
> >>>               .println("XMLBlaster: I_ConnectionStateListener: No
> >>>       
> >> connection to
> >>     
> >>> xmlBlaster server, we are polling ...");
> >>>         }
> >>>
> >>>         public void reachedDead(ConnectionStateEnum oldState,
> >>>       
> >> I_XmlBlasterAccess
> >>     
> >>> connection) {
> >>>           System.out.println("XMLBlaster: I_ConnectionStateListener:
> >>>       
> >> Connection
> >>     
> >>> from "
> >>>               + connection.getGlobal().getId() + " to xmlBlaster is
> DEAD,
> >>>       
> >> doing
> >>     
> >>> exit.");
> >>>           System.exit(1);
> >>>         }
> >>>       });
> >>>
> >>>     }
> >>>     catch (XmlBlasterException e) {
> >>>       // TODO Auto-generated catch block
> >>>       e.printStackTrace();
> >>>     }
> >>>   }
> >>>
> >>>   
> >>>       
> >>     
> >
> >
> >
> >   
> 
>