Database - Windows authentication support

I am facing an issue using windows integrated authentication for MS SQLServer using JTDS.

Installation details:

Openfire version: 3.9.3

Conf file entry : openfire.xml.

<?xml version="1.0" encoding="UTF-8"?>

* *

  • *

  • *
  • 9090 *

  • 9091 *

  • *

  • en *

  • *

  • org.jivesoftware.database.DefaultConnectionProvider *

  • *

  • *

  • *

  •  <driver>net.sourceforge.jtds.jdbc.Driver</driver>  *
    
  •  <serverURL>jdbc:jtds:sqlserver://localhost/ChatDB;appName=jive;ssl=request;useN TLMv2=true</serverURL>   *
    
  •  <testSQL>select 1</testSQL>  *
    
  •  <testBeforeUse>false</testBeforeUse>  *
    
  •  <testAfterUse>false</testAfterUse>  *
    
  •  <minConnections>5</minConnections>  *
    
  •  <maxConnections>25</maxConnections>  *
    
  •  <connectionTimeout>1.0</connectionTimeout> *
    
  • *

  • *

  • true *

  • *

  • *

  • *

  • *

  • *

  • *

  • *

  • *

  • *

  •  <autoadd>true</autoadd> *
    
  • *

  • *

Observation: When I value username/password with valid user in “openfire.xml” openfire starts fine, though , I see database user as windows user in Admin page.

If I remove entries for username/password OR make it empty OR make entry for wrong username/password “openfire.xml”, I see below error.

Need your help in fixing the same.

  1. 2016.12.20 20:07:35 org.jivesoftware.util.JiveProperties - Violation of PRIMARY KEY constraint ‘ofProperty_pk’. Cannot insert duplicate key in object ‘dbo.ofProperty’. The duplicate key value is (xmpp.session.conflict-limit).
  2. java.sql.SQLException: Violation of PRIMARY KEY constraint ‘ofProperty_pk’. Cannot insert duplicate key in object ‘dbo.ofProperty’. The duplicate key value is (xmpp.session.conflict-limit).
  • at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368)*

  • at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2816)*

  • at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2254)*

  • at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:631)*

  • at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:584)*

  • at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:546)*

  • at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeUpdate(JtdsPreparedState ment.java:505)*

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

  • at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)*

  • at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)*

  • at java.lang.reflect.Method.invoke(Unknown Source)*

  • at org.logicalcobwebs.proxool.ProxyStatement.invoke(ProxyStatement.java:100)*

  • at org.logicalcobwebs.proxool.ProxyStatement.intercept(ProxyStatement.java:57)*

  • at $java.sql.Statement$$EnhancerByProxool$$8ebad043.executeUpdate()*

  • at org.jivesoftware.util.JiveProperties.insertProperty(JiveProperties.java:293)*

  • at org.jivesoftware.util.JiveProperties.put(JiveProperties.java:234)*

  • at org.jivesoftware.util.JiveGlobals.setProperty(JiveGlobals.java:734)*

  • at org.jivesoftware.openfire.SessionManager.initialize(SessionManager.java:1300)*

  • at org.jivesoftware.openfire.XMPPServer.initModules(XMPPServer.java:591)*

  • at org.jivesoftware.openfire.XMPPServer.start(XMPPServer.java:477)*

  • at org.jivesoftware.openfire.XMPPServer.(XMPPServer.java:197)*

  • at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)*

  • at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)*

  • at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)*

  • at java.lang.reflect.Constructor.newInstance(Unknown Source)*

  • at java.lang.Class.newInstance(Unknown Source)*

  • at org.jivesoftware.openfire.starter.ServerStarter.start(ServerStarter.java:113)*

  • at org.jivesoftware.openfire.starter.ServerStarter.main(ServerStarter.java:58)*

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

  • at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)*

  • at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)*

  • at java.lang.reflect.Method.invoke(Unknown Source)*

  • at com.exe4j.runtime.LauncherEngine.launch(Unknown Source)*

  • at com.exe4j.runtime.WinLauncher$2.run(Unknown Source)*

This error stats that you want to add aother property with same name (database.defaultProvider.password,database.defaultProvider.username) But it fails because one entry already exists in datatable and database property name is primary key for ofproperty table so it will cause primary key violation error.

if you want to set username,password either you can set while set up of database at setting up openfire server or you could change it from openfire admin panel (server manager - > server property ) and serch for those two proprty and edit it from there but don’t change from xml file.

Hope it will clear your doubts