powered by Jive Software

Help needed - Exception when trying to login

I am trying to login using the sample code present in the website, I get the error described below.

I have smack.jar and xpp.jar in the classpath. I tried adding xerces.jar(2.x) also, but it also did not help.

The jabberd and the client are run on the same machine. I also have the Exodus client running on the same machine.

The jabberd reports an Internal Delivery Error in the error.log.

Can someone help me?

The stack trace of the exception is

at java.net.SocketInputStream.socketRead0(Native Method)

at java.net.SocketInputStream.read(Unknown Source)

at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(Unknown Source)

at sun.nio.cs.StreamDecoder$CharsetSD.implRead(Unknown Source)

at sun.nio.cs.StreamDecoder.read(Unknown Source)

at java.io.InputStreamReader.read(Unknown Source)

at org.xmlpull.mxp1.MXParser.fillBuf(MXParser.java:2958)

at org.xmlpull.mxp1.MXParser.more(MXParser.java:2975)

at org.xmlpull.mxp1.MXParser.parseEpilog(MXParser.java:1568)

at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1416)

at org.xmlpull.mxp1.MXParser.next(MXParser.java:1137)

at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:26

at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:73)

at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:95)

java.net.SocketException: Socket closed

at java.net.SocketOutputStream.socketWrite(Unknown Source)

at java.net.SocketOutputStream.write(Unknown Source)

at sun.nio.cs.StreamEncoder$CharsetSE.writeBytes(Unknown Source)

at sun.nio.cs.StreamEncoder$CharsetSE.implFlushBuffer(Unknown Source)

at sun.nio.cs.StreamEncoder$CharsetSE.implFlush(Unknown Source)

at sun.nio.cs.StreamEncoder.flush(Unknown Source)

at java.io.OutputStreamWriter.flush(Unknown Source)

at org.jivesoftware.smack.PacketWriter.writePackets(PacketWriter.java:15

at org.jivesoftware.smack.PacketWriter.access$000(PacketWriter.java:65)

at org.jivesoftware.smack.PacketWriter$1.run(PacketWriter.java:85)

org.jivesoftware.smack.XMPPException: No response from the server.

at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:230)

at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:196)

at test.SmackTest.main(SmackTest.java:12)

I think you left off the part right before “at java.net.SocketInputStream.socketRead0(Native Method)”, which should be a description of the exception. Can you paste that in?

Regards,

Matt

“java.net.SocketException: socket closed” is the exception that is thrown. This is the only line that I missed out.

I have seen a variant of this as well… Basic code run command line works like a champ… Then I decided to have some fun and attempted to login from a servlet and got the the following exception… NOTE: smack.jar and xpp.jar are in web-inf/lib … BTW code simply was

== CODE ==

connection = new XMPPConnection(jabberServer);

connection.login(jabberUserId, _jabberPassword);

== DEBUG WINDOW SHOWS (top pane) ==

<stream:stream to=“jabber.org” xmlns=“jabber:client” xmlns:stream=“http://etherx.jabber.org/streams”>

== EXCEPTION ==

Connecting to

caused by: org.xmlpull.v1.XmlPullParserException: Ressource not found: /META-INF/services/org.xmlpull.v1.XmlPullParserFactory; nested exception is:

org.xmlpull.v1.XmlPullParserException: Ressource not found: /META-INF/services/org.xmlpull.v1.XmlPullParserFactory

at org.xmlpull.v1.XmlPullParserFactory.newInstance(XmlPullParserFactory.java:272)

at org.jivesoftware.smack.PacketReader.(PacketReader.java:110)

at org.jivesoftware.smack.XMPPConnection.init(XMPPConnection.java:403)

at org.jivesoftware.smack.XMPPConnection.(XMPPConnection.java:152)

at org.jivesoftware.smack.XMPPConnection.(XMPPConnection.java:130)

at org.ignition.blojsom.extension.jabber.BlojsomJabberServlet.init(BlojsomJabberSe rvlet.java:102)

at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:934)

at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:821)

at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:342 0)

at org.apache.catalina.core.StandardContext.start(StandardContext.java:3608)

at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:821)

at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)

at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:579)

at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java :257)

at org.apache.catalina.core.StandardHost.install(StandardHost.java:772)

at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:502)

at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:410)

at org.apache.catalina.startup.HostConfig.start(HostConfig.java:879)xpp

at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:368)

at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.j ava:166)

at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1196)

at org.apache.catalina.core.StandardHost.start(StandardHost.java:738)

at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)

at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)

at org.apache.catalina.core.StandardService.start(StandardService.java:497)

at org.apache.catalina.core.StandardServer.start(StandardServer.java:2189)

at org.apache.catalina.startup.Catalina.start(Catalina.java:512)

at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)

at org.apache.catalina.startup.Catalina.process(Catalina.java:180)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.ja va:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)

java.lang.NullPointerException

at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:227)

at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:73)xpp

at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:95)

Connection failed. No response from server.

org.jivesoftware.smack.XMPPException: Connection failed. No response from server.

at org.jivesoftware.smack.PacketReader.startup(PacketReader.java:182)

at org.jivesoftware.smack.XMPPConnection.init(XMPPConnection.java:414)

at org.jivesoftware.smack.XMPPConnection.(XMPPConnection.java:152)

at org.jivesoftware.smack.XMPPConnection.(XMPPConnection.java:130)

at org.ignition.blojsom.extension.jabber.BlojsomJabberServlet.init(BlojsomJabberSe rvlet.java:102)

