LDAP vCard Avatar v1.0.4

I have created an issue for the exception you are seeing:

http://www.igniterealtime.org/issues/browse/JM-1083

Though I dont know that it in and of itself could cause Openfire to crash. Was there anything else in your log files?

Thanks,

Alex

I can send you all logs by e-mail.

Today I have discovered same issue with different user.

at java.net.PlainSocketImpl.socketConnect(Native Method)

at java.net.PlainSocketImpl.doConnect(Unknown Source)

at java.net.PlainSocketImpl.connectToAddress(Unknown Source)

at java.net.PlainSocketImpl.connect(Unknown Source)

at java.net.SocksSocketImpl.connect(Unknown Source)

at java.net.Socket.connect(Unknown Source)

at org.jivesoftware.openfire.session.OutgoingServerSession.createOutgoingSession(O utgoingServerSession.java:253)

at org.jivesoftware.openfire.session.OutgoingServerSession.authenticateDomain(Outg oingServerSession.java:142)

at org.jivesoftware.openfire.server.OutgoingSessionPromise$PacketsProcessor.sendPa cket(OutgoingSessionPromise.java:199)

at org.jivesoftware.openfire.server.OutgoingSessionPromise$PacketsProcessor.run(Ou tgoingSessionPromise.java:184)

at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

2007.06.08 16:27:29 [org.jivesoftware.openfire.spi.PresenceManagerImpl.userUnavailable(PresenceMana gerImpl.java:264)

] Error storing offline presence of user: mochalova

java.sql.SQLException: Violation of PRIMARY KEY constraint ‘‘jivePresence_pk’’. Cannot insert duplicate key in object ‘‘jivePresence’’.

at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:365)

at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2781)

at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2224)

at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:628)

at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:525)

at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:487)

at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.execute(JtdsPreparedStatement.j ava:475)

at org.jivesoftware.openfire.spi.PresenceManagerImpl.userUnavailable(PresenceManag erImpl.java:261)

at org.jivesoftware.openfire.handler.PresenceUpdateHandler.process(PresenceUpdateH andler.java:121)

at org.jivesoftware.openfire.handler.PresenceUpdateHandler.process(PresenceUpdateH andler.java:88)

at org.jivesoftware.openfire.handler.PresenceUpdateHandler.process(PresenceUpdateH andler.java:151)

at org.jivesoftware.openfire.PresenceRouter.handle(PresenceRouter.java:123)

at org.jivesoftware.openfire.PresenceRouter.route(PresenceRouter.java:69)

at org.jivesoftware.openfire.spi.PacketRouterImpl.route(PacketRouterImpl.java:75)

at org.jivesoftware.openfire.net.StanzaHandler.processPresence(StanzaHandler.java: 306)

at org.jivesoftware.openfire.net.ClientStanzaHandler.processPresence(ClientStanzaH andler.java:85)

at org.jivesoftware.openfire.net.StanzaHandler.process(StanzaHandler.java:231)

at org.jivesoftware.openfire.net.StanzaHandler.process(StanzaHandler.java:153)

at org.jivesoftware.openfire.nio.ConnectionHandler.messageReceived(ConnectionHandl er.java:132)

at org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageReceived (AbstractIoFilterChain.java:703)

at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(Ab stractIoFilterChain.java:362)

at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilt erChain.java:54)

at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceive d(AbstractIoFilterChain.java:800)

at org.apache.mina.filter.codec.support.SimpleProtocolDecoderOutput.flush(SimplePr otocolDecoderOutput.java:62)

at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecF ilter.java:200)

at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(Ab stractIoFilterChain.java:362)

at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilt erChain.java:54)

at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceive d(AbstractIoFilterChain.java:800)

at org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java :266)

at org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(Execut orFilter.java:326)

at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

User name is “mochalova”

I hope that this issue will be resolved, because I had to temprarily remove this plugin from server.

Waiting for 1.0.5

If you need any help, I’'d be glad to…

