powered by Jive Software

The smack 1.1.1 library is throwing exceptions when it cannot make a connec

The smack 1.1.1 library is throwing exceptions when it cannot make a connection to the server. It throws errors in the following…

IMconnection = new SSLXMPPConnection( kJabberServerName );

I check my connection after to decide to continue communicating with Jabber but in this case the errors are thrown inside smack itself so it is not gracefully degrading when it cannot make a connection.

Here are the error messages


09:01:11,421 INFO INFO: Jabber: Connecting to Jabber Server…

09:01:12,890 ERROR org.jivesoftware.smack.XMPPException: XMPPError connecting to rosswoolf.com:5223.

09:01:12,906 ERROR at org.jivesoftware.smack.SSLXMPPConnection.(SSLXMPPConnection.java:92)

09:01:12,906 ERROR at org.jivesoftware.smack.SSLXMPPConnection.(SSLXMPPConnection.java:78)

09:01:12,921 ERROR at teamsync.ejb.stateless.Jabber.ConnToJabberServer(Jabber.java)

09:01:12,921 ERROR at teamsync.ejb.stateless.Jabber.sendIM(Jabber.java)

09:01:12,921 ERROR at teamsync.ejb.stateless.IMComposer.sendNewsIM(IMComposer.java)

09:01:12,937 ERROR at teamsync.ejb.stateless.notify.sendDiscNotifications(notify.java)

09:01:12,937 ERROR at teamsync.ejb.stateless.ArtifactManagerEJBean.createNewDiscussion(ArtifactManage rEJBean.java)

09:01:12,937 ERROR at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

09:01:12,953 ERROR at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

09:01:12,953 ERROR at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.ja va:25)

09:01:12,953 ERROR at java.lang.reflect.Method.invoke(Method.java:324)

09:01:12,968 ERROR at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSe ssionContainer.java:660)

09:01:12,968 ERROR at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedC onnectionInterceptor.java:186)

09:01:12,968 ERROR at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessi onInstanceInterceptor.java:77)

09:01:12,984 ERROR at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.ja va:107)

09:01:12,984 ERROR at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.jav a:178)

09:01:12,984 ERROR at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:60)

09:01:13,000 ERROR at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:130)

09:01:13,000 ERROR at org.jboss.ejb.plugins.CleanShutdownInterceptor.invoke(CleanShutdownInterceptor. java:164)

09:01:13,000 ERROR at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:204)

09:01:13,015 ERROR at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:3 13)

09:01:13,015 ERROR at org.jboss.ejb.Container.invoke(Container.java:712)

09:01:13,015 ERROR at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)

09:01:13,031 ERROR at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:98)

09:01:13,031 ERROR at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:102)

09:01:13,031 ERROR at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:77)

09:01:13,031 ERROR at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:80)

09:01:13,046 ERROR at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionIntercep tor.java:111)

09:01:13,046 ERROR at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)

09:01:13,046 ERROR at $Proxy428.createNewDiscussion(Unknown Source)

09:01:13,062 ERROR at teamsync.ejb.stateless.DiscussionNewJspHelper.createNew(DiscussionNewJspHelper. java)

09:01:13,062 ERROR at org.apache.jsp.discussion_new_jsp._jspService(discussion_new_jsp.java:968)

09:01:13,062 ERROR at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136)

09:01:13,078 ERROR at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

09:01:13,078 ERROR at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:204)

09:01:13,078 ERROR at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)

09:01:13,093 ERROR at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)

09:01:13,093 ERROR at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

09:01:13,093 ERROR at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFil terChain.java:247)

09:01:13,109 ERROR at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain .java:193)

09:01:13,109 ERROR at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java: 260)

09:01:13,109 ERROR at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNe xt(StandardPipeline.java:643)

09:01:13,125 ERROR at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)

09:01:13,125 ERROR at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

09:01:13,125 ERROR at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java: 191)

09:01:13,140 ERROR at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNe xt(StandardPipeline.java:643)

09:01:13,140 ERROR at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.ja va:471)

09:01:13,156 ERROR at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNe xt(StandardPipeline.java:641)

09:01:13,156 ERROR at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)

09:01:13,156 ERROR at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNe xt(StandardPipeline.java:641)

09:01:13,171 ERROR at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)

09:01:13,171 ERROR at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

09:01:13,171 ERROR at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2396)

09:01:13,187 ERROR at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)

09:01:13,187 ERROR at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNe xt(StandardPipeline.java:643)

09:01:13,187 ERROR at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.jav a:170)

09:01:13,203 ERROR at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNe xt(StandardPipeline.java:641)

09:01:13,203 ERROR at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)

09:01:13,203 ERROR at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNe xt(StandardPipeline.java:641)

09:01:13,218 ERROR at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:469)

09:01:13,218 ERROR at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNe xt(StandardPipeline.java:641)

09:01:13,218 ERROR at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)

09:01:13,234 ERROR at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

09:01:13,234 ERROR at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:17 4)

09:01:13,234 ERROR at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNe xt(StandardPipeline.java:643)

09:01:13,250 ERROR at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)

09:01:13,250 ERROR at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

09:01:13,265 ERROR at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:104 0)

09:01:13,296 ERROR at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1151)

09:01:13,312 ERROR at java.lang.Thread.run(Thread.java:536)

09:01:13,343 ERROR Nested Exception:

09:01:13,375 ERROR java.net.ConnectException: Connection refused: connect

09:01:13,390 ERROR at java.net.PlainSocketImpl.socketConnect(Native Method)

09:01:13,390 ERROR at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)