at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:934)

at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:821)

at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:342 0)

at org.apache.catalina.core.StandardContext.start(StandardContext.java:3608)

at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:821)

at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)

at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:579)

at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java :257)

at org.apache.catalina.core.StandardHost.install(StandardHost.java:772)

at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:502)

at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:410)

at org.apache.catalina.startup.HostConfig.start(HostConfig.java:879)

at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:368)

at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.j ava:166)

at org.apache.cConnecting to

caused by: org.xmlpull.v1.XmlPullParserException: Ressource not found: /META-INF/services/org.xmlpull.v1.XmlPullParserFactory; nested exception is:

org.xmlpull.v1.XmlPullParserException: Ressource not found: /META-INF/services/org.xmlpull.v1.XmlPullParserFactory

at org.xmlpull.v1.XmlPullParserFactory.newInstance(XmlPullParserFactory.java:272)

at org.jivesoftware.smack.PacketReader.(PacketReader.java:110)

at org.jivesoftware.smack.XMPPConnection.init(XMPPConnection.java:403)

at org.jivesoftware.smack.XMPPConnection.(XMPPConnection.java:152)

at org.jivesoftware.smack.XMPPConnection.(XMPPConnection.java:130)

at org.ignition.blojsom.extension.jabber.BlojsomJabberServlet.init(BlojsomJabberSe rvlet.java:102)

at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:934)

at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:821)

at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:342 0)

at org.apache.catalina.core.StandardContext.start(StandardContext.java:3608)

at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:821)

at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)

at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:579)

at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java :257)

at org.apache.catalina.core.StandardHost.install(StandardHost.java:772)

at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:502)

at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:410)

at org.apache.catalina.startup.HostConfig.start(HostConfig.java:879)xpp

at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:368)

at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.j ava:166)

at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1196)

at org.apache.catalina.core.StandardHost.start(StandardHost.java:738)

at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)

at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)

at org.apache.catalina.core.StandardService.start(StandardService.java:497)

at org.apache.catalina.core.StandardServer.start(StandardServer.java:2189)

at org.apache.catalina.startup.Catalina.start(Catalina.java:512)

at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)

at org.apache.catalina.startup.Catalina.process(Catalina.java:180)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.ja va:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)

java.lang.NullPointerException

at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:227)

at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:73)xpp

at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:95)

Connection failed. No response from server.

org.jivesoftware.smack.XMPPException: Connection failed. No response from server.

at org.jivesoftware.smack.PacketReader.startup(PacketReader.java:182)

at org.jivesoftware.smack.XMPPConnection.init(XMPPConnection.java:414)

at org.jivesoftware.smack.XMPPConnection.(XMPPConnection.java:152)

at org.jivesoftware.smack.XMPPConnection.(XMPPConnection.java:130)

at org.ignition.blojsom.extension.jabber.BlojsomJabberServlet.init(BlojsomJabberSe rvlet.java:102)

at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:934)

at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:821)

at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:342 0)

at org.apache.catalina.core.StandardContext.start(StandardContext.java:3608)

at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:821)

at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)

at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:579)

at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java :257)

at org.apache.catalina.core.StandardHost.install(StandardHost.java:772)

at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:502)

at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:410)

at org.apache.catalina.startup.HostConfig.start(HostConfig.java:879)

at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:368)

at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.j ava:166)

at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1196)

at org.apache.catalina.core.StandardHost.start(StandardHost.java:738)

at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)

at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)

at org.apache.catalina.core.StandardService.start(StandardService.java:497)

at org.apache.catalina.core.StandardServer.start(StandardServer.java:2189)

at org.apache.catalina.startup.Catalina.start(Catalina.java:512)

at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)

at org.apache.catalina.startup.Catalina.process(Catalina.java:180)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.ja va:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)

atalina.core.ContainerBase.start(ContainerBase.java:1196)

at org.apache.catalina.core.StandardHost.start(StandardHost.java:738)

at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)

at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)

at org.apache.catalina.core.StandardService.start(StandardService.java:497)

at org.apache.catalina.core.StandardServer.start(StandardServer.java:2189)

at org.apache.catalina.startup.Catalina.start(Catalina.java:512)

at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)

at org.apache.catalina.startup.Catalina.process(Catalina.java:180)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.ja va:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)

Mark,

What app-server are you using? My guess is there could be an issue with the classloader in the app-server that prevents the xpp xml library from loading one of its resources. I may need to go into the xpp source to hack in a fix.

Regards,

Matt

Umm, duh. I could have looked at your stack trace to see you are using Tomcat. I’'ll file a bug to see if I can get the resource loading issue fixed for beta 2.

Regards,

Matt

Thanks matt…

Alternatively, you can explicitly specify the provider class in the XmlPullParserFactory.newInstance call. The class name for that call can be pulled from a property or environmental variable by Smack rather than hack the XPP code. I’'m not sure if this is cleaner though:

// Hardcode like this or get from prop
final String defaultProviderName = "org.xmlpull.mxp1.MXParserFactory";
XmlPullParserFactory factory;
try {
  factory = XmlPullParserFactory.newInstance();
} catch (Exception e){
  if (factory == null){
    factory = XmlPullParserFactory.newInstance(defaultProviderName,null);
  }
}

Iain,

Thanks for the tip. That’‘s probably the workaround I’'ll just add to Smack too.

-Matt

Amazing support I pasted that in (in anticipation of a later fix) and it worked like a champ

Thanks!