This is odd…

Ok, when a user updates a vCard my plugin first tries to create the vCard. If the DefaultVCardProvider throws an Exception, the vCard already exists and needs to be updated:


public void updateVCard(String username, Element vCardElement) throws NotFoundException {

// try to create the vcard in the database

try {

defaultProvider.createVCard(username, vCardElement);

Log.info(“vCard created for user ‘’” + username + “’’”);

}

// or update the existing vcard if it already exists

catch (AlreadyExistsException e) {

defaultProvider.updateVCard(username, vCardElement);

Log.info(“vCard updated for user ‘’” + username + “’’”);

}

}


Here is the code in DefaultVCardProvider that should throw the AlreadyExistsException:


public void createVCard(String username, Element vCardElement) throws AlreadyExistsException {

if (loadVCard(username) != null) {

// The user already has a vCard

throw new AlreadyExistsException(“Username " + username + " already has a vCard”);

}

Connection con = null;

PreparedStatement pstmt = null;

try {

con = DbConnectionManager.getConnection();

pstmt = con.prepareStatement(INSERT_PROPERTY);

pstmt.setString(1, username);

pstmt.setString(2, vCardElement.asXML());

pstmt.executeUpdate();

}

catch (SQLException e) {

Log.error("Error creating vCard for username: " + username, e);

}

finally {

try { if (pstmt != null) { pstmt.close(); } }

catch (Exception e) { Log.error(e); }

try { if (con != null) { con.close(); } }

catch (Exception e) { Log.error(e); }

}

}


This means loadVCard() does return null even if the database already contains a record for this user. But maybe the vcard record in the database is empty (no root element).+

Argh, is it really that hard to post some code snippets?

Maybe the problem is that there are not enough permissions to SQL database at the MS SQL Server?

Database and Version: Microsoft SQL Server 08.00.0760

JDBC Driver: jTDS Type 4 JDBC Driver for MS SQL Server and Sybase

JDBC Driver Version: 1.2

DB Connection URL: jdbc:jtds:sqlserver://192.168.0.10:1433/openfire;appName=jive

DB User: openfire

Transaction Support: Yes

Transaction Isolation Level: TRANSACTION_READ_COMMITTED

Supports multiple connections

open at once: Yes

In read-only mode: No

What does TRANSACTION_READ_COMMITTED mean?

So the problem is in the database, right?

Maybe the record in the DB contains no vCard. Could you please check the content of the record for this user in the table jiveVCard? Thanks.

There are issues with concurrent access. If I am setting, and then another thread updates, this will cause issues. With the issue indicated I am changing the interface to unify, the create and update functions on the provider to simply be, set. As really, the fact that you need to create or update is an implementation detail of the database implementation and should not be indicated in the interface. There are several places how this could could occur and it all just indicates to me that both the VCardManager and the default provider are deficient in providing adequate safety and thus preventing potential exceptions.

Cheers,

Alex

vader,

Two things, could you email me your error log and warning log, make sure there is nothing in there that you wouldn’'t want anyone to see before sending. And could you post what is stored in the database for these users that are throwing up the errors?

Thanks,

Alex

Thank you, it worked just fine.

Hi everybody,

In order to provide a consistent location where you can get the latest version of the plugin, I created a dedicated page on my website. Please use http://www.eyecraft.ch/coding/ldapvcardavatar/ to get the latest news related to this plugin.

Cheerio,

Hannes

Hi Hannes,

I have installed the plugin, I am able to set my personal avatar, but after some time, when I close spark and open again, the avatar has disappeared.

I have users in AD, Openfire DB in Oracle.

Thanks in advance,

JJ.-

I have the same issue with the avatar plugin…

I run Openfire 3.4.3 on top of Ubuntu with Avatar Plugin 1.0.4, i installed the plugin correctly and invited users to test the plugin features…

If a user disconnects and then reconnect immediately the avatar i still there…

if a user reboots or reconnects the day after the image is gone…

any clue? thanx