09:01:13,390 ERROR at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)

09:01:13,406 ERROR at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)

09:01:13,406 ERROR at java.net.Socket.connect(Socket.java:426)

09:01:13,406 ERROR at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(DashoA6275)

09:01:13,406 ERROR at com.sun.net.ssl.internal.ssl.SSLSocketImpl.(DashoA6275)

09:01:13,406 ERROR at com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl.createSocket(DashoA6275)

09:01:13,406 ERROR at org.jivesoftware.smack.SSLXMPPConnection$DummySSLSocketFactory.createSocket(SSL XMPPConnection.java:147)

09:01:13,406 ERROR at org.jivesoftware.smack.SSLXMPPConnection.(SSLXMPPConnection.java:86)

09:01:13,406 ERROR at org.jivesoftware.smack.SSLXMPPConnection.(SSLXMPPConnection.java:78)

09:01:13,406 ERROR at teamsync.ejb.stateless.Jabber.ConnToJabberServer(Jabber.java)

09:01:13,406 ERROR at teamsync.ejb.stateless.Jabber.sendIM(Jabber.java)

09:01:13,421 ERROR at teamsync.ejb.stateless.IMComposer.sendNewsIM(IMComposer.java)

09:01:13,421 ERROR at teamsync.ejb.stateless.notify.sendDiscNotifications(notify.java)

09:01:13,421 ERROR at teamsync.ejb.stateless.ArtifactManagerEJBean.createNewDiscussion(ArtifactManage rEJBean.java)

09:01:13,421 ERROR at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

09:01:13,421 ERROR at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

09:01:13,421 ERROR at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.ja va:25)

09:01:13,421 ERROR at java.lang.reflect.Method.invoke(Method.java:324)

09:01:13,421 ERROR at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSe ssionContainer.java:660)

09:01:13,421 ERROR at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedC onnectionInterceptor.java:186)

09:01:13,421 ERROR at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessi onInstanceInterceptor.java:77)

09:01:13,437 ERROR at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.ja va:107)

09:01:13,437 ERROR at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.jav a:178)

09:01:13,437 ERROR at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:60)

09:01:13,437 ERROR at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:130)

09:01:13,437 ERROR at org.jboss.ejb.plugins.CleanShutdownInterceptor.invoke(CleanShutdownInterceptor. java:164)

09:01:13,437 ERROR at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:204)

09:01:13,437 ERROR at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:3 13)

09:01:13,437 ERROR at org.jboss.ejb.Container.invoke(Container.java:712)

09:01:13,437 ERROR at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)

09:01:13,437 ERROR at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:98)

09:01:13,453 ERROR at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:102)

09:01:13,453 ERROR at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:77)

09:01:13,453 ERROR at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:80)

09:01:13,453 ERROR at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionIntercep tor.java:111)

09:01:13,453 ERROR at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)

09:01:13,453 ERROR at $Proxy428.createNewDiscussion(Unknown Source)

09:01:13,453 ERROR at teamsync.ejb.stateless.DiscussionNewJspHelper.createNew(DiscussionNewJspHelper. java)

09:01:13,453 ERROR at org.apache.jsp.discussion_new_jsp._jspService(discussion_new_jsp.java:968)

09:01:13,453 ERROR at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136)

09:01:13,453 ERROR at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

09:01:13,468 ERROR at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:204)

09:01:13,468 ERROR at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)

09:01:13,468 ERROR at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)

09:01:13,468 ERROR at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

09:01:13,468 ERROR at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFil terChain.java:247)

09:01:13,468 ERROR at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain .java:193)

09:01:13,468 ERROR at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java: 260)

09:01:13,468 ERROR at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNe xt(StandardPipeline.java:643)

09:01:13,468 ERROR at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)

09:01:13,484 ERROR at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

09:01:13,484 ERROR at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java: 191)

09:01:13,484 ERROR at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNe xt(StandardPipeline.java:643)

09:01:13,484 ERROR at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.ja va:471)

09:01:13,484 ERROR at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNe xt(StandardPipeline.java:641)

09:01:13,484 ERROR at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)

09:01:13,484 ERROR at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNe xt(StandardPipeline.java:641)

09:01:13,500 ERROR at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)

09:01:13,500 ERROR at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

09:01:13,500 ERROR at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2396)

09:01:13,500 ERROR at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)

09:01:13,500 ERROR at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNe xt(StandardPipeline.java:643)

09:01:13,500 ERROR at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.jav a:170)

09:01:13,500 ERROR at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNe xt(StandardPipeline.java:641)

09:01:13,500 ERROR at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)

09:01:13,500 ERROR at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNe xt(StandardPipeline.java:641)

09:01:13,515 ERROR at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:469)

09:01:13,515 ERROR at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNe xt(StandardPipeline.java:641)

09:01:13,515 ERROR at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)

09:01:13,515 ERROR at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

09:01:13,515 ERROR at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:17 4)

09:01:13,515 ERROR at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNe xt(StandardPipeline.java:643)

09:01:13,515 ERROR at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)

09:01:13,515 ERROR at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

09:01:13,515 ERROR at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:104 0)

09:01:13,515 ERROR at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1151)

09:01:13,515 ERROR at java.lang.Thread.run(Thread.java:536)

Hi,

The connection throws an exception because[/I] it’‘s creation failed. This is the intended behavior. You should surround the call with a try-catch in order to catch the exception and do any appropriate error handling. Within the try-catch, you code assuming the connection is valid (you never have to check a XMPP Connection, if you successfully created it, it’'s valid).

-iain

nice stack traces…it’'s probably longer that the application!