jdbcGroupProvider / Custom integration Woes

Hi everybody, I’ve treid searching the board, but all the information I’ve found has told me that my setup should be correct.

I’m currently using Openfire 3.7.1 on CentOS 5.7 with 1.6.0_24 Sun Microsystems Inc. – Java HotSpot™ Server VM (I Installed Openfire via RPM).

I currently have Openfire storing all it’s settings in a MySQL Database, and I have a jdbc provider setup for auth, user, and groups via another custom table.

Currently Auth and Users works without a hitch (Had to change one users username that had a space in it), buy when it comes to Groups, I get mixed results.

It pulls my Groupnames, Number of Groups, and Group Descriptions from the database just fine, but it never seems to even send the SQL for selecting a user’s groups, or the users in each group to the MySQL server (I have grep’d the MySQLd Log file extensively).

My group names are stored in the table chat_groups.

The table has 3 columns. gID (groupID) groupName and groupDesc

The users for each group are stored in the table chat_groups_users_test

The table has 3 columns. username, groupName isAdmin

Here’s the 3 Property names and their values:

jdbcGroupProvider.loadAdminsSQL

SELECT username FROM chat_groups_users_test WHERE groupName=? AND isAdmin=‘YES’

jdbcGroupProvider.loadMembersSQL

SELECT username FROM chat_groups_users_test WHERE groupName=? AND isAdmin=‘NO’

jdbcGroupProvider.userGroupsSQL

SELECT groupName FROM chat_groups_users_test WHERE username=?

when running tail -f and grepping the SQL log, these are the only queries that make it to the database as far as groups:

112202 Query SELECT count(*) FROM chat_groups

112203 Query SELECT groupName FROM chat_groups

112204 Query SELECT groupDesc FROM chat_groups WHERE groupName=‘Members’

112207 Query SELECT groupDesc FROM chat_groups WHERE groupName=‘Mistic’

112214 Query SELECT groupName FROM chat_groups

And this is the exception that Openfire throws:

2011.10.20 17:40:38 org.jivesoftware.openfire.group.JDBCGroupProvider - Parameter index out of range (1 > number of parameters, which is 0). java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0). at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910) at com.mysql.jdbc.PreparedStatement.setInternal(PreparedStatement.java:2796) at com.mysql.jdbc.PreparedStatement.setString(PreparedStatement.java:3627) at org.jivesoftware.openfire.group.JDBCGroupProvider.getMembers(JDBCGroupProvider.java:198) at org.jivesoftware.openfire.group.JDBCGroupProvider.getGroup(JDBCGroupProvider.java:176) at org.jivesoftware.openfire.group.GroupManager.getGroup(GroupManager.java:294) at org.jivesoftware.openfire.group.GroupManager.getGroup(GroupManager.java:273) at org.jivesoftware.openfire.group.GroupCollection$UserIterator.getNextElement(GroupCollection.java:113) at org.jivesoftware.openfire.group.GroupCollection$UserIterator.hasNext(GroupCollection.java:76) at org.jivesoftware.openfire.admin.group_002dsummary_jsp._jspService(group_002dsummary_jsp.java:211) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:530) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1216) at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:118) at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1187) at org.jivesoftware.util.LocaleFilter.doFilter(LocaleFilter.java:74) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1187) at org.jivesoftware.util.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:50) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1187) at org.jivesoftware.admin.PluginFilter.doFilter(PluginFilter.java:78) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1187) at org.jivesoftware.admin.AuthCheckFilter.doFilter(AuthCheckFilter.java:164) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1187) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:425) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:494) at org.eclipse.jetty.server.session.SessionHandler.handle(SessionHandler.java:182) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:933) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:362) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:867) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117) at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:245) at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:113) at org.eclipse.jetty.server.Server.handle(Server.java:334) at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:559) at org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:992) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:541) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:203) at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:406) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:462) at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:436) at java.lang.Thread.run(Unknown Source)

Does anyone have any clue what’s going on or even a direction to point me in?

-GeekGirl

Hello,

Thanks for the very detailed message. Did you restart openfire after making those setting changes? If not, those settings may not be seen by the provider.

daryl

1 Like

I swear to you, that I restarted the server serveral times, plus emptied the caches… Never made a change. This time I changed to using the /etc/inid.d start script, (instead of doing ./openfire.sh whilst testing) and it lost my config… I told it to connect to the SQL it did, I re setup the 3 class providers, it did, there was a typo in my groups class provider statement, so it threw an exception about not knowing the group provider… I fixed it, and now my groups work fully!

I have NO clue what really made this work, but thank you, I might actually sleep tonite!

Hello,

You’ll want to be very careful about how you start openfire and which user ends up owning the openfire process. If you are doing it from the SysVInit script, the process owner is probably daemon. If you are doing ./something, then perhaps you are running as user root. This will cause pain with file ownerships. Ensure that if daemon is to run the process, that it owns everything inside of /opt/openfire

chown -R daemon:daemon /opt/openfire

daryl